Skip to content

Fix dependency caching for emulated Linux jobs #656

Fix dependency caching for emulated Linux jobs

Fix dependency caching for emulated Linux jobs #656

Workflow file for this run

name: Wheels
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != 'master' }}
on:
push:
branches: [master]
tags:
- 'v*'
pull_request:
branches: [master]
paths-ignore:
- 'docs/**'
jobs:
sdist:
runs-on: ubuntu-latest
outputs:
release_title: ${{ steps.parse_changelog.outputs.release_title }}
steps:
- uses: actions/checkout@v7
with:
# avoid leaking credentials in uploaded artifacts
persist-credentials: false
- uses: actions/setup-python@v7
with:
python-version: '3.13'
- name: Build sdist
run: pipx run build --sdist --outdir dist
- uses: actions/upload-artifact@v7
with:
name: wheels-sdist
path: dist/*
- name: parse CHANGELOG for release notes
id: parse_changelog
run: python .github/workflows/parse_release_notes.py
- name: Upload Release Notes
uses: actions/upload-artifact@v7
with:
name: release-notes
path: ReleaseNotes.md
build_wheels:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
needs: sdist
strategy:
# let other jobs in matrix complete if one fails
fail-fast: false
matrix:
include:
- name: linux-amd-glibc
os: ubuntu-24.04
cibw_skip: '*musllinux*'
- name: linux-amd-musl
os: ubuntu-24.04
cibw_skip: '*manylinux*'
- name: linux-arm-glibc
os: ubuntu-24.04-arm
cibw_skip: '*musllinux*'
- name: linux-arm-musl
os: ubuntu-24.04-arm
cibw_skip: '*manylinux*'
- name: macos-intel
os: macos-15-intel
- name: macos-arm
os: macos-15
- name: windows-x64
os: windows-latest
libgit2_prefix: C:/libgit2_install_x86_64
- name: windows-x86
os: windows-latest
libgit2_prefix: C:/libgit2_install_x86
- name: windows-arm64
# https://github.com/actions/partner-runner-images#available-images
os: windows-11-arm
libgit2_prefix: C:/libgit2_install_arm64
steps:
- uses: actions/setup-python@v7
with:
python-version: '3.13'
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Cache compiled dependencies
if: ${{ !startsWith(matrix.name, 'windows-') }}
uses: actions/cache@v4
with:
path: ci
key: deps-ci-${{ matrix.name }}-${{ hashFiles('pyproject.toml', 'build.sh') }}
restore-keys: deps-ci-${{ matrix.name }}-
- name: Cache compiled dependencies (Windows)
if: ${{ startsWith(matrix.name, 'windows-') }}
uses: actions/cache@v4
with:
path: |
build/libgit2_src
${{ matrix.libgit2_prefix }}
key: deps-ci-${{ matrix.name }}-${{ hashFiles('pyproject.toml') }}
restore-keys: deps-ci-${{ matrix.name }}-
- name: Download sdist
uses: actions/download-artifact@v8
with:
name: wheels-sdist
path: dist
- name: Install cibuildwheel
run: python -m pip install cibuildwheel~=3.3
- name: Build wheels
shell: bash
env:
CIBW_ARCHS_WINDOWS: ${{ matrix.name == 'windows-x86' && 'auto32' || 'native' }}
CIBW_SKIP: ${{ matrix.cibw_skip }}
CIBW_CONTAINER_ENGINE: docker; create_args: -v ${{ github.workspace }}/ci:/project/ci

Check failure on line 127 in .github/workflows/wheels.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/wheels.yml

Invalid workflow file

You have an error in your yaml syntax on line 127
run: python -m cibuildwheel dist/*.tar.gz --output-dir wheelhouse
- uses: actions/upload-artifact@v7
with:
name: wheels-${{ matrix.name }}
path: ./wheelhouse/*.whl
build_wheels_emulated_linux:
name: ${{ matrix.name }}
runs-on: ubuntu-24.04
needs: sdist
strategy:
fail-fast: true
matrix:
include:
- name: linux-ppc64le-glibc
qemu_platform: linux/ppc64le
cibw_arch: ppc64le
cibw_skip: '*musllinux*'
- name: linux-riscv64-glibc
qemu_platform: linux/riscv64
cibw_arch: riscv64
cibw_skip: '*musllinux*'
- name: linux-riscv64-musl
qemu_platform: linux/riscv64
cibw_arch: riscv64
cibw_skip: '*manylinux*'
steps:
- uses: actions/setup-python@v7
with:
python-version: '3.13'
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: docker/setup-qemu-action@v4
with:
platforms: ${{ matrix.qemu_platform }}
- name: Cache compiled dependencies
uses: actions/cache@v4
with:
path: ci
key: deps-ci-${{ matrix.name }}-${{ hashFiles('pyproject.toml', 'build.sh') }}
restore-keys: deps-ci-${{ matrix.name }}-
- name: Download sdist
uses: actions/download-artifact@v8
with:
name: wheels-sdist
path: dist
- name: Install cibuildwheel
run: python -m pip install cibuildwheel~=3.3
- name: Build wheels
shell: bash
run: python -m cibuildwheel dist/*.tar.gz --output-dir wheelhouse
env:
CIBW_ARCHS: ${{ matrix.cibw_arch }}
CIBW_SKIP: ${{ matrix.cibw_skip }}
CIBW_CONTAINER_ENGINE: docker; create_args: -v ${{ github.workspace }}/ci:/project/ci
CIBW_ENVIRONMENT: LIBSSH2_VERSION=1.11.1 LIBGIT2_VERSION=1.9.6 LIBGIT2=/project/ci
- uses: actions/upload-artifact@v7
with:
name: wheels-${{ matrix.name }}
path: ./wheelhouse/*.whl
twine-check:
name: Twine check
# It is good to do this check on non-tagged commits.
# Note, pypa/gh-action-pypi-publish (see job below) does this automatically.
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
needs: [build_wheels, build_wheels_emulated_linux, sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v8
with:
path: dist
pattern: wheels-*
merge-multiple: true
- name: check distribution files
run: pipx run twine check dist/*
pypi:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [build_wheels, build_wheels_emulated_linux, sdist]
permissions:
contents: write # to create GitHub Release
runs-on: ubuntu-24.04
steps:
- uses: actions/download-artifact@v8
with:
path: dist
pattern: wheels-*
merge-multiple: true
- name: Display structure of downloaded files
run: ls -lh dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true
- uses: actions/download-artifact@v8
with:
name: release-notes
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
REPO: ${{ github.repository }}
TITLE: ${{ needs.sdist.outputs.release_title }}
# https://cli.github.com/manual/gh_release_create
run: >-
gh release create ${TAG}
--verify-tag
--repo ${REPO}
--title "${TITLE}"
--notes-file ReleaseNotes.md