Add test for different control steps #11
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: Tests | |
on: [push] | |
jobs: | |
test-code: | |
runs-on: ubuntu-22.04 | |
container: ghcr.io/scientificcomputing/fenics-gmsh:2023-08-16 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache | |
id: cache-primes | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/instant | |
~/.cache/dijitso | |
~/.cache/pip | |
key: cache_v1 | |
restore-keys: | | |
cache_v1 | |
- name: Install package | |
run: python3 -m pip install .[test] | |
- name: Run tests | |
run: python3 -m pytest -v | |
- name: Extract Coverage | |
run: | | |
python3 -m coverage report | sed 's/^/ /' >> $GITHUB_STEP_SUMMARY | |
python3 -m coverage json | |
export TOTAL=$(python3 -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])") | |
echo "total=$TOTAL" >> $GITHUB_ENV | |
- name: Upload HTML report. | |
uses: actions/upload-artifact@v3 | |
with: | |
name: html-report | |
path: htmlcov | |
- name: Create coverage Badge | |
if: github.ref == 'refs/heads/main' | |
uses: schneegans/dynamic-badges-action@v1.7.0 | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: a7290de789564f03eb6b1ee122fce423 | |
filename: pulse2-coverage.json | |
label: Coverage | |
message: ${{ env.total }}% | |
minColorRange: 50 | |
maxColorRange: 90 | |
valColorRange: ${{ env.total }} |