Check test coverage #210
This file contains hidden or 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: Check test coverage | |
| on: | |
| workflow_run: | |
| workflows: [Build OpenMPI cache] | |
| types: | |
| - completed | |
| jobs: | |
| coverage: | |
| name: Run test coverage check | |
| if: github.event.workflow_run.conclusion == 'success' | |
| runs-on: ubuntu-latest | |
| container: precice/precice:nightly | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| path: micro-manager | |
| ref: ${{ github.event.workflow_run.head_sha }} | |
| - name: Install dependencies | |
| run: | | |
| apt-get -qq update | |
| apt-get -qq install python3-dev python3-venv git pkg-config | |
| - name: Load Cache OpenMPI 5 | |
| id: ompi-cache-load | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: ~/openmpi | |
| key: openmpi-5.0.5-${{ runner.os }}-build | |
| - name: Configure OpenMPI | |
| run: | | |
| if [ ! -d ~/openmpi ]; then | |
| echo "::error::OpenMPI cache not found. The cache workflow may have failed." | |
| exit 1 | |
| fi | |
| cp -r ~/openmpi/* /usr/local/ | |
| ldconfig | |
| which mpiexec | |
| mpiexec --version | |
| - name: Create a virtual environment and install Micro Manager with coverage | |
| timeout-minutes: 6 | |
| working-directory: micro-manager | |
| run: | | |
| python3 -m venv .venv | |
| . .venv/bin/activate | |
| pip install coverage | |
| pip install .[sklearn,snapshot] | |
| pip uninstall -y pyprecice | |
| - name: Run serial unit tests with coverage | |
| working-directory: micro-manager/tests/unit | |
| env: | |
| PYTHONPATH: . | |
| run: | | |
| . ../../.venv/bin/activate | |
| python3 -m coverage run --parallel-mode --source=micro_manager -m unittest test_micro_manager | |
| python3 -m coverage run --parallel-mode --source=micro_manager -m unittest test_micro_simulation_crash_handling | |
| python3 -m coverage run --parallel-mode --source=micro_manager -m unittest test_adaptivity_serial | |
| python3 -m coverage run --parallel-mode --source=micro_manager -m unittest test_domain_decomposition | |
| python3 -m coverage run --parallel-mode --source=micro_manager -m unittest test_interpolation | |
| python3 -m coverage run --parallel-mode --source=micro_manager -m unittest test_hdf5_functionality | |
| python3 -m coverage run --parallel-mode --source=micro_manager -m unittest test_snapshot_computation | |
| python3 -m coverage run --parallel-mode --source=micro_manager -m unittest test_micro_simulation | |
| - name: Run tasking unit tests with coverage | |
| working-directory: micro-manager/tests/unit | |
| env: | |
| PYTHONPATH: . | |
| OMPI_ALLOW_RUN_AS_ROOT: "1" | |
| OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: "1" | |
| run: | | |
| . ../../.venv/bin/activate | |
| python3 -m coverage run --parallel-mode --source=micro_manager -m unittest test_tasking | |
| - name: Run parallel unit tests with coverage | |
| working-directory: micro-manager/tests/unit | |
| run: | | |
| . ../../.venv/bin/activate | |
| mpirun -n 2 --allow-run-as-root -x PYTHONPATH=. python3 -m coverage run --parallel-mode --source=micro_manager -m unittest test_adaptivity_parallel | |
| mpirun -n 2 --allow-run-as-root -x PYTHONPATH=. python3 -m coverage run --parallel-mode --source=micro_manager -m unittest test_load_balancing | |
| mpirun -n 2 --allow-run-as-root -x PYTHONPATH=. python3 -m coverage run --parallel-mode --source=micro_manager -m unittest test_interpolation | |
| - name: Combine coverage data | |
| working-directory: micro-manager/tests/unit | |
| run: | | |
| . ../../.venv/bin/activate | |
| python3 -m coverage combine | |
| python3 -m coverage report --format=total | python3 ../../check_coverage.py |