Focal plane visualizer and detector file generator (#345) #1155
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: Tests | |
on: [push] | |
jobs: | |
tests: | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 30 | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-13] | |
mpi: ["none", openmpi] # mpich | |
python: [3.9, 3.12] | |
exclude: | |
- os: macos-latest | |
mpi: mpich | |
python: 3.9 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
# Unfortunately we must use different keys to store the same data, | |
# otherwise GitHub will complain when multiple jobs are going to | |
# store it | |
- name: Cache PySM3 data files | |
id: cache-pysm3 | |
uses: actions/cache@v2 | |
with: | |
path: ~/pysm3-data | |
key: pysm3-data-${{ runner.os }}-${{ matrix.python }}-${{ matrix.mpi }}-${{ secrets.CACHE_VERSION }} | |
- name: Register PySM3 data path | |
run: | | |
echo "PYSM_LOCAL_DATA=$HOME/pysm3-data" >> $GITHUB_ENV | |
- name: Download PySM3 data files | |
if: steps.cache-pysm3.outputs.cache_hit != 'true' | |
run: | | |
rm -rf "$PYSM_LOCAL_DATA" && git clone https://github.com/galsci/pysm-data "$PYSM_LOCAL_DATA" | |
- name: Install basic dependencies (MPI, FFTW, poetry, IMO) | |
run: | | |
./bin/install-deps.sh ${{ matrix.mpi }} | |
pip install poetry | |
mkdir -p $HOME/.config/litebird_imo | |
echo -e "[[repositories]]\nlocation = \"$(pwd)/test/mock_imo/\"\nname = \"Mock IMO\"" | tee $HOME/.config/litebird_imo/imo.toml | |
- name: Install litebird_sim dependencies | |
run: | | |
EXTRAS="" | |
if [ "${{ matrix.mpi }}" != "none" ]; then | |
EXTRAS="$EXTRAS -E mpi" | |
fi | |
poetry export --without-hashes $EXTRAS -o requirements.txt | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
env: | |
DUCC0_OPTIMIZATION: none | |
- name: Install TOAST2 | |
run: | | |
if [ ${{ matrix.python }} == 3.9 ]; then | |
pip install toast | |
fi | |
- name: Enable rich traceback | |
continue-on-error: true | |
run: | | |
export DESTPATH="$(poetry env info -p)/lib/python${{ matrix.python }}/site-packages/sitecustomize.py" | |
echo -e "from rich.traceback import install\ninstall(show_locals=True)\n" > "$DESTPATH" | |
echo "$DESTPATH" | |
cat "$DESTPATH" | |
- name: Tests | |
run: bash ./bin/run_tests.sh | |
- name: Tests MPICH | |
if: ${{ matrix.mpi == 'mpich' }} | |
run: | | |
for proc in 1 5 9 ; do | |
echo "Running MPI test ($MPI) with $proc processes" | |
PYTHONPATH=. mpiexec -n $proc python3 ./test/test_mpi.py | |
done | |
- name: Tests OpenMPI | |
if: ${{ matrix.mpi == 'openmpi' }} | |
run: | | |
for proc in 1 2 ; do | |
echo "Running MPI test ($MPI) with $proc processes" | |
PYTHONPATH=. mpiexec -n $proc python3 ./test/test_mpi.py | |
done |