Skip to content

Commit

Permalink
github actions: Make coverage check conditional
Browse files Browse the repository at this point in the history
It does not work on Python 3.5, so we only run coverage checks on newer
Python builds.
  • Loading branch information
sjlongland committed May 4, 2024
1 parent 681789c commit d35aaa9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
name: Pre-merge and post-merge tests

on:
push:
pull_request:
workflow_dispatch:
inputs:
skip-coverage:
# lcov won't work in Python 3.5.
description: "Whether to skip coverage checks?"
type: boolean
required: false
default: false

permissions:
contents: read

Expand Down Expand Up @@ -31,11 +43,11 @@ jobs:
include:
- python: "3.5"
platform: ubuntu-20.04
- python: "3.12"
platform: ubuntu-latest
skip-coverage: true
with:
python-version: ${{ matrix.python }}
platform: ${{ matrix.platform }}
skip-coverage: ${{ matrix.skip-coverage || false }}

check: # This job does nothing and is only used for the branch protection
# https://wildwolf.name/github-actions-how-to-avoid-running-the-same-workflow-multiple-times/
Expand Down
18 changes: 16 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
platform:
type: string
required: true
skip-coverage:
type: boolean
required: false
default: false

permissions:
contents: read
Expand Down Expand Up @@ -44,19 +48,29 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest coverage coverage-lcov toml pint
pip install flake8 pytest coverage toml pint
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install coverage-lcov
if: "! inputs.skip-coverage"
run: |
pip install coverage-lcov
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings.
flake8 . --count --exit-zero --max-complexity=10 --statistics
- name: Test with py.test
- name: Test with py.test (with coverage)
if: "! inputs.skip-coverage"
run: |
coverage run -m pytest
coverage-lcov
- name: Test with py.test (without lcov coverage)
if: "inputs.skip-coverage"
run: |
python -m pytest --cov=aioax25 --cov-report=term-missing
- name: Coveralls
if: "! inputs.skip-coverage"
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit d35aaa9

Please sign in to comment.