Merge branch 'fix/github-builds' into 'main' #460
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI Pipeline | |
| # Controls when the workflow will run | |
| on: | |
| # Triggers the workflow on push and pull request events but only for the main branch | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main, refactoring] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
| jobs: | |
| static_tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.9" | |
| - name: Install full package | |
| run: | | |
| pip install --upgrade pip wheel poetry==2.1.3 poetry-dynamic-versioning | |
| eval $(poetry env activate) | |
| poetry cache clear pypi --all | |
| ./poetry_wrapper.sh --experimental sync | |
| - name: ruff | |
| run: | | |
| ./poetry_wrapper.sh --generate | |
| eval $(poetry env activate) | |
| poetry run ruff check . | |
| - name: black | |
| run: | | |
| ./poetry_wrapper.sh --generate | |
| eval $(poetry env activate) | |
| black --check --diff -- . | |
| - name: poetry-check | |
| run: | | |
| eval $(poetry env activate) | |
| ./poetry_wrapper.sh check | |
| ./poetry_wrapper.sh --experimental check | |
| - name: toml-sort | |
| run: | | |
| ./poetry_wrapper.sh --generate | |
| eval $(poetry env activate) | |
| poetry run toml-sort --check pyproject.toml | |
| ./poetry_wrapper.sh --experimental --generate | |
| poetry run toml-sort --check pyproject.toml | |
| pytest_core: | |
| needs: static_tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install core package | |
| run: | | |
| pip install --upgrade pip wheel poetry==2.1.3 | |
| ./poetry_wrapper.sh sync | |
| - name: pytest | |
| run: | | |
| ./poetry_wrapper.sh --generate | |
| eval $(poetry env activate) | |
| poetry run pytest -m core tests/ --ignore=tests/experimental | |
| mv .coverage coverage_core_${{ matrix.python-version }} | |
| - name: Upload coverage | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage_core_${{ matrix.python-version }} | |
| path: coverage_core_${{ matrix.python-version }} | |
| pytest_conditional: | |
| needs: static_tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install conditional package | |
| run: | | |
| pip install --upgrade pip wheel poetry==2.1.3 poetry-dynamic-versioning | |
| ./poetry_wrapper.sh --experimental sync | |
| eval $(poetry env activate) | |
| pip install -q --upgrade onnx openvino optuna hnswlib fixed-install-nmslib | |
| - name: pytest | |
| run: | | |
| ./poetry_wrapper.sh --generate | |
| eval $(poetry env activate) | |
| poetry run pytest -m conditional tests/ --ignore=tests/experimental | |
| mv .coverage coverage_conditional_${{ matrix.python-version }} | |
| - name: Upload coverage | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage_conditional_${{ matrix.python-version }} | |
| path: coverage_conditional_${{ matrix.python-version }} | |
| pytest_torch: | |
| needs: static_tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install torch package | |
| run: | | |
| pip install --upgrade pip wheel poetry==2.1.3 poetry-dynamic-versioning | |
| ./poetry_wrapper.sh sync -E torch | |
| - name: pytest | |
| run: | | |
| ./poetry_wrapper.sh --generate | |
| eval $(poetry env activate) | |
| poetry run pytest -m "not spark and not experimental and not conditional" tests/ --ignore=tests/experimental | |
| mv .coverage coverage_torch_${{ matrix.python-version }} | |
| - name: Upload coverage | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage_torch_${{ matrix.python-version }} | |
| path: coverage_torch_${{ matrix.python-version }} | |
| pytest_spark: | |
| needs: static_tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install spark package | |
| run: | | |
| pip install --upgrade pip wheel poetry==2.1.3 poetry-dynamic-versioning | |
| ./poetry_wrapper.sh sync -E spark | |
| - name: pytest | |
| run: | | |
| ./poetry_wrapper.sh --generate | |
| eval $(poetry env activate) | |
| poetry run pytest -m "not torch and not experimental and not conditional" tests/ --ignore=tests/experimental --ignore=tests/models | |
| mv .coverage coverage_spark_${{ matrix.python-version }} | |
| - name: Upload coverage | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage_spark_${{ matrix.python-version }} | |
| path: coverage_spark_${{ matrix.python-version }} | |
| pytest_spark_torch: | |
| needs: static_tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install full package | |
| run: | | |
| pip install --upgrade pip wheel poetry==2.1.3 poetry-dynamic-versioning | |
| ./poetry_wrapper.sh sync -E spark -E torch | |
| - name: pytest | |
| run: | | |
| ./poetry_wrapper.sh --generate | |
| eval $(poetry env activate) | |
| poetry run pytest -m "not experimental and not conditional" --ignore=replay/models/nn/sequential/compiled --ignore=replay/experimental --ignore=tests/experimental --ignore=tests/models | |
| mv .coverage coverage_spark_and_torch_${{ matrix.python-version }} | |
| - name: Upload coverage | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage_spark_and_torch_${{ matrix.python-version }} | |
| path: coverage_spark_and_torch_${{ matrix.python-version }} | |
| pytest_experimental: | |
| needs: static_tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install experimental package | |
| run: | | |
| pip install --upgrade pip wheel poetry==2.1.3 poetry-dynamic-versioning | |
| ./poetry_wrapper.sh --experimental sync | |
| - name: pytest | |
| run: | | |
| ./poetry_wrapper.sh --generate | |
| eval $(poetry env activate) | |
| poetry run pytest -m "experimental" tests/ | |
| mv .coverage coverage_experimental_${{ matrix.python-version }} | |
| - name: Upload coverage | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage_experimental_${{ matrix.python-version }} | |
| path: coverage_experimental_${{ matrix.python-version }} | |
| pytest_models: | |
| needs: static_tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install full package | |
| run: | | |
| pip install --upgrade pip wheel poetry==2.1.3 poetry-dynamic-versioning | |
| ./poetry_wrapper.sh sync -E spark -E torch | |
| - name: pytest | |
| run: | | |
| ./poetry_wrapper.sh --generate | |
| eval $(poetry env activate) | |
| poetry run pytest -m "not experimental" tests/models --ignore=replay/experimental --ignore=tests/experimental | |
| mv .coverage coverage_models_${{ matrix.python-version }} | |
| - name: Upload coverage | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage_models_${{ matrix.python-version }} | |
| path: coverage_models_${{ matrix.python-version }} | |
| merge_coverage: | |
| needs: [pytest_core, pytest_conditional, pytest_torch, pytest_spark, pytest_spark_torch, pytest_models, pytest_experimental] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install only dev package | |
| run: | | |
| pip install --upgrade pip wheel poetry==2.1.3 poetry-dynamic-versioning | |
| ./poetry_wrapper.sh sync --only dev | |
| - name: Download coverage reports | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: coverage_* | |
| merge-multiple: true | |
| - name: Combine coverage | |
| run: | | |
| ./poetry_wrapper.sh --generate | |
| eval $(poetry env activate) | |
| poetry run coverage combine coverage_core_${{ matrix.python-version }} coverage_conditional_${{ matrix.python-version }} coverage_torch_${{ matrix.python-version }} coverage_spark_${{ matrix.python-version }} coverage_spark_and_torch_${{ matrix.python-version }} coverage_models_${{ matrix.python-version }} coverage_experimental_${{ matrix.python-version }} | |
| poetry run coverage report --fail-under=100 | |
| poetry run coverage xml | |
| build_production: | |
| needs: merge_coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.9" | |
| - name: Install production package | |
| run: | | |
| pip install --upgrade pip wheel poetry==2.1.3 poetry-dynamic-versioning | |
| ./poetry_wrapper.sh sync -E torch -E spark | |
| - name: Build | |
| run: | | |
| ./poetry_wrapper.sh --generate | |
| eval $(poetry env activate) | |
| export PACKAGE_SUFFIX=.dev | |
| ./poetry_wrapper.sh build | |
| build_experimental: | |
| needs: merge_coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.9" | |
| - name: Install full package | |
| run: | | |
| pip install --upgrade pip wheel poetry==2.1.3 poetry-dynamic-versioning | |
| ./poetry_wrapper.sh sync --only dev | |
| ./poetry_wrapper.sh --experimental sync | |
| - name: Build | |
| run: | | |
| ./poetry_wrapper.sh --generate --experimental | |
| eval $(poetry env activate) | |
| export PACKAGE_SUFFIX=.preview | |
| ./poetry_wrapper.sh --experimental build |