set prefix #1
Workflow file for this run
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: Run the tests | ||
on: [pull_request] | ||
env: | ||
PREFIX_LINUX: /usr/share/miniconda3/envs/bioptim | ||
PREFIX_MACOS: /Users/runner/miniconda3/envs/bioptim | ||
PREFIX_WINDOWS: C:\Miniconda3\envs\bioptim | ||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
- os: []ubuntu-latest, macos-latest, windows-latest] | ||
- shard:[1, 2, 3, 4] | ||
name: Tests on ${{ matrix.os }}-shard ${{ matrix.shard }} | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Set prefix | ||
run: | | ||
if [[ "${{ runner.os }}" == "Linux" ]]; then | ||
echo "PREFIX=${{ env.PREFIX_LINUX }}" >> $GITHUB_ENV | ||
elif [[ "${{ runner.os }}" == "macOS" ]]; then | ||
echo "PREFIX=${{ env.PREFIX_MACOS }}" >> $GITHUB_ENV | ||
elif [[ "${{ runner.os }}" == "Windows" ]]; then | ||
echo "PREFIX=${{ env.PREFIX_WINDOWS }}" >> $GITHUB_ENV | ||
fi | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Setup environment | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
miniforge-variant: Mambaforge | ||
miniforge-version: latest | ||
use-mamba: true | ||
activate-environment: bioptim | ||
environment-file: environment.yml | ||
- name: Print mamba info | ||
run: | | ||
mamba config --show | ||
mamba info | ||
mamba list | ||
- name: Install extra dependencies | ||
run: mamba install pytest-cov black pytest pytest-cov codecov packaging -cconda-forge | ||
- name: Install ACADOS on Linux | ||
run: | | ||
cd external | ||
./acados_install_linux.sh | ||
cd .. | ||
if: matrix.os == 'ubuntu-latest' | ||
- name: Install ACADOS on Mac | ||
run: | | ||
cd external | ||
./acados_install_mac.sh | ||
cd .. | ||
if: matrix.os == 'macos-latest' | ||
- name: Run tests | ||
run: pytest -v --color=yes --cov-report term-missing --cov=bioptim tests/shard${{ matrix.shard }} | ||
- name: Test installed version of bioptim | ||
run: | | ||
python setup.py install | ||
cd | ||
python -c "import bioptim" | ||
#if: matrix.shard == 1 | ||
- name: Generate coverage report | ||
run: coverage report -m | ||
- name: Archive coverage report | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: coverage${{ matrix.shard }} | ||
path: .coverage.* | ||
merge-coverage: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download all workflow run artifacts | ||
uses: actions/download-artifact@v2 | ||
- name: Install extra dependencies | ||
run: | | ||
sudo apt-get install -y python3-pip | ||
pip3 install coverage | ||
- name: Merge coverage reports | ||
run: coverage combine | ||
- name: Generate XML report | ||
run: coverage xml | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v2 | ||
with: | ||
file: ./coverage.xml | ||
flags: unittests | ||
fail_ci_if_error: true |