Skip to content

CI: Replace ccache action to make it hopefully work again. #645

CI: Replace ccache action to make it hopefully work again.

CI: Replace ccache action to make it hopefully work again. #645

Workflow file for this run

name: CI
on:
push:
paths:
- '**'
- '!.github/**'
- '.github/workflows/ci.yml'
pull_request:
paths:
- '**'
- '!.github/**'
- '.github/workflows/ci.yml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
ci:
strategy:
# Allows for matrix sub-jobs to fail without canceling the rest
fail-fast: false
# MATRIX:
# =======
# Required parameters:
# os the os to run on
# python-version the python version to use
# backend the backend to use
# env any additional env variables. Set to '{}' for none
# Optional parameters:
# allowed_failure whether the job is allowed to fail
# extra_hash extra hash str to differentiate from other caches with similar name (must always start with '-')
matrix:
# Tests [amd64]
#
os: [ubuntu-latest, macos-latest, windows-2019]
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10" # quotes to avoid being interpreted as the number 3.1
- "3.11"
- "3.12"
- "3.13-dev"
env: [{ STATIC_DEPS: true }, { STATIC_DEPS: false }]
include:
- os: ubuntu-latest
python-version: "3.13-dev"
allowed_failure: true
- os: ubuntu-latest
python-version: "3.9"
env: {STATIC_DEPS: true, WITH_REFNANNY: true}
extra_hash: "-refnanny"
- os: ubuntu-latest
python-version: "3.12"
env: {STATIC_DEPS: true, WITH_REFNANNY: true}
extra_hash: "-refnanny"
# Coverage setup
- os: ubuntu-latest
python-version: "3.10"
env: { COVERAGE: true, STATIC_DEPS: true }
extra_hash: "-coverage"
- os: ubuntu-latest
python-version: "3.10"
env: { STATIC_DEPS: false, EXTRA_DEPS: "docutils pygments sphinx sphinx-rtd-theme" }
extra_hash: "-docs"
# Old library setup with minimum version requirements
- os: ubuntu-latest
python-version: "3.10"
env: {
STATIC_DEPS: true,
LIBXML2_VERSION: 2.9.2,
LIBXSLT_VERSION: 1.1.27,
}
extra_hash: "-oldlibs29"
- os: ubuntu-latest
python-version: "3.10"
env: {
STATIC_DEPS: true,
LIBXML2_VERSION: 2.10.3,
LIBXSLT_VERSION: 1.1.37,
}
extra_hash: "-oldlibs210"
- os: ubuntu-latest
python-version: "3.10"
env: {
STATIC_DEPS: true,
LIBXML2_VERSION: 2.11.7,
LIBXSLT_VERSION: 1.1.37,
}
extra_hash: "-oldlibs211"
# Ubuntu sub-jobs:
# ================
# Pypy
- os: ubuntu-latest
python-version: pypy-3.8
env: { STATIC_DEPS: false }
allowed_failure: true
- os: ubuntu-latest
python-version: pypy-3.9
env: { STATIC_DEPS: false }
allowed_failure: true
- os: ubuntu-latest
python-version: pypy-3.10
env: { STATIC_DEPS: false }
allowed_failure: true
# MacOS sub-jobs
# ==============
#- os: macos-latest
# allowed_failure: true # Unicode parsing fails in Py3
- os: ubuntu-20.04
python-version: "3.6"
env: { STATIC_DEPS: true } # only static
exclude:
- os: ubuntu-latest
python-version: "3.6"
# Windows sub-jobs
# ==============
- os: windows-2019
env: { STATIC_DEPS: false } # always static
# This defaults to 360 minutes (6h) which is way too long and if a test gets stuck, it can block other pipelines.
# From testing, the runs tend to take 3-8 minutes, so a limit of 30 minutes should be enough.
timeout-minutes: 30
runs-on: ${{ matrix.os }}
env:
OS_NAME: ${{ matrix.os }}
PYTHON_VERSION: ${{ matrix.python-version }}
MACOSX_DEPLOYMENT_TARGET: 11.0
LIBXML2_VERSION: 2.12.6
LIBXSLT_VERSION: 1.1.39
COVERAGE: false
GCC_VERSION: 9
USE_CCACHE: 1
CCACHE_SLOPPINESS: "pch_defines,time_macros"
CCACHE_COMPRESS: 1
CCACHE_MAXSIZE: "100M"
steps:
- name: Checkout repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 1
- name: Setup Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Install MacOS dependencies
if: runner.os == 'macOS'
run: |
brew install automake libtool ccache
ln -s /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
create-symlink: true
verbose: 1
key: ${{ runner.os }}-ccache${{ matrix.extra_hash }}-${{ matrix.python-version }}-${{ hashFiles('.github/workflows/ci.yml', 'tools/ci-run.sh') }}
- name: Cache [libs]
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
if: matrix.env.STATIC_DEPS
with:
path: |
libs/*.xz
libs/*.gz
libs/*.zip
key: libs-${{ runner.os }}-${{ env.LIBXML2_VERSION }}-${{ env.LIBXSLT_VERSION }}
- name: Run CI
continue-on-error: ${{ matrix.allowed_failure || false }}
env: ${{ matrix.env }}
run: bash -c 'GITHUB_API_TOKEN="${{ secrets.GITHUB_TOKEN }}" bash ./tools/ci-run.sh'
- name: Build docs
if: contains( matrix.env.EXTRA_DEPS, 'sphinx')
run: make html
- name: Upload docs
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
if: matrix.extra_hash == '-docs'
with:
name: website_html
path: doc/html
if-no-files-found: ignore
- name: Upload Coverage Report
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
if: matrix.env.COVERAGE
with:
name: pycoverage_html
path: coverage*
if-no-files-found: ignore
- name: Upload Wheel
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
if: matrix.env.STATIC_DEPS && !matrix.extra_hash
with:
name: wheels-${{ runner.os }}-${{ matrix.python-version }}
path: dist/*.whl
if-no-files-found: ignore
collect-wheels:
needs: [ci]
runs-on: ubuntu-latest
steps:
- name: Collect wheels
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with:
path: ~/downloads
merge-multiple: true
- name: List downloaded artifacts
run: ls -la ~/downloads
- name: Upload Linux wheels
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: wheels-linux
path: ~/downloads/*linux*.whl
- name: Upload macOS wheels
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: wheels-macosx
path: ~/downloads/*macosx*.whl
- name: Upload Windows wheels
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: wheels-windows
path: ~/downloads/*-win*/*.whl