From bd9f3af018b52052a40b6984739eef4c22ec4de3 Mon Sep 17 00:00:00 2001 From: Joachim Metz Date: Fri, 30 Oct 2026 12:04:47 +0100 Subject: [PATCH] Changes for CI tests --- .github/workflows/build.yml | 46 +++++++++++++++++------- .github/workflows/build_package.yml | 17 ++++++--- .github/workflows/build_wheel.yml | 55 ++++++++++++++++++++--------- .github/workflows/lint.yml | 25 +++++++++---- tox.ini | 2 +- 5 files changed, 104 insertions(+), 41 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1c0f60a..5463ebd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,29 +1,39 @@ +# Build from source. name: build +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true on: pull_request: push: -permissions: read-all +permissions: + contents: read jobs: build_macos: runs-on: macos-latest + timeout-minutes: 15 strategy: matrix: include: - - python-version: '3.14' - toxenv: 'py314' - - python-version: '3.14t' - toxenv: 'py314t' + - python-version: '3.15' + toxenv: 'py315' + - python-version: '3.15t' + toxenv: 'py315t' steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: ${{ matrix.python-version }} + cache: 'pip' - name: Install build dependencies run: | brew update -q brew install -q autoconf automake gettext gnu-sed libtool pkgconfig tox || true # There currently is no brew formula for free-threaded Python, but setup-python will install it if necessary. + # shellcheck disable=SC2193 if [[ "${{ matrix.python-version }}" != *t ]]; then brew install -q python@${{ matrix.python-version }} fi @@ -35,6 +45,7 @@ jobs: tox -e ${{ matrix.toxenv }} build_ubuntu: runs-on: ubuntu-latest + timeout-minutes: 15 strategy: fail-fast: false matrix: @@ -51,12 +62,19 @@ jobs: toxenv: 'py314' - python-version: '3.14t' toxenv: 'py314t' + - python-version: '3.15' + toxenv: 'py315' + - python-version: '3.15t' + toxenv: 'py315t' steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: ${{ matrix.python-version }} + cache: 'pip' - name: Install build dependencies run: | sudo apt-get update @@ -70,15 +88,19 @@ jobs: tox -e ${{ matrix.toxenv }} build_windows: runs-on: windows-latest + timeout-minutes: 15 strategy: matrix: - python-version: ['3.14', '3.14t'] + python-version: ['3.15', '3.15t'] steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: ${{ matrix.python-version }} + cache: 'pip' - name: Install build dependencies run: | python3 -m pip install build setuptools wheel diff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.yml index 0baf923..4a9b14e 100644 --- a/.github/workflows/build_package.yml +++ b/.github/workflows/build_package.yml @@ -1,12 +1,17 @@ # Build packages from source. name: build_package +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true on: pull_request: push: -permissions: read-all +permissions: + contents: read jobs: build_dpkg: runs-on: ubuntu-latest + timeout-minutes: 15 strategy: matrix: version: ['26.04'] @@ -25,7 +30,9 @@ jobs: run: | apt update -q apt install -y autoconf automake autopoint autotools-dev build-essential debhelper dh-autoreconf dh-python fakeroot git libtool pkg-config python3 python3-build python3-dev python3-setuptools python3-venv pybuild-plugin-pyproject - - uses: actions/checkout@v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Build from source run: | git config --global --add safe.directory '*' @@ -33,9 +40,9 @@ jobs: python3 -m build --sdist - name: Build dpkg run: | - PACKAGE=`ls -1 dist/*.tar.gz | head -n1` - PACKAGE=`basename "${PACKAGE}"` - PACKAGE_ORIG=`echo "${PACKAGE%.tar.gz}.orig.tar.gz" | tr '-' '_'` + PACKAGE=$(find dist -maxdepth 1 -name "*.tar.gz" | head -n 1) + PACKAGE=$(basename "${PACKAGE}") + PACKAGE_ORIG=$(echo "${PACKAGE%.tar.gz}.orig.tar.gz" | tr '-' '_') mv "dist/${PACKAGE}" "../${PACKAGE_ORIG}" cp -rf dpkg debian dpkg-buildpackage -rfakeroot diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index 4ef42db..75a49c0 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -1,4 +1,7 @@ # Build Python wheels from source using cibuildwheel. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true name: build_wheels on: pull_request: @@ -7,13 +10,17 @@ on: types: [published] # Allow trigger via API workflow_dispatch: -permissions: read-all +permissions: + contents: read jobs: build_sdist: name: Build sdist runs-on: ubuntu-latest + timeout-minutes: 60 steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Install build dependencies run: | sudo apt-get update @@ -22,20 +29,24 @@ jobs: run: | python utils/update_source.py python -m build --sdist - - uses: actions/upload-artifact@v7 + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: cibw-sdist path: dist/*.tar.gz + retention-days: 14 build_wheels_linux: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} + timeout-minutes: 60 strategy: matrix: include: - os: ubuntu-24.04 - os: ubuntu-24.04-arm steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Install build dependencies run: | sudo apt-get -y install autoconf automake autopoint autotools-dev build-essential git libtool pkg-config @@ -43,29 +54,33 @@ jobs: run: | python utils/update_source.py - name: Build Python wheels - uses: pypa/cibuildwheel@v4.0.0 + uses: pypa/cibuildwheel@f9b966cfadf4109556cadc5bb39ddb72d0ce664e # v4.3.5 env: CIBW_BEFORE_BUILD_LINUX: python utils/update_source.py - CIBW_ENABLE: ${{ github.event_name == 'release' && github.event.action == 'published' && '' || 'cpython-prerelease' }} + CIBW_ENABLE: ${{ !(github.event_name == 'release' && github.event.action == 'published') && 'cpython-prerelease' || '' }} CIBW_TEST_COMMAND: python run_tests.py CIBW_TEST_SOURCES: run_tests.py test_data tests with: package-dir: . output-dir: dist - - uses: actions/upload-artifact@v7 + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: dist/*.whl + retention-days: 14 build_wheels_macos: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} + timeout-minutes: 60 strategy: matrix: include: - os: macos-26 - os: macos-26-intel steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Install build dependencies run: | brew update -q @@ -75,55 +90,61 @@ jobs: run: | python utils/update_source.py - name: Build Python wheels - uses: pypa/cibuildwheel@v4.0.0 + uses: pypa/cibuildwheel@f9b966cfadf4109556cadc5bb39ddb72d0ce664e # v4.3.5 env: - CIBW_ENABLE: ${{ github.event_name == 'release' && github.event.action == 'published' && '' || 'cpython-prerelease' }} + CIBW_ENABLE: ${{ !(github.event_name == 'release' && github.event.action == 'published') && 'cpython-prerelease' || '' }} CIBW_TEST_COMMAND: python run_tests.py CIBW_TEST_SOURCES: run_tests.py test_data tests with: package-dir: . output-dir: dist - - uses: actions/upload-artifact@v7 + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: dist/*.whl + retention-days: 14 build_wheels_windows: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} + timeout-minutes: 60 strategy: matrix: include: - os: windows-11-arm - os: windows-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Prepare build run: | python utils/update_source.py - name: Build Python wheels - uses: pypa/cibuildwheel@v4.0.0 + uses: pypa/cibuildwheel@f9b966cfadf4109556cadc5bb39ddb72d0ce664e # v4.3.5 env: - CIBW_ENABLE: ${{ github.event_name == 'release' && github.event.action == 'published' && '' || 'cpython-prerelease' }} + CIBW_ENABLE: ${{ !(github.event_name == 'release' && github.event.action == 'published') && 'cpython-prerelease' || '' }} CIBW_TEST_COMMAND: python run_tests.py CIBW_TEST_SOURCES: run_tests.py test_data tests with: package-dir: . output-dir: dist - - uses: actions/upload-artifact@v7 + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: dist/*.whl + retention-days: 14 upload_pypi: needs: [build_sdist, build_wheels_linux, build_wheels_macos, build_wheels_windows] runs-on: ubuntu-latest + timeout-minutes: 60 environment: pypi permissions: id-token: write if: github.event_name == 'release' && github.event.action == 'published' steps: - - uses: actions/download-artifact@v8 + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: pattern: cibw-* path: dist merge-multiple: true - - uses: pypa/gh-action-pypi-publish@release/v1 + - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2597ccf..545c132 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,25 +1,38 @@ # Check source. name: lint +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true on: pull_request: push: -permissions: read-all +permissions: + contents: read jobs: black: runs-on: ubuntu-latest + timeout-minutes: 15 steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Check format of Python code - uses: psf/black@stable + uses: psf/black@258e7dbf348bc23cb70b8cdf693481c04634ebcc # v26.10.1 with: options: "--check" src: "." pylint: runs-on: ubuntu-latest + timeout-minutes: 15 steps: - - uses: actions/checkout@v6 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Set up Python + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: '3.14' + cache: 'pip' - name: Install tox run: | python -m pip install tox diff --git a/tox.ini b/tox.ini index 938b294..6f26a82 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py3{10,11,12,13,14,14t},black,pylint +envlist = py3{10,11,12,13,14,14t,15,15t},black,pylint [testenv] pip_pre = True