Skip to content

4400 remove hardcoded bc20m and tc0m #9953

4400 remove hardcoded bc20m and tc0m

4400 remove hardcoded bc20m and tc0m #9953

Workflow file for this run

---
name: PROCESS main/develop testing
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
env:
python-version: '3.10'
jobs:
unit-test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@c6af22fc8d00be67cca53a61177301462f499fb2
- name: Run unit tests with coverage report
run: |
hatch run test:tests-cov tests/unit
- name: Upload coverage to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
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@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@c6af22fc8d00be67cca53a61177301462f499fb2
with:
python-version: ${{ env.python-version }}
- name: Run integration tests
run: hatch run test.py${{ env.python-version }}:tests-integration
example-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@c6af22fc8d00be67cca53a61177301462f499fb2
with:
python-version: ${{ env.python-version }}
- name: Run example tests
run: hatch run test.py${{ env.python-version }}:tests-examples
regression-test:
runs-on: ubuntu-latest
needs: [tracking]
# depend on make and tracking job but don't skip if tracking was skipped
# run PROCESS on the regression test input files and compare results to the tracked files
if: always()
continue-on-error: true
strategy:
matrix:
tolerance: [0.2, 5]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
fetch-depth: 0
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@c6af22fc8d00be67cca53a61177301462f499fb2
with:
python-version: ${{ env.python-version }}
- name: Run regression tests
run: hatch run test.py${{ env.python-version }}:tests-regression --reg-tolerance=${{ matrix.tolerance }}
run-tracking-inputs:
runs-on: ubuntu-latest
# run PROCESS on the regression test input files and archive output MFILEs
# only runs upon merge to main
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@c6af22fc8d00be67cca53a61177301462f499fb2
with:
python-version: ${{ env.python-version }}
- name: Run regression input files
run: hatch 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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: tracked-mfiles
path: tracking/*_MFILE.DAT
- name: Archive tracked SIG_TF.json
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: sig-tfs
path: tracking/*.json
pre-commit-quality-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@c6af22fc8d00be67cca53a61177301462f499fb2
with:
python-version: ${{ env.python-version }}
- name: Run Hatch linting tasks
uses: Fusion-Power-Plant-Framework/fppf-actions/hatch-lint@c6af22fc8d00be67cca53a61177301462f499fb2
improve_quality_check:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
needs: [pre-commit-quality-check]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
fetch-depth: 0
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@c6af22fc8d00be67cca53a61177301462f499fb2
with:
python-version: ${{ env.python-version }}
- name: Get changed files
id: changes
shell: bash
run: |
set -euo pipefail
git diff --name-only origin/${{ github.base_ref }} \
| grep -E '\.pyi?$' \
> changed_files.txt || true
{
echo "files<<EOF"
cat changed_files.txt
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Run improvement lint
if: steps.changes.outputs.files != ''
shell: bash
run: |
set -euo pipefail
mapfile -t files <<< "${{ steps.changes.outputs.files }}"
hatch run lint:fmt_extra "${files[@]}"
tracking:
# update tracker to include the MFILEs created by the run-tracking-inputs job
concurrency:
group: tracking-jobs
cancel-in-progress: false
runs-on: ubuntu-latest
# depends on run-tracking-inputs; only runs upon merge to main
needs: run-tracking-inputs
if: github.ref == 'refs/heads/main'
env:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@c6af22fc8d00be67cca53a61177301462f499fb2
with:
python-version: ${{ env.python-version }}
- name: Setup SSH identity
uses: webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555
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@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
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 '*'
hatch run python tracking/run_tracking_inputs.py track process-tracking-data "${MSG}" ${{ github.sha }}
- name: Create the tracking dashboard
run: hatch run python tracking/tracking_data.py plot process-tracking-data --out tracking.html
- name: Archive tracking dashboard
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
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
# depends on tracking; only runs upon merge to main
needs: tracking
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
fetch-depth: 0
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@c6af22fc8d00be67cca53a61177301462f499fb2
with:
python-version: ${{ env.python-version }}
- run: git config --global --add safe.directory '*'
- name: Download STF_TF.json files
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: sig-tfs
path: tracking/
- name: Download MFILEs
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
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 summary
run: hatch run process plot summary -f tracking/large_tokamak_nof_MFILE.DAT
- name: Move plot summary file to docs images
run: mv tracking/large_tokamak_nof_MFILE.DATSUMMARY.pdf documentation/source/images/plot_summary.pdf
- run: hatch run docs:build
- name: Download tracking html
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
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@fc324d3547104276b827a68afc52ff2a11cc49c9
with:
path: site/
- name: Deploy GitHub pages
id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128