Skip to content

ci: use distinct artifact names for arch target wheels #12

ci: use distinct artifact names for arch target wheels

ci: use distinct artifact names for arch target wheels #12

Workflow file for this run

name: release
on:
push:
branches: [release]
tags: [v*]
workflow_dispatch:
inputs:
pkgcraft-c-ref:
required: false
type: string
default: 'main'
jobs:
setup:
runs-on: ubuntu-latest
outputs:
pkgcraft-c-ref: ${{ steps.vars.outputs.pkgcraft-c-ref }}
steps:
- name: Checkout pkgcraft code
uses: actions/checkout@v4
with:
repository: pkgcraft/pkgcraft
# checkout full history for tags
fetch-depth: 0
submodules: true
- name: Determine target pkgcraft-c version
id: vars
run: |
if [[ -n "${{ inputs.pkgcraft-c-ref }}" ]]; then
pkgcraft_c_ref=${{ inputs.pkgcraft-c-ref }}
else
# get all pkgcraft-c tags in descending time created order
mapfile -t tags < <( git tag --list --sort=-taggerdate 'pkgcraft-c-*' )
pkgcraft_c_ref=${tags[0]}
if [[ -z ${pkgcraft_c_ref} ]]; then
echo "No tags matching: pkgcraft-c-*"
exit 1
fi
fi
if [[ ${pkgcraft_c_ref} =~ ^pkgcraft-c-* ]]; then
echo "Building against pkgcraft-c tag: ${pkgcraft_c_ref}"
else
echo "Building against pkgcraft-c branch: ${pkgcraft_c_ref}"
fi
echo "pkgcraft-c-ref=${pkgcraft_c_ref}" >> $GITHUB_OUTPUT
build-sdist:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# checkout full history for setuptools-scm
fetch-depth: 0
submodules: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Build sdist
run: |
pip install tox
tox -e sdist
- name: Upload sdist artifact
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
if-no-files-found: error
retention-days: 3
build-wheels:
needs: ["build-sdist", "setup"]
strategy:
matrix:
include:
- os: ubuntu-latest
arch: 'x86_64'
- os: ubuntu-latest
arch: 'aarch64'
- os: ubuntu-latest
arch: 'ppc64le'
runs-on: ${{ matrix.os }}
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macos-target }}
CIBW_CONTAINER_ENGINE: 'docker'
CIBW_PLATFORM: 'auto'
PKGCRAFT_C_REF: ${{ needs.setup.outputs.pkgcraft-c-ref }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download sdist artifact
uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Set up QEMU
if: runner.os == 'Linux' && matrix.arch != 'x86_64'
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ matrix.arch }}
- name: Build wheels
run: .ci/build-wheels ${{ matrix.arch }}
- name: Verify wheels
run: |
pip install twine
twine check wheels/*
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}-wheels
path: wheels/
if-no-files-found: error
retention-days: 3
publish:
if: startsWith(github.ref, 'refs/tags/')
needs: ["build-sdist", "build-wheels"]
runs-on: ubuntu-latest
steps:
- name: Download sdist and wheel artifacts
uses: actions/download-artifact@v4
with:
path: ${{ github.ref_name }}
merge-multiple: true
- name: Upload sdist to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: ${{ github.ref_name }}/sdist/
print_hash: true
- name: Upload wheels to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: ${{ github.ref_name }}/wheels/
print_hash: true
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
files: ${{ github.ref_name }}/sdist/*.tar.gz
fail_on_unmatched_files: true