diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5c62781..d309c36 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -31,11 +43,10 @@ jobs: include: - python: "3.5" platform: ubuntu-20.04 - - python: "3.12" - platform: ubuntu-latest - with: + skip-coverage: true 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/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 284a547..dd34fd7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,6 +9,10 @@ on: platform: type: string required: true + skip-coverage: + type: boolean + required: false + default: false permissions: contents: read @@ -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 }}