-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Make wheel building workflow reusable (#3016)
* ci: Add reusable wheel building workflow * Factor the wheel building out of deploy-cpp.yml and make a new build-wheels.yml GitHub Actions workflow that runs on a schedule, workflow dispatch, and on workflow call from other workflows. - Use the pattern 'awkward-cpp' and 'awkward-cpp-wheels-*' for naming the upload artifacts so that the upload-nightly-wheels.yml workflow can find and download these artifacts. - Use workflow_call to allow for the workflow to be used by other workflows. c.f. https://docs.github.com/en/actions/using-workflows/reusing-workflows#using-inputs-and-secrets-in-a-reusable-workflow * In the deploy-cpp.yml workflow call the build-wheels workflow using a relative path to pick up the given branch's file. - Use the pattern 'awkward-cpp*' for downloading artifacts so as to not download and then deploy the Awkward wheels and sdist, but only the awkward-cpp. - Add a ls of the downloaded wheel files to have them appear in the action run logs for visual inspection checks. * Remove the schedule cron job from packaging-test.yml as no longer needed as this is now covered in build-wheels.yml as build-wheels will build all the wheels and not just a subset. * Update the workflow target in the nightly wheel uploader to be build-wheels.yml. * ci: Remove build flags that correspond to default * By default build will build a sdist and then a wheel from it, so can remove the --sdist and --wheel flags. * chore: Rename workflow for consistency in naming scheme * All the other GitHub Actions workflow files use '-' to seperate names, so use '-' over '_'.
- Loading branch information
1 parent
8615feb
commit dfc9690
Showing
5 changed files
with
208 additions
and
163 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
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: | ||
|
||
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-latest] | ||
arch: [auto64] | ||
build: ["cp", "pp"] | ||
|
||
include: | ||
- os: macos-latest | ||
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.11 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Prepare build files | ||
run: pipx run nox -s prepare | ||
|
||
- uses: pypa/[email protected] | ||
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] | ||
arch: [aarch64] | ||
steps: | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Python 3.10 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Prepare build files | ||
run: pipx run nox -s prepare | ||
|
||
- uses: docker/[email protected] | ||
|
||
- uses: pypa/[email protected] | ||
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: Prepare build files | ||
run: pipx run nox -s prepare | ||
|
||
- name: Build distributions | ||
run: pipx run build | ||
|
||
- name: Check metadata | ||
run: pipx run twine check dist/* | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: awkward-wheel | ||
path: dist/* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,165 +8,12 @@ on: | |
description: Publish to PyPI | ||
|
||
jobs: | ||
determine-source-date-epoch: | ||
name: "Determine SOURCE_DATE_EPOCH" | ||
runs-on: ubuntu-latest | ||
outputs: | ||
source-date-epoch: ${{ steps.log.outputs.source-date-epoch }} | ||
|
||
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 | ||
build-wheels: | ||
uses: ./.github/workflows/build-wheels.yml | ||
|
||
make_sdist: | ||
name: Make 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-sdist | ||
path: awkward-cpp/dist/*.tar.gz | ||
|
||
build_wheels: | ||
needs: [determine-source-date-epoch] | ||
name: "Wheel: ${{ 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-latest] | ||
arch: [auto64] | ||
build: ["cp", "pp"] | ||
|
||
include: | ||
- os: macos-latest | ||
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.11 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Prepare build files | ||
run: pipx run nox -s prepare | ||
|
||
- uses: pypa/[email protected] | ||
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-wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.build }} | ||
path: wheelhouse/*.whl | ||
|
||
|
||
build_alt_wheels: | ||
needs: [determine-source-date-epoch] | ||
name: "Wheel: ${{ 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] | ||
arch: [aarch64] | ||
steps: | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Python 3.10 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Prepare build files | ||
run: pipx run nox -s prepare | ||
|
||
- uses: docker/[email protected] | ||
|
||
- uses: pypa/[email protected] | ||
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-wheels-${{ matrix.arch }}-py${{ matrix.python }} | ||
path: wheelhouse/*.whl | ||
|
||
upload_all: | ||
needs: [build_wheels, build_alt_wheels, make_sdist] | ||
upload-awkward-cpp: | ||
needs: [build-wheels] | ||
runs-on: ubuntu-latest | ||
if: inputs.publish-pypi | ||
permissions: | ||
|
@@ -175,10 +22,14 @@ jobs: | |
name: "pypi" | ||
url: "https://pypi.org/project/awkward-cpp/" | ||
steps: | ||
|
||
- uses: actions/download-artifact@v4 | ||
with: | ||
pattern: "awkward*" | ||
pattern: "awkward-cpp*" | ||
path: dist | ||
merge-multiple: true | ||
|
||
- name: List distributions to be deployed | ||
run: ls -l dist/ | ||
|
||
- uses: pypa/[email protected] |
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
Oops, something went wrong.