Skip to content

Commit

Permalink
Update build.yml to handle coverage correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ibro45 committed Nov 30, 2024
1 parent f2b8595 commit 4ba64ee
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,38 @@ on:
pull_request:
branches:
- main


permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
fail-fast: false

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for proper git operations

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2.2.2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
run: make setup

- name: Set up cache
uses: actions/cache@v2.1.6
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}
restore-keys: |
venv-${{ matrix.python-version }}-
- name: Install dependencies
run: |
Expand All @@ -51,3 +60,12 @@ jobs:
poetry install --with tests
make test
- name: Commit and push coverage badge
if: github.ref == 'refs/heads/main' && success()
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git pull --rebase origin main
git add assets/images/coverage.svg
git commit -m "Update coverage badge" || echo "No changes to commit"
git push || git pull --rebase origin main && git push
Loading

0 comments on commit 4ba64ee

Please sign in to comment.