Skip to content

Commit

Permalink
Merge pull request #174 from pytest-dev/update-ci
Browse files Browse the repository at this point in the history
Update CI, collect coverage
  • Loading branch information
youtux committed Nov 5, 2022
2 parents 78844d9 + 8ee0153 commit c0a92cd
Show file tree
Hide file tree
Showing 5 changed files with 254 additions and 253 deletions.
152 changes: 30 additions & 122 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: CI
name: Main testing workflow

on:
push:
pull_request:
Expand All @@ -9,126 +9,34 @@ jobs:
test-run:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11-dev" ]
pytest-version: [ "62", "70", "71", "latest", "main" ]

include:
# Convert python-version to a string that tox understands
- python-version: "3.7"
tox-py-version: "37"
- python-version: "3.8"
tox-py-version: "38"
- python-version: "3.9"
tox-py-version: "39"
- python-version: "3.10"
tox-py-version: "310"
- python-version: "3.11-dev"
tox-py-version: "311"

# Include older pytest versions `5.0 < pytest < 6.2` for python 3.7, 3.8, 3.9
# python 3.7
- python-version: "3.7"
pytest-version: "50"
- python-version: "3.7"
pytest-version: "51"
- python-version: "3.7"
pytest-version: "52"
- python-version: "3.7"
pytest-version: "53"
- python-version: "3.7"
pytest-version: "54"
- python-version: "3.7"
pytest-version: "60"
- python-version: "3.7"
pytest-version: "61"
- python-version: "3.7"
pytest-version: "62"
# python 3.8
- python-version: "3.8"
pytest-version: "50"
- python-version: "3.8"
pytest-version: "51"
- python-version: "3.8"
pytest-version: "52"
- python-version: "3.8"
pytest-version: "53"
- python-version: "3.8"
pytest-version: "54"
- python-version: "3.8"
pytest-version: "60"
- python-version: "3.8"
pytest-version: "61"
- python-version: "3.8"
pytest-version: "62"
# python 3.9
- python-version: "3.9"
pytest-version: "50"
- python-version: "3.9"
pytest-version: "51"
- python-version: "3.9"
pytest-version: "52"
- python-version: "3.9"
pytest-version: "53"
- python-version: "3.9"
pytest-version: "54"
- python-version: "3.9"
pytest-version: "60"
- python-version: "3.9"
pytest-version: "61"
- python-version: "3.9"
pytest-version: "62"

python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install build tools
run: |
python -m pip install --upgrade pip setuptools tox
- name: Test with tox
run: tox -e py${{ matrix.tox-py-version }}-pytest${{ matrix.pytest-version }}

mypy-run:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11-dev" ]
include:
# Convert python-version to a string that tox understands
- python-version: "3.7"
tox-py-version: "37"
ignore-mypy-error: "true"
- python-version: "3.8"
tox-py-version: "38"
ignore-mypy-error: "true"
- python-version: "3.9"
tox-py-version: "39"
ignore-mypy-error: "true"
- python-version: "3.10"
tox-py-version: "310"
ignore-mypy-error: "false"
- python-version: "3.11-dev"
tox-py-version: "311"
ignore-mypy-error: "false"

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install build tools
run: |
python -m pip install --upgrade pip setuptools tox
- name: Mypy
# Ignore mypy errors for known buggy behaviour of mypy with older pythons
continue-on-error: ${{ fromJSON( matrix.ignore-mypy-error ) }}
run: |
tox -e py${{ matrix.tox-py-version }}-mypy
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools
pip install tox tox-gh-actions coverage[toml]
- name: Type checking
# Ignore errors for older pythons
continue-on-error: ${{ contains(fromJSON('["3.7", "3.8", "3.9"]'), matrix.python-version)}}
run: |
tox -e mypy
- name: Test with tox
env:
TOX_PARALLEL_NO_SPINNER: 1
run: |
coverage erase
tox --parallel
coverage combine
coverage xml
- uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
verbose: true # optional (default = false)
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/asottile/pyupgrade
rev: v2.32.1
rev: v3.2.0
hooks:
- id: pyupgrade
args: [--py37-plus]

0 comments on commit c0a92cd

Please sign in to comment.