CI: split slow test mode into separate workflow (#152) #8111
This file contains 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 | |
on: | |
push: | |
branches-ignore: | |
- classic* | |
schedule: | |
- cron: 0 13 * * 1 | |
workflow_dispatch: | |
workflow_call: # for triggering the full test mode | |
inputs: | |
# test mode enables the santizers and additional assertions | |
testmode: | |
required: false | |
default: 'OFF' | |
type: string | |
env: | |
ASAN_OPTIONS: detect_stack_use_after_return=1:detect_leaks=0 | |
jobs: | |
testmodels: | |
strategy: | |
matrix: | |
os: [ubuntu-24.04] | |
testname: | |
[ | |
classicmode_1d_3dgrid, | |
classicmode_3d, | |
kilonova_1d_1dgrid, | |
kilonova_1d_3dgrid, | |
kilonova_2d_2dgrid, | |
kilonova_2d_2dgrid_barnesthermalisation, | |
kilonova_2d_2dgrid_expansionopac, | |
kilonova_2d_2dgrid_xcomgammaphotoion, | |
kilonova_2d_3dgrid, | |
nebular_1d_3dgrid, | |
nebular_1d_3dgrid_limitbfest, | |
] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 120 | |
name: ${{ matrix.testname }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install gcc-14 | |
if: always() | |
uses: fortran-lang/setup-fortran@v1 | |
with: | |
compiler: gcc | |
version: 14 | |
- name: install gsl and openmpi | |
run: | | |
sudo apt-get update | |
sudo apt install -y libgsl-dev | |
sudo apt install -y openmpi-bin libopenmpi-dev | |
- name: CPU type and core count | |
id: cpu-count | |
run: | | |
g++ -march=native -Q --help=target | grep -- '-march= ' | cut -f3 | |
#python3 -m pip install psutil | |
#python3 -c 'import psutil; print(f"CPU count (physical only): {int(psutil.cpu_count(logical=False))}")' | |
python3 -c 'import multiprocessing; print(f"CPU count: {multiprocessing.cpu_count()}")' | |
echo "count=$(python3 -c 'import multiprocessing; print(multiprocessing.cpu_count())')" >> $GITHUB_OUTPUT | |
# cache this for classic options because the super low integration tolerance makes generation of the file very slow | |
- name: Cache ratecoeff.dat | |
if: ${{ startsWith(matrix.testname, 'classicmode') }} | |
uses: actions/cache@v4 | |
with: | |
path: tests/${{ matrix.testname }}_testrun/ratecoeff.dat | |
key: tests/${{ matrix.testname }}_testrun/ratecoeff.dat-${{ github.run_id }} | |
restore-keys: | | |
tests/${{ matrix.testname }}_testrun/ratecoeff.dat- | |
- name: Cache test atomic data | |
if: ${{ !startsWith(matrix.testname, 'classicmode') }} | |
uses: actions/cache@v4 | |
id: cache-testatomicdata | |
with: | |
path: tests/atomicdata_feconi.tar.xz | |
key: tests/atomicdata_feconi.tar.xz | |
- name: Cache test atomic data classic | |
if: ${{ startsWith(matrix.testname, 'classicmode') }} | |
uses: actions/cache@v4 | |
id: cache-testatomicdata-classic | |
with: | |
path: tests/atomicdata_classic.tar.xz | |
key: tests/atomicdata_classic.tar.xz | |
- name: Download/extract test data | |
working-directory: tests/ | |
run: | | |
source ./setup_${{ matrix.testname }}.sh | |
- name: cat artisoptions.h | |
run: | | |
cp tests/${{ matrix.testname }}_testrun/artisoptions.h . | |
cat artisoptions.h | |
- name: Compile | |
run: | | |
make REPRODUCIBLE=ON TESTMODE=${{ inputs.testmode }} MAX_NODE_SIZE=2 FASTMATH=OFF -j${{ steps.cpu-count.outputs.count }} sn3d exspec | |
cp sn3d tests/${{ matrix.testname }}_testrun/ | |
cp exspec tests/${{ matrix.testname }}_testrun/ | |
- name: Run test job0 start | |
if: always() | |
working-directory: tests/${{ matrix.testname }}_testrun/ | |
run: | | |
cp input-newrun.txt input.txt | |
touch output_0-0.txt | |
time mpirun -np 4 --oversubscribe --mca mpi_yield_when_idle 1 ./sn3d | |
- name: Move job0 files | |
if: always() | |
working-directory: tests/${{ matrix.testname }}_testrun/ | |
run: | | |
mkdir job0 | |
../../scripts/movefiles.sh job0 | |
- name: cat job0 estimators | |
if: always() | |
working-directory: tests/${{ matrix.testname }}_testrun/ | |
run: cat job0/estimators*.out | |
- name: cat job0 output log | |
if: always() | |
working-directory: tests/${{ matrix.testname }}_testrun/ | |
run: cat job0/output_0-0.txt | |
- name: Checksum job0 output files | |
#if: always() | |
if: always() | |
working-directory: tests/${{ matrix.testname }}_testrun | |
run: | | |
md5sum *.out job0/*.out | tee ../${{ matrix.testname }}_inputfiles/results_md5_job0.txt | |
if [ -f results_md5_job0.txt ]; then md5sum -c results_md5_job0.txt; else echo "results_md5_job0.txt not found"; fi | |
- name: Run test job1 resume | |
if: always() | |
working-directory: tests/${{ matrix.testname }}_testrun/ | |
run: | | |
cp input-resume.txt input.txt | |
time mpirun -np 4 --oversubscribe --mca mpi_yield_when_idle 1 ./sn3d | |
- name: Move job1 files | |
if: always() | |
working-directory: tests/${{ matrix.testname }}_testrun/ | |
run: | | |
rm *.tmp | |
mkdir job1 | |
../../scripts/movefiles.sh job1 | |
- name: cat job1 estimators | |
if: always() | |
working-directory: tests/${{ matrix.testname }}_testrun/ | |
run: cat job1/estimators*.out | |
- name: cat job1 output log | |
if: always() | |
working-directory: tests/${{ matrix.testname }}_testrun/ | |
run: cat job1/output_0-0.txt | |
- name: show deposition.out | |
if: always() && inputs.testmode == 'OFF' | |
working-directory: tests/${{ matrix.testname }}_testrun/ | |
run: | | |
cat deposition.out | |
- name: Run exspec | |
if: always() | |
working-directory: tests/${{ matrix.testname }}_testrun/ | |
run: | | |
time mpirun -np 1 ./exspec | |
python3 ../../scripts/mergeangleres.py | |
rm -f light_curve_res_*.out spec_res_*.out specpol_res_*.out | |
- name: cat exspec log | |
if: always() | |
working-directory: tests/${{ matrix.testname }}_testrun/ | |
run: | | |
mkdir output | |
cat exspec.txt | |
- name: Checksum job1 output files | |
#if: always() | |
if: always() | |
working-directory: tests/${{ matrix.testname }}_testrun | |
run: | | |
md5sum *.out job1/*.out | tee ../${{ matrix.testname }}_inputfiles/results_md5_final.txt | |
if [ -f results_md5_final.txt ]; then md5sum -c results_md5_final.txt; else echo "results_md5_final.txt not found"; fi | |
- name: Prepare for next steps | |
if: always() | |
working-directory: tests/${{ matrix.testname }}_testrun | |
run: | | |
touch requirements.txt | |
find . -name "*_res_*.out" -exec zstd -v -T0 --rm -f {} \; | |
- name: Upload output files | |
uses: actions/upload-artifact@v4 | |
if: always() && inputs.testmode == 'OFF' | |
with: | |
name: test-${{ matrix.testname }}-output | |
path: tests/${{ matrix.testname }}_testrun | |
- name: Upload checksum files | |
uses: actions/upload-artifact@v4 | |
if: always() && inputs.testmode == 'OFF' | |
with: | |
name: ${{ matrix.testname }}_inputfiles | |
path: tests/${{ matrix.testname }}_inputfiles/results_md5* | |
- name: Set up Python | |
if: always() && inputs.testmode == 'OFF' | |
uses: actions/setup-python@v5 | |
- name: Install artistools | |
if: always() && inputs.testmode == 'OFF' | |
run: | | |
python3 -m pip install --upgrade pip uv | |
uv pip install --system -U artistools | |
- name: Plot light curve | |
if: always() && inputs.testmode == 'OFF' | |
working-directory: tests/ | |
run: | | |
at plotlightcurves ${{ matrix.testname }}_testrun | |
at plotlightcurves --frompackets ${{ matrix.testname }}_testrun | |
- name: Plot spectrum nebular | |
if: always() && inputs.testmode == 'OFF' && startsWith(matrix.testname, 'nebular') | |
working-directory: tests/ | |
run: | | |
at plotspectra --frompackets -ts 8 ${{ matrix.testname }}_testrun | |
- name: Plot spectrum classicmode | |
if: always() && inputs.testmode == 'OFF' && startsWith(matrix.testname, 'classicmode_') | |
working-directory: tests/ | |
run: | | |
at plotspectra --frompackets -t 4-6 ${{ matrix.testname }}_testrun | |
- name: Plot virtual packet spectrum classicmode_1d | |
if: always() && inputs.testmode == 'OFF' && startsWith(matrix.testname, 'classicmode_1d') | |
working-directory: tests/ | |
run: | | |
at plotspectra -t 4-6 -plotvspecpol 0 1 2 3 12 13 14 --frompackets ${{ matrix.testname }}_testrun | |
- name: Plot spectrum kilonova | |
if: always() && inputs.testmode == 'OFF' && startsWith(matrix.testname, 'kilonova') | |
working-directory: tests/ | |
run: | | |
at plotspectra --frompackets -t 2 ${{ matrix.testname }}_testrun | |
- name: Upload plot files | |
if: always() && inputs.testmode == 'OFF' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-${{ matrix.testname }}-output-pdf | |
path: tests/*.pdf | |
combine_checksums: | |
needs: testmodels | |
if: always() && inputs.testmode == 'OFF' | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Download test output | |
uses: actions/download-artifact@v4 | |
- name: List all files | |
if: always() | |
run: find . | |
- name: Upload bundled checksum files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: checksums | |
path: '*_inputfiles/results_md5*.txt' |