Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 32 additions & 58 deletions .github/workflows/process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,17 @@ permissions:

jobs:
unit-test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install PROCESS
# Editable install to match default install
run: |
pip install -e '.[test]'
- name: Run unit tests
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@main
- name: Run unit tests with coverage report
run: |
pytest --cov=process tests/unit -v \
--cov-report xml
hatch run test:tests-cov tests/unit
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
env:
Expand All @@ -37,37 +34,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@main
with:
python-version: '3.10'
- name: Install PROCESS
# Editable install to match default install
run: |
pip install -e '.[test]'
- name: Install poppler
run: |
sudo apt update
sudo apt install poppler-utils
- name: Run integration tests
run: pytest tests/integration -n auto -v
run: hatch run test-default:tests tests/integration

example-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@main
with:
python-version: '3.10'
- name: Install PROCESS
# Editable install to match default install
run: |
pip install -e '.[test, examples]'
- name: Install poppler
run: |
sudo apt update
sudo apt install poppler-utils
- name: Run example notebook tests
run: pytest tests/examples -n auto -v
- name: Run example tests
run: hatch run test-default:tests tests/examples

regression-test:
runs-on: ubuntu-latest
Expand All @@ -82,30 +65,24 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@main
with:
python-version: '3.10'
- name: Install PROCESS
# Editable install to match default install
run: |
pip install -e '.[test]'
- name: Allow git commands to be run
run: git config --global --add safe.directory '*'
- name: Run regression tests
run: pytest tests/regression -sv --reg-tolerance=${{ matrix.tolerance }}
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
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@main
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
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
Expand All @@ -123,13 +100,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@main
with:
python-version: '3.10'
- name: Install dev dependencies
run: pip install '.[lint]'
- name: Run pre-commit
run: pre-commit run --all-files
run: hatch run lint:fmt

tracking:
concurrency:
Expand All @@ -142,11 +118,10 @@ jobs:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@main
with:
python-version: '3.10'
- name: Install PROCESS
run: pip install -e '.[test, docs, lint]'
- name: Setup SSH identity
uses: webfactory/[email protected]
with:
Expand All @@ -163,9 +138,9 @@ jobs:
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 }}
hatch run 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
run: hatch run python tracking/tracking_data.py plot process-tracking-data --out tracking.html
- name: Archive tracking dashboard
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -193,12 +168,11 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
- name: Setup python and hatch
uses: Fusion-Power-Plant-Framework/fppf-actions/setup-hatch@main
with:
python-version: '3.10'
- name: Install PROCESS
run: pip install -e '.[test, lint, docs]'
- run: python scripts/vardes.py
- run: hatch run python scripts/vardes.py
- run: git config --global --add safe.directory '*'
- name: Download STF_TF.json files
uses: actions/download-artifact@v4
Expand All @@ -212,10 +186,10 @@ jobs:
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
run: hatch 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
- run: hatch run docs:build
- name: Download tracking html
uses: actions/download-artifact@v4
with:
Expand Down
13 changes: 10 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ test = [
"requests>=2.30",
"testbook>=0.4",
"pytest-cov>=3.0.0",
"pytest-xdist>=2.5.0"
"pytest-xdist>=2.5.0",
"process[examples]"
]
examples = ["jupyter==1.0.0"]
plotly = ["plotly>=5.15.0,<6"]
Expand Down Expand Up @@ -83,17 +84,23 @@ artifacts = [
]

[tool.hatch.envs.default]
features = ["dev", "test", "docs", "lint"]
features = ["test", "docs", "lint"]

[tool.hatch.envs.test]
features = ["test"]
[[tool.hatch.envs.test.matrix]]
python = ["3.10", "3.11", "3.12", "3.13"]
[tool.hatch.envs.test.scripts]
tests = "pytest {args:tests}"
tests = "pytest -n auto -v {args:tests}"
tests-cov = "pytest --cov process --cov-report html:htmlcov --cov-report xml {args:tests}"
tests-cov-private = "pytest --private --cov process --cov-report html:htmlcov --cov-report xml {args:tests}"

[tool.hatch.envs.test-default]
template="test"
[[tool.hatch.envs.test-default.matrix]]
python = ["3.10"]


[tool.hatch.envs.docs]
features = ["docs"]
[tool.hatch.envs.docs.scripts]
Expand Down
1 change: 1 addition & 0 deletions tracking/run_tracking_inputs.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!python
"""Run the tracked files and move into tracking directory."""

import argparse
Expand Down