ci: refactor tmt test (#470) #1545
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
FORCE_COLOR: 3 | |
jobs: | |
lint: | |
name: Format | |
runs-on: ubuntu-latest | |
timeout-minutes: 8 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- uses: pre-commit/[email protected] | |
with: | |
extra_args: --hook-stage manual --all-files | |
- name: Run PyLint | |
run: | | |
echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json" | |
pipx run nox -s pylint | |
- name: Run nox generator | |
run: | | |
pipx run nox -s generate_schema -s readme | |
git diff --exit-code | |
checks: | |
name: | |
Check 🐍 ${{ matrix.python-version }} • CMake ${{ matrix.cmake-version }} | |
on ${{ matrix.runs-on }} | |
runs-on: ${{ matrix.runs-on }} | |
timeout-minutes: 40 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.7", "pypy-3.9", "3.12"] | |
runs-on: [ubuntu-latest, macos-latest] | |
cmake-version: ["3.15.x"] | |
include: | |
- python-version: "3.7" | |
runs-on: windows-2022 | |
cmake-version: "3.21.x" | |
- python-version: "pypy-3.8" | |
runs-on: windows-2022 | |
cmake-version: "3.21.x" | |
- python-version: "3.11" | |
runs-on: windows-2022 | |
cmake-version: "3.26.x" | |
- python-version: "pypy-3.7" | |
runs-on: ubuntu-latest | |
cmake-version: "3.15.x" | |
- python-version: "pypy-3.10" | |
runs-on: ubuntu-latest | |
cmake-version: "3.15.x" | |
- python-version: "3.8" | |
runs-on: ubuntu-latest | |
cmake-version: "3.21.x" | |
- python-version: "3.9" | |
runs-on: ubuntu-latest | |
cmake-version: "3.20.x" | |
- python-version: "3.10" | |
runs-on: ubuntu-latest | |
cmake-version: "3.22.x" | |
- python-version: "3.11" | |
runs-on: ubuntu-latest | |
cmake-version: "3.26.x" | |
- python-version: "3.8" | |
runs-on: windows-2019 | |
cmake-version: "3.24.x" | |
- python-version: "3.12" | |
runs-on: windows-latest | |
cmake-version: "3.26.x" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
- name: Install package | |
run: pip install -e.[test,test-meta,test-numpy,test-schema,wheels,cov] | |
- name: Test package | |
run: >- | |
pytest -ra --showlocals --cov --cov-report=xml --cov-report=term | |
--durations=20 | |
- name: Upload coverage report | |
uses: codecov/codecov-action@v3 | |
with: | |
name: | |
${{ runner.os }}-${{ matrix.python-version }}-${{ | |
matrix.cmake-version }} | |
verbose: true | |
token: 6d9cc0e0-158a-41ee-b8f4-0318d3595ac2 | |
min: | |
name: Min 🐍 ${{ matrix.python-version }} on ${{ matrix.runs-on }} | |
runs-on: ${{ matrix.runs-on }} | |
timeout-minutes: 40 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.7", "3.11"] | |
runs-on: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# The min requirements are not compatible with some of the extra test | |
# deps, so limit to just built-in deps. | |
- name: Min requirements | |
run: pip install --constraint tests/constraints.txt .[test] ninja | |
- name: Setup CMake ${{ matrix.cmake-version }} | |
uses: jwlawson/[email protected] | |
- name: Test min package | |
run: pytest -ra --showlocals -Wdefault | |
cygwin: | |
name: Tests on 🐍 3.9 • cygwin | |
runs-on: windows-latest | |
timeout-minutes: 40 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: cygwin/cygwin-install-action@v4 | |
with: | |
platform: x86_64 | |
packages: | |
cmake ninja git make gcc-g++ python39 python39-devel python39-pip | |
- name: Install | |
run: python3.9 -m pip install .[test] | |
- name: Test package | |
run: | |
python3.9 -m pytest -ra --showlocals -m "not virtualenv" | |
--durations=20 | |
msys: | |
name: Tests on 🐍 3 • msys UCRT | |
runs-on: windows-latest | |
timeout-minutes: 30 | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: UCRT64 | |
path-type: minimal | |
update: true | |
install: >- | |
base-devel git | |
pacboy: >- | |
python:p python-pip:p gcc:p cmake:p | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install | |
run: python -m pip install .[test] | |
- name: Test package | |
run: >- | |
python -m pytest -ra --showlocals -m "not broken_on_urct" | |
--durations=20 | |
mingw64: | |
name: Tests on 🐍 3 • mingw64 | |
runs-on: windows-latest | |
timeout-minutes: 30 | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: mingw64 | |
path-type: minimal | |
update: true | |
install: >- | |
base-devel git | |
pacboy: >- | |
python:p python-pip:p gcc:p cmake:p | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install | |
run: python -m pip install .[test] | |
- name: Test package | |
run: >- | |
python -m pytest -ra --showlocals -m "not setuptools" --durations=20 | |
env: | |
SETUPTOOLS_USE_DISTUTILS: "local" | |
dist: | |
name: Distribution build | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: hynek/build-and-inspect-python-package@v1 | |
docs: | |
name: Docs on ${{ matrix.runs-on }} | |
strategy: | |
fail-fast: false | |
matrix: | |
runs-on: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.runs-on }} | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: wntrblm/[email protected] | |
with: | |
python-versions: "3.11" | |
- name: Linkcheck | |
run: nox -s docs -- -b linkcheck | |
- name: Manpage | |
run: nox -s docs -- -b man -W | |
- name: Build docs with warnings as errors | |
run: nox -s docs -- -W | |
- name: Check examples | |
run: nox -s test_doc_examples | |
- name: Verify no changes required to API docs | |
run: | | |
nox -s build_api_docs | |
git diff --exit-code | |
pass: | |
if: always() | |
needs: [lint, checks, min, cygwin, dist, docs] | |
runs-on: ubuntu-latest | |
timeout-minutes: 2 | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} |