[pre-commit.ci] pre-commit autoupdate #677
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Tests | |
on: | |
push: | |
branches: [ master, main ] | |
pull_request: | |
release: | |
jobs: | |
tests: | |
strategy: | |
matrix: | |
python-version: ['3.11'] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v5.2.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup libsqlite3 | |
run: | | |
sudo apt-get install libsqlite3-dev | |
- name: Get full python version | |
id: full-python-version | |
run: | | |
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info[:3]))") | |
- name: Install dependencies | |
run: pip install -r requirements-dev.txt | |
- uses: actions/cache@v4.0.2 | |
id: cache | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Test | |
run: | | |
export EDUZEN_ID=1234 TOKEN=blah | |
coverage run -m pytest --record-mode=none | |
python -m coverage combine | |
python -m coverage report -m --skip-covered | |
python -m coverage json | |
- name: "Upload coverage data" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage.json | |
path: coverage.json | |
coverage: | |
name: Coverage | |
needs: tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Check out the repo" | |
uses: actions/checkout@v3 | |
- uses: actions/setup-python@v5.2.0 | |
with: | |
python-version: 3.11 | |
- uses: actions/cache@v4.0.1 | |
id: cache | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: pip install -r requirements-dev.txt | |
- name: "Download coverage data" | |
uses: actions/download-artifact@v4 | |
with: | |
name: coverage.json | |
- name: "Combine" | |
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: Create Awesome Badge | |
uses: schneegans/dynamic-badges-action@v1.7.0 | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: 939569bc7abab34a443758333f60764d | |
filename: covbadge.json | |
label: Coverage | |
color: orange | |
message: ${{ env.total }}% | |
minColorRange: 50 | |
maxColorRange: 90 | |
valColorRange: ${{ env.total }} |