| 1 |
name: CI |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
paths: |
| 6 |
- '**' |
| 7 |
- '!.github/**' |
| 8 |
- '.github/workflows/ci.yml' |
| 9 |
pull_request: |
| 10 |
paths: |
| 11 |
- '**' |
| 12 |
- '!.github/**' |
| 13 |
- '.github/workflows/ci.yml' |
| 14 |
workflow_dispatch: |
| 15 |
|
| 16 |
concurrency: |
| 17 |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} |
| 18 |
cancel-in-progress: true |
| 19 |
|
| 20 |
permissions: |
| 21 |
contents: read # to fetch code (actions/checkout) |
| 22 |
|
| 23 |
env: |
| 24 |
ZLIB_VERSION: "1.3.2" |
| 25 |
LIBICONV_VERSION: "1.18" |
| 26 |
LIBXML2_VERSION: "2.14.6" |
| 27 |
LIBXSLT_VERSION: "1.1.43" |
| 28 |
|
| 29 |
|
| 30 |
jobs: |
| 31 |
ci: |
| 32 |
strategy: |
| 33 |
# Allows for matrix sub-jobs to fail without canceling the rest |
| 34 |
fail-fast: false |
| 35 |
|
| 36 |
# MATRIX: |
| 37 |
# ======= |
| 38 |
# Required parameters: |
| 39 |
# os the os to run on |
| 40 |
# python-version the python version to use |
| 41 |
# backend the backend to use |
| 42 |
# env any additional env variables. Set to '{}' for none |
| 43 |
# Optional parameters: |
| 44 |
# allowed_failure whether the job is allowed to fail |
| 45 |
# extra_hash extra hash str to differentiate from other caches with similar name (must always start with '-') |
| 46 |
matrix: |
| 47 |
# Tests [amd64] |
| 48 |
# |
| 49 |
os: [ubuntu-22.04, macos-latest, windows-2022, windows-11-arm] |
| 50 |
python-version: |
| 51 |
- "3.8" |
| 52 |
- "3.9" |
| 53 |
- "3.10" # quotes to avoid being interpreted as the number 3.1 |
| 54 |
- "3.11" |
| 55 |
- "3.12" |
| 56 |
- "3.13" |
| 57 |
- "3.14" |
| 58 |
- "3.15-dev" |
| 59 |
env: [{ STATIC_DEPS: true }, { STATIC_DEPS: false }] |
| 60 |
|
| 61 |
include: |
| 62 |
#- os: ubuntu-22.04 |
| 63 |
# python-version: "3.15-dev" |
| 64 |
# allowed_failure: true |
| 65 |
|
| 66 |
- os: ubuntu-latest |
| 67 |
python-version: "3.9" |
| 68 |
env: {STATIC_DEPS: true, WITH_REFNANNY: true} |
| 69 |
extra_hash: "-refnanny" |
| 70 |
- os: ubuntu-latest |
| 71 |
python-version: "3.13" |
| 72 |
env: {STATIC_DEPS: true, WITH_REFNANNY: true} |
| 73 |
extra_hash: "-refnanny" |
| 74 |
|
| 75 |
# Coverage setup |
| 76 |
- os: ubuntu-latest |
| 77 |
python-version: "3.10" |
| 78 |
env: { COVERAGE: true, STATIC_DEPS: true } |
| 79 |
extra_hash: "-coverage" |
| 80 |
- os: ubuntu-latest |
| 81 |
python-version: "3.10" |
| 82 |
env: { STATIC_DEPS: false, EXTRA_DEPS: "docutils pygments sphinx sphinx-rtd-theme" } |
| 83 |
extra_hash: "-docs" |
| 84 |
|
| 85 |
# Old library setup with minimum version requirements |
| 86 |
- os: ubuntu-latest |
| 87 |
python-version: "3.12" |
| 88 |
env: { |
| 89 |
STATIC_DEPS: true, |
| 90 |
LIBXML2_VERSION: 2.9.2, |
| 91 |
LIBXSLT_VERSION: 1.1.27, |
| 92 |
} |
| 93 |
extra_hash: "-oldlibs29" |
| 94 |
- os: ubuntu-latest |
| 95 |
python-version: "3.12" |
| 96 |
env: { |
| 97 |
STATIC_DEPS: true, |
| 98 |
LIBXML2_VERSION: 2.10.3, |
| 99 |
LIBXSLT_VERSION: 1.1.37, |
| 100 |
} |
| 101 |
extra_hash: "-oldlibs210" |
| 102 |
- os: ubuntu-latest |
| 103 |
python-version: "3.12" |
| 104 |
env: { |
| 105 |
STATIC_DEPS: true, |
| 106 |
LIBXML2_VERSION: 2.11.8, |
| 107 |
LIBXSLT_VERSION: 1.1.37, |
| 108 |
} |
| 109 |
extra_hash: "-oldlibs211" |
| 110 |
- os: ubuntu-latest |
| 111 |
python-version: "3.12" |
| 112 |
env: { |
| 113 |
STATIC_DEPS: true, |
| 114 |
LIBXML2_VERSION: 2.12.10, |
| 115 |
LIBXSLT_VERSION: 1.1.37, |
| 116 |
} |
| 117 |
extra_hash: "-oldlibs212" |
| 118 |
- os: ubuntu-latest |
| 119 |
python-version: "3.12" |
| 120 |
env: { |
| 121 |
STATIC_DEPS: true, |
| 122 |
LIBXML2_VERSION: 2.13.7, |
| 123 |
LIBXSLT_VERSION: 1.1.40, |
| 124 |
} |
| 125 |
extra_hash: "-oldlibs213" |
| 126 |
|
| 127 |
- os: ubuntu-latest |
| 128 |
python-version: "3.12" |
| 129 |
#allowed_failure: true |
| 130 |
env: { |
| 131 |
STATIC_DEPS: true, |
| 132 |
LIBXML2_VERSION: "", |
| 133 |
LIBXSLT_VERSION: "", |
| 134 |
} |
| 135 |
extra_hash: "-latestlibs" |
| 136 |
|
| 137 |
- os: ubuntu-latest |
| 138 |
python-version: "3.12" |
| 139 |
#allowed_failure: true |
| 140 |
env: { |
| 141 |
STATIC_DEPS: "true", |
| 142 |
LIBXML2_VERSION: "", |
| 143 |
LIBXSLT_VERSION: "", |
| 144 |
WITHOUT_ZLIB: "true", |
| 145 |
} |
| 146 |
extra_hash: "-nozlib" |
| 147 |
|
| 148 |
# Ubuntu sub-jobs: |
| 149 |
# ================ |
| 150 |
# Pypy |
| 151 |
- os: ubuntu-latest |
| 152 |
python-version: pypy-3.9 |
| 153 |
env: { STATIC_DEPS: false } |
| 154 |
allowed_failure: true |
| 155 |
- os: ubuntu-latest |
| 156 |
python-version: pypy-3.10 |
| 157 |
env: { STATIC_DEPS: false } |
| 158 |
allowed_failure: true |
| 159 |
- os: ubuntu-latest |
| 160 |
python-version: pypy-3.11 |
| 161 |
env: { STATIC_DEPS: false } |
| 162 |
allowed_failure: true |
| 163 |
|
| 164 |
# MacOS sub-jobs |
| 165 |
# ============== |
| 166 |
#- os: macos-latest |
| 167 |
# allowed_failure: true # Unicode parsing fails in Py3 |
| 168 |
|
| 169 |
# Legacy jobs |
| 170 |
# =========== |
| 171 |
#- os: ubuntu-22.04 |
| 172 |
# python-version: "3.7" |
| 173 |
# env: { STATIC_DEPS: true } |
| 174 |
#- os: ubuntu-22.04 |
| 175 |
# python-version: "3.7" |
| 176 |
# env: { STATIC_DEPS: false } |
| 177 |
|
| 178 |
exclude: |
| 179 |
# Windows sub-jobs |
| 180 |
# ============== |
| 181 |
- os: windows-2022 |
| 182 |
env: { STATIC_DEPS: false } # always static |
| 183 |
- os: windows-11-arm |
| 184 |
env: { STATIC_DEPS: false } # always static |
| 185 |
- os: windows-11-arm |
| 186 |
python-version: "3.8" # setup-python only supports 3.11+ on windows arm |
| 187 |
- os: windows-11-arm |
| 188 |
python-version: "3.9" # setup-python only supports 3.11+ on windows arm |
| 189 |
- os: windows-11-arm |
| 190 |
python-version: "3.10" # setup-python only supports 3.11+ on windows arm |
| 191 |
|
| 192 |
# This defaults to 360 minutes (6h) which is way too long and if a test gets stuck, it can block other pipelines. |
| 193 |
# From testing, the runs tend to take 8-20 minutes, so a limit of 45 minutes should be enough. |
| 194 |
timeout-minutes: 45 |
| 195 |
runs-on: ${{ matrix.os }} |
| 196 |
|
| 197 |
env: |
| 198 |
OS_NAME: ${{ matrix.os }} |
| 199 |
PYTHON_VERSION: ${{ matrix.python-version }} |
| 200 |
MACOSX_DEPLOYMENT_TARGET: "11.0" |
| 201 |
COVERAGE: false |
| 202 |
GCC_VERSION: 9 |
| 203 |
USE_CCACHE: 1 |
| 204 |
CCACHE_SLOPPINESS: "pch_defines,time_macros" |
| 205 |
CCACHE_COMPRESS: 1 |
| 206 |
CCACHE_MAXSIZE: "100M" |
| 207 |
|
| 208 |
steps: |
| 209 |
- name: Checkout repo |
| 210 |
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 211 |
with: |
| 212 |
fetch-depth: 1 |
| 213 |
|
| 214 |
- name: Setup Python |
| 215 |
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 |
| 216 |
with: |
| 217 |
python-version: ${{ matrix.python-version }} |
| 218 |
|
| 219 |
- name: Install MacOS dependencies |
| 220 |
if: runner.os == 'macOS' |
| 221 |
run: | |
| 222 |
brew install automake libtool ccache |
| 223 |
ln -s /usr/local/bin/glibtoolize /usr/local/bin/libtoolize |
| 224 |
|
| 225 |
- name: ccache |
| 226 |
uses: hendrikmuhs/ccache-action@33522472633dbd32578e909b315f5ee43ba878ce # v1.2.22 |
| 227 |
if: runner.os == 'Linux' || runner.os == 'macOS' |
| 228 |
with: |
| 229 |
max-size: 100M |
| 230 |
create-symlink: true |
| 231 |
key: ${{ runner.os }}-${{ runner.arch }}-ccache${{ matrix.extra_hash }}-${{ matrix.python-version }}-${{ matrix.env.STATIC_DEPS }}-${{ matrix.env.LIBXML2_VERSION || env.LIBXML2_VERSION }}-${{ matrix.env.LIBXSLT_VERSION || env.LIBXSLT_VERSION }} |
| 232 |
|
| 233 |
- name: Cache [libs] |
| 234 |
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
| 235 |
if: matrix.env.STATIC_DEPS |
| 236 |
with: |
| 237 |
path: | |
| 238 |
libs/*.xz |
| 239 |
libs/*.gz |
| 240 |
libs/*.zip |
| 241 |
key: libs-${{ runner.os }}-${{ matrix.env.LIBXML2_VERSION || env.LIBXML2_VERSION }}-${{ matrix.env.LIBXSLT_VERSION || env.LIBXSLT_VERSION }}-${{ env.LIBICONV_VERSION }}-${{ env.ZLIB_VERSION }} |
| 242 |
|
| 243 |
- name: Run CI |
| 244 |
continue-on-error: ${{ matrix.allowed_failure || false }} |
| 245 |
env: ${{ matrix.env }} |
| 246 |
run: bash -c 'GITHUB_API_TOKEN="${{ secrets.GITHUB_TOKEN }}" bash ./tools/ci-run.sh' |
| 247 |
|
| 248 |
- name: Build docs |
| 249 |
if: contains( matrix.env.EXTRA_DEPS, 'sphinx') |
| 250 |
run: make html |
| 251 |
|
| 252 |
- name: Upload docs |
| 253 |
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 254 |
if: matrix.extra_hash == '-docs' |
| 255 |
with: |
| 256 |
name: website_html |
| 257 |
path: doc/html |
| 258 |
if-no-files-found: ignore |
| 259 |
|
| 260 |
- name: Upload Coverage Report |
| 261 |
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 262 |
if: matrix.env.COVERAGE |
| 263 |
with: |
| 264 |
name: pycoverage_html |
| 265 |
path: coverage* |
| 266 |
if-no-files-found: ignore |
| 267 |
|
| 268 |
benchmarks: |
| 269 |
runs-on: ubuntu-latest |
| 270 |
|
| 271 |
# The benchmarks are currently inconclusive and take a very long time to run. |
| 272 |
if: false |
| 273 |
|
| 274 |
env: |
| 275 |
CFLAGS: -march=core2 -O3 -flto -fPIC -g -Wall -Wextra |
| 276 |
CCACHE_SLOPPINESS: "pch_defines,time_macros" |
| 277 |
CCACHE_COMPRESS: 1 |
| 278 |
CCACHE_COMPRESSLEVEL: 5 |
| 279 |
STATIC_DEPS: true |
| 280 |
|
| 281 |
steps: |
| 282 |
- name: Checkout repo |
| 283 |
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 284 |
with: |
| 285 |
fetch-depth: 0 |
| 286 |
fetch-tags: true |
| 287 |
|
| 288 |
- name: ccache |
| 289 |
uses: hendrikmuhs/[email protected] |
| 290 |
if: runner.os == 'Linux' || runner.os == 'macOS' |
| 291 |
with: |
| 292 |
max-size: 150M |
| 293 |
create-symlink: true |
| 294 |
key: ${{ runner.os }}-benchmarks-${{ env.LIBXML2_VERSION }}-${{ env.LIBXSLT_VERSION }} |
| 295 |
|
| 296 |
- name: Setup Python |
| 297 |
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 |
| 298 |
with: |
| 299 |
python-version: | |
| 300 |
3.12 |
| 301 |
3.15-dev |
| 302 |
|
| 303 |
- name: Run Benchmarks |
| 304 |
run: | |
| 305 |
# Run benchmarks in all Python versions. |
| 306 |
for PYTHON in python3.15 python3.12 ; do |
| 307 |
${PYTHON} -m pip install setuptools "Cython>=3.1.6" |
| 308 |
# Compare against arbitrary 6.0-pre baseline revision (compatible with Cython 3.1) and current master. |
| 309 |
${PYTHON} benchmark/run_benchmarks.py 0eb4f0029497957e58a9f15280b3529bdb18d117 origin/master HEAD |
| 310 |
done |