linting and coverage #64
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: | |
branches: | |
- main | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: "3.11" | |
- name: Install poetry | |
run: python -m pip install poetry | |
- name: Install pytest | |
run: pip install pytest pytest-cov | |
- name: Install dependencies | |
run: pip install . | |
- name: Run Tests | |
run: poetry run pytest --cov=elicit tests --cov-report html | |
- name: Run Coverage | |
run: | | |
poetry run coverage run --source=./elicit -m pytest | |
poetry run coverage report | |
poetry run coverage xml | |
genbadge coverage | |
# Share ./docs/reports so that they can be deployed with doc in next job | |
- name: Share reports with other jobs | |
# if: matrix.nox_session == '...': not needed, if empty wont be shared | |
uses: actions/upload-artifact@master | |
with: | |
name: reports_dir | |
path: ./reports | |
# 1) retrieve the reports generated previously | |
- name: Retrieve reports | |
uses: actions/download-artifact@master | |
with: | |
name: reports_dir | |
path: ./reports | |
# 6) Publish coverage report | |
- name: \[not on TAG\] Create codecov.yaml with correct paths | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads') | |
shell: bash | |
run: | | |
cat << EOF > codecov.yml | |
# codecov.yml | |
fixes: | |
- "/home/runner/work/florence-bockting/prior-elicitation/::" # Correct paths | |
EOF | |
- name: \[not on TAG\] Publish coverage report | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads') | |
uses: codecov/codecov-action@v1 | |
with: | |
files: ./reports/coverage/coverage.xml | |
token: ${{ secrets.CODECOV_TOKEN }} |