[BREAKING] name_dof -> name_dofs, Simplified States and Controls methods and and more precise State Dynamics #1382
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: Run the tests | |
| on: [pull_request] | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| shard: [1, 2, 3, 4, 5, 6] | |
| name: Tests on ${{ matrix.os }}-shard ${{ matrix.shard }} | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Checkout submodules | |
| if: matrix.shard == 1 | |
| run: git submodule update --init --recursive | |
| - name: Setup environment | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| miniforge-version: latest | |
| activate-environment: bioptim | |
| environment-file: environment.yml | |
| - name: Print conda info | |
| run: | | |
| conda info | |
| conda list | |
| - name: Install extra dependencies | |
| run: | | |
| conda install pip pytest-cov black pytest pytest-cov codecov packaging pytest-mpl -cconda-forge | |
| sudo apt install -y librhash-dev | |
| - name: Install ACADOS on Linux | |
| run: | | |
| pwd | |
| cd external | |
| ./acados_install_linux.sh 4 $CONDA_PREFIX | |
| cd .. | |
| if: matrix.shard == 1 | |
| - name: Test installed version of bioptim | |
| run: | | |
| pip install . | |
| cd | |
| python -c "import bioptim" | |
| if: matrix.shard == 1 | |
| - name: Run tests with code coverage | |
| run: pytest -v --color=yes --cov-report term-missing --cov=bioptim tests/shard${{ matrix.shard }} --mpl-baseline-path=bioptim/tests/plot_reference_images | |
| if: matrix.os == 'ubuntu-latest' | |
| - name: Archive coverage report | |
| id: archive | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-${{ matrix.shard }} | |
| path: .coverage | |
| if-no-files-found: error | |
| include-hidden-files: true | |
| merge-coverage: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Install extra dependencies | |
| run: | | |
| sudo apt install -y python3-pip | |
| pip3 install coverage | |
| - name: Download all workflow run artifacts | |
| id: download | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: coverage-* | |
| - name: Rename coverage files | |
| run: | | |
| for shard in {1,2,3,4,5,6}; do | |
| mv coverage-${shard}/.coverage .coverage${shard} | |
| done | |
| - name: Merge coverage reports | |
| run: coverage combine .coverage1 .coverage2 .coverage3 .coverage4 .coverage5 .coverage6 | |
| - name: Generate XML report | |
| run: | | |
| coverage xml | |
| coverage report -m | |
| - uses: codecov/codecov-action@v5 | |
| with: | |
| files: ./coverage.xml | |
| flags: unittests | |
| fail_ci_if_error: true | |
| verbose: true |