update yml #2
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: Unit Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: unit-tests-${{ github.ref }} | |
cancel-in-progress: false | |
jobs: | |
unit-tests: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11"] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Add Swap Space (for memory issues) | |
run: | | |
sudo fallocate -l 4G /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
- name: Cache pip dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential cmake libopenmpi-dev libgl1-mesa-dev swig | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest numpy matplotlib | |
# PyMFEM | |
- name: Cache PyMFEM Wheel | |
id: cache-pymfem | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/mfem/dist | |
key: pymfem-wheel | |
- name: Build PyMFEM Wheel | |
if: steps.cache-pymfem.outputs.cache-hit != 'true' | |
run: | | |
git clone --branch stable https://github.com/melekderman/PyMFEM.git /tmp/mfem | |
cd /tmp/mfem | |
pip wheel . -w dist | |
- name: Install PyMFEM from Wheel | |
run: pip install /tmp/mfem/dist/*.whl | |
# PyGLVis | |
- name: Cache PyGLVis Wheel | |
id: cache-pyglvis | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/pyglvis/dist | |
key: pyglvis-wheel | |
- name: Build PyGLVis Wheel (if not cached) | |
if: steps.cache-pyglvis.outputs.cache-hit != 'true' | |
run: | | |
git clone --branch stable https://github.com/melekderman/pyglvis.git /tmp/pyglvis | |
cd /tmp/pyglvis | |
pip wheel . -w dist | |
- name: Install PyGLVis from Wheel | |
run: pip install /tmp/pyglvis/dist/*.whl | |
- name: Run Unit Tests | |
run: pytest tests/unit/ |