Skip to content

Python 3 14 compat (#76) #368

Python 3 14 compat (#76)

Python 3 14 compat (#76) #368

Workflow file for this run

name: Unit Tests
on:
push:
repository_dispatch:
workflow_dispatch:
inputs:
ref:
description: 'GitHub ref: Branch, Tag or Commit SHA'
required: false
default: ''
env:
ref: ${{ github.event.inputs.ref || github.ref }}
concurrency:
group: ${{ github.ref }}-workflow-unit-tests
cancel-in-progress: true
jobs:
list-test-files:
runs-on: ubuntu-24.04
outputs:
test-files: ${{ steps.files.outputs.test-files }}
steps:
- name: Checkout Codes
uses: actions/checkout@v6
with:
submodules: recursive
ref: ${{ env.ref }}
- name: List files
id: files
run: |
script="
import json
import os
import re
IGNORED_TEST_FILES = '${IGNORED_TEST_FILES}'
all_tests = [f.removesuffix('.py') for f in os.listdir('tests/') if f.startswith('test_') and f.endswith('.py') and f.strip().removesuffix('py') not in f'{IGNORED_TEST_FILES}']
print(f'{json.dumps(all_tests)}')
"
test_files=$(python3 -c "$script")
IFS='|' read -r test_files <<< "$test_files"
echo "test-files=$test_files" >> "$GITHUB_OUTPUT"
echo "Test files: $test_files"
test:
needs:
- list-test-files
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest, windows-2025-vs2026 ]
test_script: ${{ fromJSON(needs.list-test-files.outputs.test-files) }}
steps:
- name: Checkout Codes
uses: actions/checkout@v6
with:
submodules: recursive
ref: ${{ env.ref }}
- uses: actions/setup-python@v6
with:
python-version: 3.14
cache: 'pip'
- name: install
run: |
pip install pip pytest tabulate regex setuptools build wheel -U
pip install -v .
- name: test ${{ matrix.test_script }}
run: |
mkdir -p artifacts
pytest --durations=0 tests/${{ matrix.test_script }}.py --junitxml=artifacts/${{ runner.os }}-${{ matrix.test_script }}.xml
freebsd:
needs:
- list-test-files
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test_script: ${{ fromJSON(needs.list-test-files.outputs.test-files) }}
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
ref: ${{ env.ref }}
- name: clean dir
run: rm -rf .git
- name: Test in FreeBSD
uses: vmactions/freebsd-vm@v1
with:
copyback: false
prepare: |
env ASSUME_ALWAYS_YES=yes pkg install -y python py311-pip pcre2 gcc gmake pkgconf
run: |
python -V
python -m venv venv
. venv/bin/activate
pip install pip pytest tabulate regex setuptools build wheel -U
pip install -v .
pytest --durations=0 tests/${{ matrix.test_script }}.py
# unable to fix, disabled
# solaris:
# needs:
# - list-test-files
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# test_script: ${{ fromJSON(needs.list-test-files.outputs.test-files) }}
# steps:
# - uses: actions/checkout@v6
# with:
# submodules: recursive
# ref: ${{ env.ref }}
#
# - name: clean dir
# run: rm -rf .git
#
# - name: Test in Solaris
# uses: vmactions/solaris-vm@v1
# with:
# prepare: |
# pkg install developer/gcc developer/build/gnu-make developer/build/pkg-config developer/versioning/git web/curl
# copyback: false
# run: |
# curl -V
#
# echo "=============="
#
# export LDFLAGS="-L/usr/lib/amd64 -L/usr/lib/64"
# export CFLAGS="-m64"
# export LD_LIBRARY_PATH="/usr/lib/amd64:${LD_LIBRARY_PATH:-}"
#
# python -V
# python -m venv venv
# source venv/bin/activate
# pip install pip pytest tabulate regex setuptools build wheel -U
# pip install -v .
# pytest --durations=0 tests/${{ matrix.test_script }}.py
wsl:
needs:
- list-test-files
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
test_script: ${{ fromJSON(needs.list-test-files.outputs.test-files) }}
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
ref: ${{ env.ref }}
- uses: Vampire/setup-wsl@v6
with:
distribution: Ubuntu-24.04
additional-packages:
python3-pip
python3-venv
build-essential
pkg-config
- name: test os
shell: wsl-bash -u root {0}
run: |
python3 -m venv venv
source venv/bin/activate
pip install pip pytest tabulate regex setuptools build wheel -U
pip install -v .
pytest --durations=0 tests/${{ matrix.test_script }}.py