Update dependencies to match radas update #513
Workflow file for this run
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/CD Pipeline | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ['*'] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| # Opt-in to Node 24 and cancel redundant runs | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # --- JOB 1: GENERATE RADAS DATA --- | |
| radas: | |
| name: Generate Radas Data | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Poetry | |
| run: pipx install poetry==2.1.3 | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| cache: 'poetry' | |
| - name: Install dependencies | |
| run: poetry install | |
| - name: Cache radas results | |
| id: radas-cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: ./radas_dir | |
| key: radas-${{ hashFiles('poetry.lock') }} | |
| - name: Make radas data | |
| if: steps.radas-cache.outputs.cache-hit != 'true' | |
| run: poetry run radas -c radas_config.yaml | |
| - name: Upload radas artifacts | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: radas_dir | |
| path: ./radas_dir | |
| retention-days: 180 | |
| # --- JOB 2: TEST & LINT --- | |
| build: | |
| name: Test (Python ${{ matrix.python-version }}) | |
| needs: radas | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.12', '3.13', '3.14'] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y pandoc | |
| - name: Install Poetry | |
| run: pipx install poetry==2.1.3 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'poetry' | |
| - name: Install dependencies | |
| run: poetry install | |
| - name: Restore radas data | |
| uses: actions/cache/restore@v5 | |
| id: radas-restore | |
| with: | |
| path: ./radas_dir | |
| key: radas-${{ hashFiles('poetry.lock') }} | |
| - name: Verify Cache | |
| if: steps.radas-restore.outputs.cache-hit != 'true' | |
| run: exit 1 | |
| - name: Run Tests | |
| env: | |
| MPLBACKEND: Agg | |
| run: poetry run pytest tests --nbmake example_cases -m "not docs" | |
| - name: Regression Tests | |
| env: | |
| MPLBACKEND: Agg | |
| run: | | |
| poetry run python tests/utils/regression_results.py | |
| poetry run pytest --no-cov tests/test_regression_against_cases.py | |
| - name: Upload regression results on failure | |
| uses: actions/upload-artifact@v5 | |
| if: failure() | |
| with: | |
| name: regression_results-${{ matrix.python-version }} | |
| path: tests/regression_results | |
| - name: Smoke test package | |
| env: | |
| MPLBACKEND: Agg | |
| run: | | |
| poetry build -f wheel | |
| python -m venv test_env | |
| source test_env/bin/activate | |
| pip install dist/*.whl | |
| mkdir tmp_dir && cd tmp_dir | |
| popcon ../example_cases/SPARC_PRD -d radas_dir WORKING_DIR/../radas_dir | |
| - name: Pre-commit checks | |
| run: poetry run pre-commit run --show-diff-on-failure --color=always --all-files | |
| - name: Documentation tests | |
| run: | | |
| cd docs | |
| poetry run sphinx-build --keep-going -Wnb html . _build/ | |
| poetry run make doctest | |
| poetry run make linkcheck | |
| # --- JOB 3: PREPARE RELEASE --- | |
| build_release: | |
| name: Build Release | |
| if: startsWith(github.ref, 'refs/tags') | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Poetry | |
| run: pipx install poetry==2.1.3 | |
| - name: Build distributions | |
| run: poetry build | |
| - name: Upload PyPI artifacts | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: pypi-build | |
| path: ./dist | |
| retention-days: 1 | |
| # --- JOB 4: PUBLISH --- | |
| publish: | |
| name: Publish to PyPI | |
| if: startsWith(github.ref, 'refs/tags') | |
| needs: build_release | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi-publish | |
| url: https://pypi.org/project/cfspopcon/ | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: pypi-build | |
| path: dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist/ |