-
Notifications
You must be signed in to change notification settings - Fork 23
93 lines (74 loc) · 3.01 KB
/
test_build.yml
File metadata and controls
93 lines (74 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Test Build
# NOTE: build logic is duplicated here and in publish.yml
# Run on the master branch commit push and PRs to master (note conditional below)
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build_wheels:
# Only run if the commit message contains '[ci build]'
if: "contains(toJSON(github.event.commits.*.message), '[ci build]') || contains(toJSON(github.event.pull_request.title), '[ci build]')"
strategy:
fail-fast: false
matrix:
# macos-13 is an intel runner, macos-14+ is apple silicon
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-15-intel, macos-latest]
name: Build wheels ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Package source distribution
# make sure this only happens on one of the runners, not repeated on all
if: matrix.os == 'ubuntu-latest'
run: |
python -m pip install build
python -m build --sdist
- name: Run cibuildwheel
uses: pypa/cibuildwheel@v3.3.0
with:
config-file: ".github/workflows/cibuildwheel_config.toml"
# Upload binaries to the github artifact store
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: |
./wheelhouse/*.whl
./wheelhouse/*.tar.gz
overwrite: true
# Do all but the very last step of pushing the upload to pypi, to catch any problems
# in directory layout or multiply-generated wheels etc.
prep_upload:
name: Prep release upload
# Only run if the commit message contains '[ci build]'
if: "contains(toJSON(github.event.commits.*.message), '[ci build]') || contains(toJSON(github.event.pull_request.title), '[ci build]')"
needs: [build_wheels]
runs-on: ubuntu-latest
steps:
- name: Download built wheels artifact # downloads from the jobs storage from the previous step
uses: actions/download-artifact@v4.2.1
with:
# omitting the `name: ` field downloads all artifacts from this workflow
path: dist
- name: List downloaded files from artifact
run: ls -lR dist
# dist directory has subdirs from the different jobs, merge them into one directory and delete
# the empty leftover dirs
- name: Flatten directory
run: find dist -mindepth 2 -type f -exec mv -t dist {} + && find dist -type d -empty -delete
- name: List downloaded files from artifact after flatten
run: ls -lR dist
# This is where we would actually publish, if it were a real release
# - name: Publish package to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# To test: repository_url: https://test.pypi.org/legacy/