Skip to content

Drop Python 3.9

Drop Python 3.9 #456

Workflow file for this run

name: Build and test
on:
push:
branches:
- main
paths-ignore:
- '**.md'
- .github/workflows/clean-up-caches.yml
- .github/workflows/deploy.yml
- .github/workflows/keep-caches-warm.yml
- .github/workflows/release.yml
- .gitattributes
- .gitignore
- .vscode/**
- LICENSE
- renovate.json
pull_request:
workflow_dispatch:
concurrency:
group: build-and-test-${{ github.ref }}
cancel-in-progress: true
jobs:
build_with_cmake:
name: CMake
strategy:
matrix:
os:
- ubuntu-latest
compiler:
- {cc: gcc, cxx: g++}
- {cc: clang, cxx: clang++}
include:
- os: macos-latest
compiler: {cc: clang, cxx: clang++}
- os: windows-latest
compiler: {cc: cl, cxx: cl}
- os: windows-11-arm
compiler: {cc: cl, cxx: cl}
runs-on: ${{ matrix.os }}
env:
BUILD_TYPE: Debug
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
submodules: true
# Temporary: drop this and re-enable renovate once rexlib tags releases.
- name: Move the submodule to rexlib's main
run: git submodule update --remote external/rexlib
# Ninja does not locate MSVC on its own the way the Visual Studio
# generator does; without this the configure step finds no cl.exe.
- name: Set up MSVC environment
if: runner.os == 'Windows'
uses: gigabit-clowns/.github/.github/composites/setup-msvc@main
# Most of the wall clock here is rexlib itself, which is built once
# and then found by the project. Caching makes every run after the
# first a link.
- name: Set up compiler cache
uses: gigabit-clowns/.github/.github/composites/restore-ccache@main
with:
key: ${{ matrix.os }}-${{ matrix.compiler.cxx }}
max-size: 1G
- name: Restore the fetched sources
id: fetched
uses: gigabit-clowns/.github/.github/composites/restore-fetched@main
with:
key: ${{ hashFiles('CMakeLists.txt', 'external/rexlib/CMakeLists.txt', 'external/rexlib/cmake/modules/fetch_*.cmake') }}
- name: Install rexlib
env:
CMAKE_GENERATOR: Ninja
run: |
cmake -S external/rexlib -B "${{ runner.temp }}/rexlib-build" \
-DFETCHCONTENT_BASE_DIR="${{ steps.fetched.outputs.dir }}" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${{ runner.temp }}/rexlib" \
-DBUILD_TESTING=OFF \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build "${{ runner.temp }}/rexlib-build" \
--config Release --parallel 4
# Everything except the namelink, which a wheel cannot hold.
cmake --install "${{ runner.temp }}/rexlib-build" \
--config Release --component rexlib_runtime
cmake --install "${{ runner.temp }}/rexlib-build" \
--config Release --component rexlib_development
- name: Configure and build with CMake
uses: threeal/cmake-action@725d1314ccf9ea922805d7e3f9d9bcbca892b406 # v2
with:
source-dir: ${{ github.workspace }}
build-dir: "${{ github.workspace }}/build"
c-compiler: ${{ matrix.compiler.cc }}
cxx-compiler: ${{ matrix.compiler.cxx }}
generator: "Ninja"
options: |
CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
CMAKE_EXPORT_COMPILE_COMMANDS=ON
rexlib_ROOT=${{ runner.temp }}/rexlib
FETCHCONTENT_BASE_DIR=${{ steps.fetched.outputs.dir }}
CMAKE_C_COMPILER_LAUNCHER=ccache
CMAKE_CXX_COMPILER_LAUNCHER=ccache
run-build: true
build-args: --config ${{ env.BUILD_TYPE }}
- name: Save the fetched sources
if: github.ref == 'refs/heads/main'
uses: gigabit-clowns/.github/.github/composites/save-fetched@main
- name: Save the compiler cache
if: github.ref == 'refs/heads/main'
uses: gigabit-clowns/.github/.github/composites/save-ccache@main
with:
key: ${{ matrix.os }}-${{ matrix.compiler.cxx }}
- name: Upload build files for sonar
if: matrix.os == 'ubuntu-latest' && matrix.compiler.cc == 'gcc'
uses: gigabit-clowns/.github/.github/composites/upload-sonar-build-files@main
with:
build-artifact-name: sonar-build-files
build_with_pip:
name: pip
strategy:
matrix:
os:
- ubuntu-latest
- ubuntu-22.04
- macos-latest
- windows-latest
- windows-11-arm
python-version:
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- '3.14'
# CPython ships no Windows ARM64 build before 3.11.
exclude:
- os: windows-11-arm
python-version: '3.10'
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -el {0}
env:
CCACHE_BASEDIR: ${{ startsWith(matrix.os, 'windows') && github.workspace || '/' }}
CCACHE_NOHASHDIR: 1
CCACHE_SLOPPINESS: time_macros,include_file_mtime,include_file_ctime,locale
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
submodules: true
# Temporary: drop this and re-enable renovate once rexlib tags releases.
- name: Move the submodule to rexlib's main
run: git submodule update --remote external/rexlib
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: ${{ matrix.python-version }}
- name: Set up MSVC environment
if: runner.os == 'Windows'
uses: gigabit-clowns/.github/.github/composites/setup-msvc@main
# One key per platform, not per interpreter: rexlib names no Python, so
# its objects are the same for all of them and only the binding differs.
- name: Set up compiler cache
uses: gigabit-clowns/.github/.github/composites/restore-ccache@main
with:
key: pip-${{ matrix.os }}
max-size: 1G
- name: Restore the fetched sources
id: fetched
uses: gigabit-clowns/.github/.github/composites/restore-fetched@main
with:
key: ${{ hashFiles('CMakeLists.txt', 'external/rexlib/CMakeLists.txt', 'external/rexlib/cmake/modules/fetch_*.cmake') }}
- name: Install rexlib
env:
CMAKE_GENERATOR: Ninja
run: |
cmake -S external/rexlib -B "${{ runner.temp }}/rexlib-build" \
-DFETCHCONTENT_BASE_DIR="${{ steps.fetched.outputs.dir }}" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${{ runner.temp }}/rexlib" \
-DBUILD_TESTING=OFF \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build "${{ runner.temp }}/rexlib-build" \
--config Release --parallel 4
# Everything except the namelink, which a wheel cannot hold.
cmake --install "${{ runner.temp }}/rexlib-build" \
--config Release --component rexlib_runtime
cmake --install "${{ runner.temp }}/rexlib-build" \
--config Release --component rexlib_development
- name: Install with pip
env:
rexlib_ROOT: ${{ runner.temp }}/rexlib
CMAKE_GENERATOR: Ninja
run: |
pip install .[test] -v \
-Ccmake.define.FETCHCONTENT_BASE_DIR=${{ steps.fetched.outputs.dir }} \
-Ccmake.define.CMAKE_C_COMPILER_LAUNCHER=ccache \
-Ccmake.define.CMAKE_CXX_COMPILER_LAUNCHER=ccache \
-Ccmake.define.REXLIB_PYTHON_BUILD_TESTING=ON \
-Ccmake.define.REXLIB_PYTHON_STAGE_PREFIX="${{ runner.temp }}/rexlib"
- name: Run ruff
run: ruff check .
- name: Run tests
run: |
chmod +x ./scripts/run-tests.sh
./scripts/run-tests.sh ${{ matrix.os == 'ubuntu-latest'
&& matrix.python-version == '3.14' && '--coverage' || '' }}
- name: Save the fetched sources
if: github.ref == 'refs/heads/main' && matrix.python-version == '3.14'
uses: gigabit-clowns/.github/.github/composites/save-fetched@main
- name: Save the compiler cache
if: github.ref == 'refs/heads/main' && matrix.python-version == '3.14'
uses: gigabit-clowns/.github/.github/composites/save-ccache@main
with:
key: pip-${{ matrix.os }}
- name: Upload coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.14'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: python-coverage
path: coverage.xml
sonar_scan:
name: SonarQube scan
needs: [build_with_cmake, build_with_pip]
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: SonarQube Scan
uses: gigabit-clowns/.github/.github/composites/sonar-scan@main
with:
sonar-token: ${{ secrets.SONAR_TOKEN }}
build-artifact-name: "sonar-build-files"
coverage-artifact-name: "python-coverage"