fix typo #22
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: CI | |
on: [ push ] | |
jobs: | |
hooks: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
architecture: 'x64' | |
- name: Display Python version | |
run: python -c "import sys; print(sys.version)" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install -r requirements-test.txt | |
pip install pre-commit | |
pre-commit install | |
- name: Run on all files | |
run: pre-commit run --all-files --show-diff-on-failure | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
architecture: 'x64' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install -r requirements-test.txt | |
- name: Test with pytest and build coverage reports | |
run: | | |
pytest test --cov=src --cov-report=html:codecov --cov-report=json | |
- name: Upload coverage data | |
uses: actions/upload-artifact@v3 | |
with: | |
name: covdata | |
path: | | |
coverage.json | |
- name: package coverage report | |
run: | | |
zip -r coverage_report.zip codecov | |
- name: Upload coverage report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: covdata-html | |
path: coverage_report.zip | |
coverage-reports: | |
name: coverage | |
needs: test | |
if: ${{ github.ref == 'refs/heads/master' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
name: Checkout | |
- name: Download coverage data | |
uses: actions/download-artifact@v3 | |
with: | |
name: covdata | |
- name: Download coverage report | |
uses: actions/download-artifact@v3 | |
with: | |
name: covdata-html | |
- name: Unpack coverage report and move into sphinx | |
run: | | |
unzip coverage_report.zip | |
mv codecov doc/source/_static/codecov | |
- name: build website for detailed coverage | |
run: | | |
pip install sphinx | |
sphinx-build -M html doc/source doc/build | |
- name: deploy website | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
publish_branch: deployed-pages | |
github_token: ${{ secrets.DEPLOY_TOKEN }} | |
publish_dir: doc/build/html/ | |
force_orphan: true | |
- name: Create json for badge | |
run: | | |
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])") | |
echo "total=$TOTAL" >> $GITHUB_ENV | |
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY | |
- name: Make badge | |
uses: schneegans/[email protected] | |
with: | |
auth: ${{ secrets.GIST_TOKEN }} | |
gistID: 715271f51dd7b16c37fcf84c79dcb31a | |
filename: covbadge.json | |
label: Coverage | |
message: ${{ env.total }}% | |
minColorRange: 50 | |
maxColorRange: 95 | |
valColorRange: ${{ env.total }} |