updated to add biosimulators #3
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: Build and test | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ '3.7.15', '3.8.12', '3.9.12', '3.10.4', '3.11.0' ] # specific versions for cache | |
steps: | |
- uses: actions/checkout@v2 | |
- name: "Setup Python ${{ matrix.python-version }}" | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Start Xvfb | |
run: | | |
export DISPLAY=:99.0 | |
Xvfb -ac :99 -screen 0 1280x1024x16 > /dev/null 2>&1 & | |
- name: Install dependencies | |
run: | | |
sudo apt -y update | |
sudo apt -y install cmake libjpeg-dev libtiff-dev freeglut3-dev libxi-dev libxmu-dev | |
sudo apt -y install libvtk7-dev vtk7 | |
sudo apt -y install xvfb | |
- name: Configure smoldyn | |
run: | | |
cmake --version | |
PYTHON=$(which python) | |
$PYTHON -c "import sys; print(sys.version)" | |
$PYTHON -m pip install pytest matplotlib numpy wheel flaky | |
mkdir build && cd build | |
cmake -DOPTION_PYTHON=ON \ | |
-DOPTION_EXAMPLES=ON \ | |
-DPython3_EXECUTABLE=$PYTHON .. | |
- name: Build smoldyn | |
run: | | |
cd build && make -j2 && make wheel && sudo make install | |
- name: Test smoldyn | |
run: | | |
cd build && xvfb-run --auto-servernum ctest --output-on-failure -j2 | |
python -m pip install smoldyn*.whl | |
python -c "import smoldyn; print(smoldyn.__file__); print(smoldyn.__version__)" | |
# BioSimulators | |
- name: Build BioSimulators Docker image | |
if: matrix.python-version >= '3.9' | |
run: | | |
cp build/smoldyn*.whl scripts/ | |
cd scripts | |
docker build \ | |
--file Dockerfile-BioSimulators \ | |
--tag ghcr.io/ssandrews/smoldyn/biosimulators_smoldyn:latest \ | |
. | |
- name: Lint BioSimulators | |
if: matrix.python-version >= '3.9' | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install flake8 | |
flake8 source/python/smoldyn/biosimulators/ --ignore E501,W503 | |
- name: Install BioSimulators | |
if: matrix.python-version >= '3.9' | |
run: | | |
cd build | |
WHEEL_PATH=$(ls smoldyn*.whl) | |
python -m pip install --force-reinstall "${WHEEL_PATH}[biosimulators,biosimulators-tests]" | |
- name: Test BioSimulators | |
if: matrix.python-version >= '3.9' | |
run: | | |
python -m pip install pytest flaky | |
xvfb-run --auto-servernum python -m pytest tests/test_biosimulators.py --verbose |