Use hatch for quality job #7750
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: PROCESS main/develop testing | |
| on: | |
| pull_request: | |
| push: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| unit-test: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup python and hatch | |
| uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@main | |
| - name: Run unit tests with coverage report | |
| run: | | |
| hatch run test:tests-cov tests/unit | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| with: | |
| fail_ci_if_error: ${{ github.ref_name == 'main' }} | |
| integration-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup python and hatch | |
| uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@main | |
| with: | |
| python-version: '3.10' | |
| - name: Run integration tests | |
| run: hatch run test-default:tests tests/integration | |
| example-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup python and hatch | |
| uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@main | |
| with: | |
| python-version: '3.10' | |
| - name: Run example tests | |
| run: hatch run test-default:tests tests/examples | |
| regression-test: | |
| runs-on: ubuntu-latest | |
| needs: [tracking] | |
| # depend on make and tracking job but dont skip if tracking was skipped | |
| if: always() | |
| continue-on-error: true | |
| strategy: | |
| matrix: | |
| tolerance: [0.2, 5] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup python and hatch | |
| uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@main | |
| with: | |
| python-version: '3.10' | |
| - name: Run regression tests | |
| run: hatch run test-default:tests tests/regression --reg-tolerance=${{ matrix.tolerance }} | |
| run-tracking-inputs: | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install PROCESS | |
| run: pip install -e '.[lint, docs, test]' | |
| - name: Run regression input files | |
| run: python tracking/run_tracking_inputs.py run tests/regression/input_files | |
| - name: Move other files | |
| run: mv tests/regression/input_files/*.json tracking/ | |
| - name: Archive tracked MFILEs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: tracked-mfiles | |
| path: tracking/*_MFILE.DAT | |
| - name: Archive tracked SIG_TF.json | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sig-tfs | |
| path: tracking/*.json | |
| pre-commit-quality-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup python and hatch | |
| uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@main | |
| with: | |
| python-version: '3.10' | |
| - name: Run pre-commit | |
| run: hatch run lint:fmt | |
| tracking: | |
| concurrency: | |
| group: tracking-jobs | |
| cancel-in-progress: false | |
| runs-on: ubuntu-latest | |
| needs: run-tracking-inputs | |
| if: github.ref == 'refs/heads/main' | |
| env: | |
| COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install PROCESS | |
| run: pip install -e '.[test, docs, lint]' | |
| - name: Setup SSH identity | |
| uses: webfactory/ssh-agent@v0.7.0 | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| - name: Download tracking data | |
| run: git clone git@github.com:timothy-nunn/process-tracking-data.git process-tracking-data | |
| - name: Download MFILEs | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: tracked-mfiles | |
| path: tracking/ | |
| - name: Create new tracking entries | |
| shell: bash | |
| run: | | |
| MSG=$(printf "%q " $COMMIT_MESSAGE) | |
| git config --global --add safe.directory '*' | |
| python tracking/run_tracking_inputs.py track process-tracking-data "${MSG}" ${{ github.sha }} | |
| - name: Create the tracking dashboard | |
| run: python tracking/tracking_data.py plot process-tracking-data --out tracking.html | |
| - name: Archive tracking dashboard | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: tracking-html | |
| path: tracking.html | |
| - name: Setup Git identity | |
| run: | | |
| git config --global user.email "${{ github.triggering_actor }}@github.runner" | |
| git config --global user.name "${{ github.job }}" | |
| - name: Commit and push tracking data | |
| run: | | |
| cd process-tracking-data | |
| git add . | |
| git commit -m "${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" | |
| git push | |
| docs: | |
| concurrency: | |
| group: docs-jobs | |
| cancel-in-progress: false | |
| runs-on: ubuntu-latest | |
| needs: tracking | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install PROCESS | |
| run: pip install -e '.[test, lint, docs]' | |
| - run: python scripts/vardes.py | |
| - run: git config --global --add safe.directory '*' | |
| - name: Download STF_TF.json files | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: sig-tfs | |
| path: tracking/ | |
| - name: Download MFILEs | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: tracked-mfiles | |
| path: tracking/ | |
| - run: mv tracking/large_tokamak_nof.SIG_TF.json tracking/large_tokamak_nof_SIG_TF.json | |
| - name: Create an example plot proc | |
| run: python process/io/plot_proc.py -f tracking/large_tokamak_nof_MFILE.DAT | |
| - name: Move plot proc file to docs images | |
| run: mv tracking/large_tokamak_nof_MFILE.DATSUMMARY.pdf documentation/images/plot_proc.pdf | |
| - run: mkdocs build | |
| - name: Download tracking html | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: tracking-html | |
| - run: mv tracking.html site || cp site/404.html site/tracking.html | |
| - name: Upload documentation page | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: site/ | |
| - name: Deploy GitHub pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |