coverage badge #80
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: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.12.1' | |
architecture: 'x64' | |
- name: Update pip, wheel, and setuptools | |
run: pip install -U pip wheel setuptools | |
- name: Setup the virtual environment | |
run: | | |
python -m venv .venv | |
source .venv/bin/activate | |
- name: Install dependencies | |
run: pip install -e .[dev] | |
- name: Run flake8 | |
run: flake8 src tests | |
- name: Run tests | |
run: | | |
dbversion=$(createdb --version) | |
pgversion=$(python -c "import re; print(re.compile(r'createdb \(\S+\ ([^\.]+)').match('${dbversion}').groups()[0])") | |
export PATH=/usr/lib/postgresql/$pgversion/bin:$PATH | |
which pg_ctl | |
which createdb | |
which pg_config | |
coverage run -m pytest | |
coverage report -m | |
- name: Update Coverage Badge | |
# GitHub actions: default branch variable | |
# https://stackoverflow.com/questions/64781462/github-actions-default-branch-variable | |
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) | |
uses: tj-actions/coverage-badge-py@v2 |