Skip to content

Commit

Permalink
Use coveralls github action
Browse files Browse the repository at this point in the history
Because the command-line coveralls tool pins coverage < 7.0, which
doesn't work well on Python 3.12.

Also update all the GitHub actions to the latest versions and tweak YAML
formatting so all the shell commands are aligned.
  • Loading branch information
mgedmin committed Oct 4, 2023
1 parent 0554c1d commit 7133020
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ jobs:

steps:
- name: Git clone
uses: actions/checkout@v2
uses: actions/checkout@v4

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

- name: Pip cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
Expand All @@ -49,23 +49,24 @@ jobs:
run: |
python -m pip install -U pip
python -m pip install -U setuptools wheel
python -m pip install -U pytest coverage coveralls
python -m pip install -U pytest coverage
python -m pip install -e .
- name: Run tests
run: coverage run -m pytest tests
run: |
coverage run -m pytest tests
- name: Check test coverage
run: coverage report -m --fail-under=${{ (matrix.python-version == 'pypy-3.10') && 99 || 100 }}
run: |
coverage report -m --fail-under=${{ (matrix.python-version == 'pypy-3.10') && 99 || 100 }}
coverage xml
# pypy3.10 thinks utils.py has one uncovered branch (140 -> 133), which
# I think is just pypy's optimizer being too smart for coverage.py.

- name: Report to coveralls
run: coveralls
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
uses: coverallsapp/github-action@v2
with:
file: coverage.xml

lint:
name: ${{ matrix.toxenv }}
Expand All @@ -82,15 +83,15 @@ jobs:

steps:
- name: Git clone
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python ${{ env.default_python || '3.9' }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "${{ env.default_python || '3.9' }}"

- name: Pip cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.toxenv }}-${{ hashFiles('tox.ini') }}
Expand All @@ -105,4 +106,5 @@ jobs:
python -m pip install -U tox
- name: Run ${{ matrix.toxenv }}
run: python -m tox -e ${{ matrix.toxenv }}
run: |
python -m tox -e ${{ matrix.toxenv }}

0 comments on commit 7133020

Please sign in to comment.