Read shells from file #4972
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: | |
# pull_request: | |
# branches-ignore: | |
# - classic* | |
env: | |
ASAN_OPTIONS: detect_stack_use_after_return=1:detect_leaks=0 | |
jobs: | |
testmodels: | |
strategy: | |
matrix: | |
# os: ['ubuntu-latest', 'self-hosted'] | |
os: [ubuntu-22.04] | |
testmode: [OFF, ON] | |
testname: | |
[ | |
classicmode_1d_3dgrid, | |
classicmode_3d, | |
kilonova_1d_1dgrid, | |
kilonova_1d_3dgrid, | |
kilonova_2d_2dgrid, | |
kilonova_2d_3dgrid, | |
nebularonezone_1d_3dgrid, | |
] | |
exclude: | |
- os: self-hosted | |
testmode: ON | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 45 | |
name: ${{ matrix.testname }}${{ matrix.testmode == 'ON' && ' testmode ON' || ''}} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: install dependencies | |
if: matrix.os != 'selfhosted' | |
run: | | |
git status | |
sudo apt update | |
sudo apt install -y gcc-13 g++-13 | |
sudo apt install -y libgsl-dev | |
sudo apt install -y openmpi-bin libopenmpi-dev | |
echo "OMPI_CXX=g++-13" >> $GITHUB_ENV | |
- name: CPU type and core count | |
id: cpu-count | |
run: | | |
g++ -march=native -Q --help=target | grep -- '-march= ' | cut -f3 | |
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: matrix.testname == 'classicmode_1d_3dgrid' || matrix.testname == 'classicmode_3d' | |
uses: actions/cache@v3 | |
with: | |
path: tests/${{ matrix.testname }}_testrun/ratecoeff.dat | |
key: tests/${{ matrix.testname }}_testrun/ratecoeff.dat-${{ github.sha }} | |
restore-keys: | | |
tests/${{ matrix.testname }}_testrun/ratecoeff.dat- | |
- name: Cache test atomic data | |
if: ${{ !startsWith(matrix.testname, 'classicmode_1d') }} | |
uses: actions/cache@v3 | |
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_1d') }} | |
uses: actions/cache@v3 | |
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: | | |
mpicxx --version | |
mpicxx --showme:version | |
make TESTMODE=${{ matrix.testmode }} MPI=ON -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 2 ./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() && matrix.os != 'selfhosted' && matrix.testmode == 'OFF' | |
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 2 ./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: cat job1 deposition.out | |
if: always() | |
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() && matrix.os != 'selfhosted' && matrix.testmode == 'OFF' | |
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() && matrix.os != 'selfhosted' | |
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@v3 | |
if: always() && matrix.os != 'selfhosted' && matrix.testmode == 'OFF' | |
with: | |
name: test-${{ matrix.testname }}-output | |
path: tests/${{ matrix.testname }}_testrun | |
- name: Upload checksum files | |
uses: actions/upload-artifact@v3 | |
if: always() && matrix.os != 'selfhosted' && matrix.testmode == 'OFF' | |
with: | |
name: ${{ matrix.testname }}_inputfiles | |
path: tests/${{ matrix.testname }}_inputfiles/results_md5* | |
- name: Set up Python | |
if: always() && matrix.os != 'selfhosted' && matrix.testmode == 'OFF' | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: pip | |
- name: Install artistools | |
if: always() && matrix.testmode == 'OFF' | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install artistools | |
# upgrade all installed packages to their latest versions | |
# python3 -m pip list freeze --outdated | tail -n +3 | cut -w -f1 | xargs -n1 python3 -m pip install --upgrade | |
- name: Plot light curve | |
if: always() && matrix.testmode == 'OFF' | |
working-directory: tests/ | |
run: | | |
at plotlightcurves ${{ matrix.testname }}_testrun | |
- name: Plot spectrum nebularonezone | |
if: always() && matrix.testname == 'nebularonezone' && matrix.testmode == 'OFF' | |
working-directory: tests/ | |
run: | | |
at plotspectra -ts 8 ${{ matrix.testname }}_testrun | |
- name: Plot spectrum classicmode | |
if: always() && matrix.testname == 'classicmode' && matrix.testmode == 'OFF' | |
working-directory: tests/ | |
run: | | |
at plotspectra -t 18-22 ${{ matrix.testname }}_testrun | |
- name: Upload plot files | |
if: always() && matrix.os != 'selfhosted' && matrix.testmode == 'OFF' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-${{ matrix.testname }}-output-pdf | |
path: tests/*.pdf | |
# - name: Compile previous commit | |
# if: matrix.testmode == 'OFF' | |
# continue-on-error: true | |
# run: | | |
# git checkout HEAD~1 | |
# git log -n 1 | |
# cp tests/${{ matrix.testname }}_testrun/artisoptions.h . | |
# make TESTMODE=${{ matrix.testmode }} MPI=ON -j${{ steps.cpu-count.outputs.count }} sn3d exspec | |
# cp sn3d tests/${{ matrix.testname }}_testrun/ | |
# cp exspec tests/${{ matrix.testname }}_testrun/ | |
# - name: Run previous commit job0 start | |
# if: matrix.testmode == 'OFF' | |
# continue-on-error: true | |
# working-directory: tests/${{ matrix.testname }}_testrun/ | |
# run: | | |
# cp input-newrun.txt input.txt | |
# touch output_0-0.txt | |
# time mpirun -np 2 ./sn3d | |
combine_checksums: | |
needs: testmodels | |
if: always() | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download test output | |
uses: actions/download-artifact@v3 | |
- name: List all files | |
if: always() | |
run: find . | |
- name: Upload bundled checksum files | |
uses: actions/upload-artifact@v3 | |
with: | |
name: checksums | |
path: '*_inputfiles/results_md5*.txt' |