[WIP] CI: Added tests on OpenBSD & NetBSD #996
Workflow file for this run
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: Test | |
on: | |
workflow_dispatch: | |
inputs: | |
verbose: | |
description: 'Increase level of test verbosity' | |
required: false | |
default: false | |
type: boolean | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- converted_to_draft | |
- ready_for_review | |
branches: | |
- main | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- '!**.pyi' | |
- 'tox.ini' | |
- 'pyproject.toml' | |
- 'pdm.lock' | |
- '.github/codecov.yml' | |
- '.github/actions/setup-tox/**' | |
- '.github/workflows/test.yml' | |
push: | |
branches: | |
- main | |
tags-ignore: | |
- '*' | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- '!**.pyi' | |
- 'tox.ini' | |
- 'pyproject.toml' | |
- 'pdm.lock' | |
- '.github/codecov.yml' | |
- '.github/actions/setup-tox/**' | |
- '.github/workflows/test.yml' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
env: | |
PYTEST_VERBOSE_FLAG: ${{ inputs.verbose && '-v' || '' }} | |
jobs: | |
tests: | |
if: | | |
(github.event_name != 'push' || !startsWith(github.event.head_commit.message, 'Bump version:')) | |
&& (github.event_name != 'pull_request' || (github.event.pull_request.draft != true && !contains(github.event.pull_request.labels.*.name, 'pr-skip-test'))) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-24.04, windows-2022, macos-14] | |
python_version: ['3.11', '3.12', '3.13'] | |
include: | |
- python_version: '3.11' | |
tox_py: py311 | |
- python_version: '3.12' | |
tox_py: py312 | |
- python_version: '3.13' | |
tox_py: py313 | |
name: test (${{ matrix.os }}, ${{ matrix.python_version }}) | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup tox (python ${{ matrix.python_version }}) | |
uses: ./.github/actions/setup-tox | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Launch tests | |
timeout-minutes: 20 | |
run: tox run -f ${{ matrix.tox_py }} -- ${{ env.PYTEST_VERBOSE_FLAG }} | |
- name: Generate coverage report | |
if: hashFiles('.coverage.*') != '' # Rudimentary `file.exists()` | |
continue-on-error: true | |
run: tox run -f coverage | |
- name: Upload (unit tests) coverage to codecov | |
if: hashFiles('coverage.unit.xml') != '' # Rudimentary `file.exists()` | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
disable_search: true | |
files: >- | |
coverage.unit.xml | |
flags: >- | |
test-unit | |
- name: Upload (functional tests) coverage to codecov | |
if: hashFiles('coverage.functional.xml') != '' # Rudimentary `file.exists()` | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
disable_search: true | |
files: >- | |
coverage.functional.xml | |
flags: >- | |
test-functional, | |
OS-${{ runner.os }}, | |
Py-${{ matrix.python_version }} | |
test-bsd: | |
# TODO: Add this when the workflow is stable. | |
# if: | | |
# (github.event_name != 'push' || !startsWith(github.event.head_commit.message, 'Bump version:')) | |
# && (github.event_name != 'pull_request' || (github.event.pull_request.draft != true && !contains(github.event.pull_request.labels.*.name, 'pr-skip-test'))) | |
runs-on: ubuntu-24.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
# TODO: Add test with other python version | |
# FreeBSD issue: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=271673 | |
bsd: [freebsd, openbsd, netbsd] | |
python_version: ['3.11'] | |
include: | |
###### Specify releases and OS display name for each VM ###### | |
- bsd: freebsd | |
vm: ./.github/actions/freebsd-vm | |
os: FreeBSD | |
release: '14.1' | |
- bsd: openbsd | |
vm: ./.github/actions/openbsd-vm | |
os: OpenBSD | |
release: '7.6' | |
- bsd: netbsd | |
vm: ./.github/actions/netbsd-vm | |
os: NetBSD | |
release: '10.0' | |
###### Python version ###### | |
- python_version: '3.11' | |
tox_py: py311 | |
name: test (${{ matrix.bsd }}-${{ matrix.release }}, ${{ matrix.python_version }}) | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Launch tests | |
# Add 5 minutes to let the VM boot and install dependencies | |
timeout-minutes: 25 | |
uses: ${{ matrix.vm }} | |
with: | |
release: ${{ matrix.release }} | |
python-version: ${{ matrix.python_version }} | |
run: | | |
tox --workdir /tmp/.tox run -f ${{ matrix.tox_py }} -- ${{ env.PYTEST_VERBOSE_FLAG }} | |
tox --workdir /tmp/.tox run -f coverage | |
- name: Check files in workspace | |
if: always() | |
run: ls -lA | |
# - name: Upload (unit tests) coverage to codecov | |
# if: hashFiles('coverage.unit.xml') != '' # Rudimentary `file.exists()` | |
# uses: codecov/codecov-action@v4 | |
# with: | |
# token: ${{ secrets.CODECOV_TOKEN }} | |
# disable_search: true | |
# files: >- | |
# coverage.unit.xml | |
# flags: >- | |
# test-unit | |
# - name: Upload (functional tests) coverage to codecov | |
# if: hashFiles('coverage.functional.xml') != '' # Rudimentary `file.exists()` | |
# uses: codecov/codecov-action@v4 | |
# with: | |
# token: ${{ secrets.CODECOV_TOKEN }} | |
# disable_search: true | |
# files: >- | |
# coverage.functional.xml | |
# flags: >- | |
# test-functional, | |
# OS-${{ matrix.os }}, | |
# Py-${{ matrix.python_version }} |