Skip to content

Regression test for surrogate training #15

Regression test for surrogate training

Regression test for surrogate training #15

Workflow file for this run

name: batfit-CI
on:
push:
branches: [main]
paths-ignore:
- '*.md'
- 'README*'
- 'LICENSE'
- 'docs/**'
pull_request:
branches: [main]
paths-ignore:
- '*.md'
- 'README*'
- 'LICENSE'
- 'docs/**'
jobs:
Lint:
name: Lint (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.10']
os: ['ubuntu-latest']
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install nox
run: pip install nox
- name: Code format
run: nox -s linter
- name: Spell check
run: nox -s codespell
Unit-Test:
name: (Unit-Test ${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.14']
os: ['ubuntu-latest', 'macos-latest']
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install batfit
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade nox
pip install .[tests]
- name: Pytest
env:
MPLBACKEND: Agg
run: nox -s tests -- no-reports
Regression-Test:
name: (Regression-Test ${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.14']
os: ['ubuntu-latest', 'macos-latest']
mpi: ['openmpi']
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup MPI
uses: mpi4py/setup-mpi@v1
with:
mpi: ${{ matrix.mpi }}
- name: Install batfit
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade nox
pip install .[tests]
- name: Generate data in parallel with MPI
env:
MPLBACKEND: Agg
run: |
cd scripts/reg_tests/1.gen_data
bash run.sh
if [ ! -f "data_spm_discharge/sols.pkl" ]; then
exit 1
fi
cd ../../../
- name: Train surrogate
run: |
cd scripts/reg_tests/2.train_surrogate
bash run.sh
if [ ! -f "spm_discharge_surrogate/models/model_final.pt" ]; then
exit 1
fi
if [ ! -f "spm_discharge_surrogate/models/Figures/surr_preds.pdf" ]; then
exit 1
fi
cd ../../../