Add BLAS and LAPACK install for CI tests #21
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: CI (build and test) | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| env: | |
| PYTHONPATH: ${{ github.workspace }}/python | |
| COVERAGE_PROCESS_START: ${{ github.workspace }}/.coveragerc | |
| MPLBACKEND: Agg | |
| FEELMRI_FAST_TEST: "1" | |
| steps: | |
| # ------------------------------------------------------------ | |
| # Checkout the repository | |
| # ------------------------------------------------------------ | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # ------------------------------------------------------------ | |
| # Set up Python environment (with pip caching) | |
| # ------------------------------------------------------------ | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| cache: "pip" | |
| # ------------------------------------------------------------ | |
| # Cache build and compiled objects | |
| # ------------------------------------------------------------ | |
| - name: Cache build artifacts | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/pip | |
| ~/.ccache | |
| build/ | |
| key: build-${{ runner.os }}-${{ hashFiles('setup.cfg', 'pyproject.toml', '**/CMakeLists.txt') }} | |
| restore-keys: | | |
| build-${{ runner.os }}- | |
| # ------------------------------------------------------------ | |
| # Install system dependencies (including MPI) | |
| # ------------------------------------------------------------ | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| python3 \ | |
| python3-dev \ | |
| python3-pip \ | |
| python3-tk \ | |
| cmake \ | |
| ninja-build \ | |
| git \ | |
| libopenmpi-dev \ | |
| ccache \ | |
| p7zip-full | |
| sudo apt-get clean | |
| # ------------------------------------------------------------ | |
| # Install FEelMRI and Python dependencies | |
| # ------------------------------------------------------------ | |
| - name: Install system dependencies for FEniCS Basix | |
| run: sudo apt-get update && sudo apt-get install -y libblas-dev liblapack-dev | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e .[dev] pytest pytest-cov coverage codecov | |
| # ------------------------------------------------------------ | |
| # Verify MPI installation | |
| # ------------------------------------------------------------ | |
| - name: Verify MPI | |
| run: | | |
| mpirun --version | |
| which mpirun | |
| # ------------------------------------------------------------ | |
| # Unzip phantom files | |
| # ------------------------------------------------------------ | |
| - name: Unzip phantom files | |
| run: | | |
| echo "Unzipping phantom files..." | |
| 7z x examples/phantoms/phantoms_compressed.zip -oexamples/phantoms/ | |
| # ------------------------------------------------------------ | |
| # Run tests with coverage | |
| # ------------------------------------------------------------ | |
| - name: Run tests (serial + parallel) with coverage | |
| run: | | |
| coverage erase | |
| echo "Running serial examples..." | |
| pytest tests/test_examples_run.py | |
| echo "Running parallel examples..." | |
| pytest tests/test_parallel.py | |
| echo "Running import tests..." | |
| pytest tests/test_imports.py | |
| echo "Combining all coverage files..." | |
| coverage combine | |
| coverage report -m --fail-under=50 | |
| coverage html | |
| coverage xml | |
| # ------------------------------------------------------------ | |
| # Upload HTML coverage report as artifact | |
| # ------------------------------------------------------------ | |
| - name: Upload coverage HTML | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-html | |
| path: htmlcov | |
| # ------------------------------------------------------------ | |
| # Upload coverage results to Codecov (for badge) | |
| # ------------------------------------------------------------ | |
| - name: Upload coverage to Codecov | |
| if: always() | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| flags: unittests | |
| name: feelmri | |
| fail_ci_if_error: true |