Merge pull request #25 from Smithsonian/dev #17
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 unit tests | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.11"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
- name: Test with tox | |
run: | | |
pip install tox coverage | |
tox -e py | |
- name: Upload coverage data | |
uses: actions/upload-artifact@v3 | |
with: | |
name: covdata | |
path: .coverage.* | |
- name: Download coverage data | |
uses: actions/download-artifact@v3 | |
with: | |
name: covdata | |
- name: Combine | |
run: | | |
python -m coverage combine | |
# Report and write to summary. | |
python -m coverage report | |
python -m coverage report | sed 's/^/ /' >> $GITHUB_STEP_SUMMARY | |
python -m coverage json | |
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: de229c48256d967a1cb8b29dbf575602 | |
filename: covbadge.json | |
label: code coverage | |
message: ${{ env.total }}% | |
minColorRange: 50 | |
maxColorRange: 90 | |
valColorRange: ${{ env.total }} |