diff --git a/.github/workflows-config/os-versions.txt b/.github/workflows-config/os-versions.txt new file mode 100644 index 00000000..65095dba --- /dev/null +++ b/.github/workflows-config/os-versions.txt @@ -0,0 +1,5 @@ +ubuntu-22.04 +ubuntu-24.04 +macos-15 +macos-14 +windows-latest \ No newline at end of file diff --git a/.github/workflows-config/python-versions.txt b/.github/workflows-config/python-versions.txt new file mode 100644 index 00000000..04636f5b --- /dev/null +++ b/.github/workflows-config/python-versions.txt @@ -0,0 +1,6 @@ +3.8 +3.9 +3.10 +3.11 +3.12 +3.13 \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1fccf9c6..e59473a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,20 +3,33 @@ name: Build on: [push, pull_request] jobs: + load-matrix: + runs-on: ubuntu-latest + outputs: + python: ${{ steps.set-matrix.outputs.python }} + os: ${{ steps.set-matrix.outputs.os }} + steps: + - uses: actions/checkout@v4 + - id: set-matrix + run: | + echo "python=$(jq -Rsc 'split("\n") | map(select(length > 0))' .github/workflows-config/python-versions.txt)" >> $GITHUB_OUTPUT + echo "os=$(jq -Rsc 'split("\n") | map(select(length > 0))' .github/workflows-config/os-versions.txt)" >> $GITHUB_OUTPUT + test: + needs: load-matrix runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-22.04, ubuntu-24.04, macos-15, macos-14, windows-latest] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + os: ${{ fromJson(needs.load-matrix.outputs.os) }} + python-version: ${{ fromJson(needs.load-matrix.outputs.python) }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -43,10 +56,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.8' @@ -79,10 +92,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.10' @@ -189,10 +202,9 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 - + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.10' diff --git a/.github/workflows/regression-testing.yml b/.github/workflows/regression-testing.yml index bf6af402..ae53f46e 100644 --- a/.github/workflows/regression-testing.yml +++ b/.github/workflows/regression-testing.yml @@ -1,25 +1,43 @@ name: Regression Testing on: + push: + branches: ['*'] + tags: ['*'] + pull_request: + branches: [ master ] schedule: - cron: 0 0 * * * jobs: + load-matrix: + runs-on: ubuntu-latest + outputs: + python: ${{ steps.set-matrix.outputs.python }} + os: ${{ steps.set-matrix.outputs.os }} + steps: + - uses: actions/checkout@v4 + - id: set-matrix + run: | + echo "python=$(jq -Rsc 'split("\n") | map(select(length > 0))' .github/workflows-config/python-versions.txt)" >> $GITHUB_OUTPUT + echo "os=$(jq -Rsc 'split("\n") | map(select(length > 0))' .github/workflows-config/os-versions.txt)" >> $GITHUB_OUTPUT + test: + needs: load-matrix runs-on: ${{ matrix.os }} strategy: max-parallel: 1 matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.7", "3.8", "3.9", "3.10"] + os: ${{ fromJson(needs.load-matrix.outputs.os) }} + python-version: ${{ fromJson(needs.load-matrix.outputs.python) }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/lean/components/util/path_manager.py b/lean/components/util/path_manager.py index a9574b88..6e9a3f5c 100644 --- a/lean/components/util/path_manager.py +++ b/lean/components/util/path_manager.py @@ -12,6 +12,7 @@ # limitations under the License. from pathlib import Path +from typing import Optional from lean.components import reserved_names, output_reserved_names, forbidden_characters from lean.components.config.lean_config_manager import LeanConfigManager @@ -29,13 +30,15 @@ def __init__(self, lean_config_manager: LeanConfigManager, platform_manager: Pla self._lean_config_manager = lean_config_manager self._platform_manager = platform_manager - def get_relative_path(self, destination: Path, source: Path = Path.cwd()) -> Path: + def get_relative_path(self, destination: Path, source: Optional[Path] = None) -> Path: """Returns a path relative to another one. :param destination: the path to point to :param source: the root where the relative path is relative to :return: the destination path relative to the source path, or destination path if it is not relative """ + if source is None: + source = Path.cwd() try: return destination.relative_to(source) except ValueError: diff --git a/setup.py b/setup.py index f1df6c49..df6f6c5b 100644 --- a/setup.py +++ b/setup.py @@ -77,19 +77,19 @@ def get_stubs_version_range() -> str: "console_scripts": ["lean=lean.main:main"] }, install_requires=install_requires, - python_requires=">= 3.7", + python_requires=">= 3.8", classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Financial and Insurance Industry", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12" + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13" ], project_urls={ "Documentation": "https://www.lean.io/docs/v2/lean-cli/key-concepts/getting-started",