ci: use official GHA for uv #252
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build wheels | |
on: | |
# Run daily at 1:23 UTC | |
schedule: | |
- cron: '23 1 * * *' | |
# Run on demand with workflow dispatch | |
workflow_dispatch: | |
# Use from other workflows | |
workflow_call: | |
pull_request: | |
paths: | |
- .github/workflows/build-wheels.yml | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
determine-source-date-epoch: | |
name: "Determine SOURCE_DATE_EPOCH" | |
runs-on: ubuntu-latest | |
outputs: | |
source-date-epoch: ${{ steps.log.outputs.source-date-epoch }} | |
if: github.repository_owner == 'scikit-hep' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- id: log | |
name: Compute SOURCE_DATE_EPOCH | |
run: | | |
# Find latest unix timestamp in awkward-cpp, and the kernel generation files | |
epoch=$( git log -1 --format=%at -- awkward-cpp kernel-specification.yml kernel-test-data.json ) | |
echo "source-date-epoch=$epoch" >> $GITHUB_OUTPUT | |
make_sdist: | |
name: "Build awkward-cpp sdist" | |
runs-on: ubuntu-latest | |
needs: [determine-source-date-epoch] | |
env: | |
SOURCE_DATE_EPOCH: ${{ needs.determine-source-date-epoch.outputs.source-date-epoch }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Prepare build files | |
run: pipx run nox -s prepare | |
- name: Build awkward-cpp sdist | |
run: pipx run build --sdist awkward-cpp | |
- name: Check metadata | |
run: pipx run twine check awkward-cpp/dist/* | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: awkward-cpp-sdist | |
path: awkward-cpp/dist/*.tar.gz | |
build_wheels: | |
needs: [determine-source-date-epoch] | |
name: "Wheel awkward-cpp: ${{ matrix.type }} ${{ matrix.arch }} on ${{ matrix.os }} with ${{ matrix.build }}" | |
runs-on: ${{ matrix.os }} | |
env: | |
SOURCE_DATE_EPOCH: ${{ needs.determine-source-date-epoch.outputs.source-date-epoch }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-12] | |
arch: [auto64] | |
build: ["cp", "pp"] | |
include: | |
- os: macos-12 | |
type: "Universal" | |
arch: universal2 | |
build: "cp" | |
- os: windows-latest | |
arch: auto64 | |
build: "cp" | |
- os: windows-latest | |
arch: auto32 | |
build: "cp{38,39}-" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Setup uv | |
uses: astral-sh/setup-uv@v3 | |
- name: Prepare build files | |
run: pipx run nox -s prepare | |
- uses: pypa/cibuildwheel@v2.21 | |
env: | |
CIBW_BUILD: "${{ matrix.build }}*" | |
CIBW_ARCHS: ${{ matrix.arch }} | |
with: | |
config-file: cibuildwheel.toml | |
package-dir: awkward-cpp | |
- name: Check metadata | |
shell: python | |
run: | | |
import subprocess, glob | |
subprocess.run( | |
["pipx", "run", "twine", "check", *glob.glob("wheelhouse/*.whl")], | |
check=True | |
) | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: awkward-cpp-wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.build }} | |
path: wheelhouse/*.whl | |
build_alt_wheels: | |
needs: [determine-source-date-epoch] | |
name: "Wheel awkward-cpp: ${{ matrix.python }} on ${{ matrix.arch }}" | |
runs-on: ubuntu-latest | |
env: | |
SOURCE_DATE_EPOCH: ${{ needs.determine-source-date-epoch.outputs.source-date-epoch }} | |
strategy: | |
matrix: | |
python: [38, 39, 310, 311, 312, 313] | |
arch: [aarch64] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Setup uv | |
uses: astral-sh/setup-uv@v3 | |
- name: Prepare build files | |
run: pipx run nox -s prepare | |
- uses: docker/setup-qemu-action@v3.2.0 | |
- uses: pypa/cibuildwheel@v2.21 | |
env: | |
CIBW_BUILD: cp${{ matrix.python }}-* | |
CIBW_ARCHS: ${{ matrix.arch }} | |
with: | |
config-file: cibuildwheel.toml | |
package-dir: awkward-cpp | |
- name: Check metadata | |
shell: python | |
run: | | |
import subprocess, glob | |
subprocess.run( | |
["pipx", "run", "twine", "check", *glob.glob("wheelhouse/*.whl")], | |
check=True | |
) | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: awkward-cpp-wheels-${{ matrix.arch }}-py${{ matrix.python }} | |
path: wheelhouse/*.whl | |
build_awkward_wheel: | |
name: "Build awkward sdist and wheel" | |
runs-on: ubuntu-latest | |
needs: [determine-source-date-epoch] | |
env: | |
SOURCE_DATE_EPOCH: ${{ needs.determine-source-date-epoch.outputs.source-date-epoch }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup uv | |
uses: astral-sh/setup-uv@v3 | |
- name: Prepare build files | |
run: pipx run nox -s prepare | |
- name: Build distributions | |
run: pipx run build --installer uv | |
- name: Check metadata | |
run: pipx run twine check dist/* | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: awkward-wheel | |
path: dist/* |