Skip to content

Bump actions/setup-python from 6 to 7 (#54) #70

Bump actions/setup-python from 6 to 7 (#54)

Bump actions/setup-python from 6 to 7 (#54) #70

Workflow file for this run

name: Test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: "0 0 * * 0" # Runs every Sunday at midnight UTC
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
id-token: write
contents: read
jobs:
fetch-python-versions:
runs-on: ubuntu-latest
outputs:
supported_versions: ${{ steps.fetch-versions.outputs.supported_versions }}
bound_versions: ${{ steps.fetch-versions.outputs.bound_versions }}
steps:
- name: Fetch Supported Python
id: fetch-versions
run: |
# Without pipefail this pipeline reports jq's exit status, not
# curl's, so a network failure is masked: jq reads empty input,
# emits [], and the matrix expands to zero jobs. build-and-test
# then never gets created and the run fails with no failing step.
set -euo pipefail
versions=$(curl -fsSL --retry 3 --retry-all-errors --connect-timeout 15 \
https://endoflife.date/api/v1/products/python/ \
| jq -c '[ .result.releases[] | select(.isEol == false) | .label ]')
if [ "$(echo "$versions" | jq 'length')" -eq 0 ]; then
echo "::error::endoflife.date returned no supported Python versions"
exit 1
fi
echo "supported_versions=$versions" >> $GITHUB_OUTPUT
echo "bound_versions=$(echo "$versions" | jq -c '[.[0],.[-1]]')" >> $GITHUB_OUTPUT
build-and-test:
name: Build and Test
needs: fetch-python-versions
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# macos pinned to 15 to match the wheel target used in build.yml
# and release-pypi.yml; see the note there.
os: [ubuntu-latest, windows-latest, macos-15]
python-version: ${{ fromJson(needs.fetch-python-versions.outputs.supported_versions) }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Install gfortran (macOS)
if: runner.os == 'macOS'
run: |
brew install gcc || brew link --overwrite gcc
echo "$(brew --prefix gcc)/bin" >> "$GITHUB_PATH"
"$(brew --prefix gcc)/bin/gfortran" --version
- name: Install MinGW via Chocolatey (Windows)
if: runner.os == 'Windows'
run: |
choco install -y mingw
$paths = @(
'C:\\ProgramData\\mingw64\\mingw64\\bin',
'C:\\ProgramData\\chocolatey\\lib\\mingw\\tools\\install\\mingw64\\bin',
'C:\\tools\\mingw64\\bin',
'C:\\ProgramData\\chocolatey\\bin'
)
foreach ($p in $paths) { if (Test-Path $p) { echo $p >> $env:GITHUB_PATH; Write-Host "Added $p to PATH" } }
- name: Setup uv
uses: astral-sh/setup-uv@v7
- name: Install project
run: uv run bin/build.py install
- name: Run Pytest
run: uv run --no-sync pytest -v -n auto --cov --cov-report=xml
- name: Debug Windows native deps
if: failure() && runner.os == 'Windows'
shell: pwsh
run: |
Write-Host 'PATH:'
Write-Host $env:PATH
foreach ($cmd in @('gcc', 'gfortran', 'objdump')) {
try {
Write-Host "Command: $cmd"
Get-Command $cmd -ErrorAction Stop | Format-List *
} catch {
Write-Host "Missing command: $cmd"
}
}
$dllRoots = @(
'C:\ProgramData\mingw64\mingw64\bin',
'C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin',
'C:\tools\mingw64\bin'
)
foreach ($root in $dllRoots) {
if (Test-Path $root) {
Write-Host "DLLs in $root"
Get-ChildItem $root -Filter '*.dll' | Select-Object -ExpandProperty Name
}
}
$pyds = Get-ChildItem -Path . -Recurse -Filter '*.pyd' -ErrorAction SilentlyContinue
foreach ($pyd in $pyds) {
Write-Host "Inspecting $($pyd.FullName)"
try {
& objdump -p $pyd.FullName | Select-String 'DLL Name|Name:|ImageBase|Subsystem'
} catch {
Write-Host "objdump failed for $($pyd.FullName)"
}
}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v7
with:
fail_ci_if_error: true
use_oidc: true
verbose: true
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: build-${{ matrix.os }}-py${{ matrix.python-version }}
path: |
build/
dist/
.mesonpy/
build.log
retention-days: 5