-
Notifications
You must be signed in to change notification settings - Fork 83
158 lines (144 loc) · 4.6 KB
/
wheels.yml
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: Build
on:
push:
branches:
- master
tags:
- "*"
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
job_metadata:
runs-on: ubuntu-latest
outputs:
commit_message: ${{ steps.get_commit_message.outputs.commit_message }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Print head git commit message
id: get_commit_message
run: |
if [[ -z "$COMMIT_MSG" ]]; then
COMMIT_MSG=$(git show -s --format=%s $REF)
fi
echo commit_message=$COMMIT_MSG | tee -a $GITHUB_OUTPUT
env:
COMMIT_MSG: ${{ github.event.head_commit.message }}
REF: ${{ github.event.pull_request.head.sha }}
build-sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build sdist
run: pipx run build -s
- uses: actions/upload-artifact@v3
with:
name: sdist
path: ./dist/*.tar.gz
build-wheel:
name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }}
needs: [job_metadata]
runs-on: ${{ matrix.buildplat[0] }}
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') || contains(needs.job_metadata.outputs.commit_message, '[build wheels]')
strategy:
fail-fast: false
matrix:
buildplat:
- [ubuntu-latest, musllinux_x86_64]
- [ubuntu-latest, manylinux_aarch64]
- [macos-13, macosx_x86_64] # native Intel hardware
- [windows-latest, win_amd64]
python: ["cp38", "cp39", "cp310", "cp311", "cp312"]
# No NumPy wheels on 3.8 aarch64 or musl
exclude:
- buildplat: [ubuntu-latest, manylinux_aarch64]
python: "cp38"
- buildplat: [ubuntu-latest, musllinux_x86_64]
python: "cp38"
include:
# Manylinux and arm64 builds (on native hardware) are cheap, do all in one
- { buildplat: ["ubuntu-latest", "manylinux_x86_64"], python: "*" }
- { buildplat: ["macos-14", "macosx_arm64"], python: "*" }
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v3
- name: Update pip/pipx
run: pip install --upgrade pip pipx
# For aarch64 support
# https://cibuildwheel.pypa.io/en/stable/faq/#emulation
- uses: docker/setup-qemu-action@v3
with:
platforms: all
if: runner.os == 'Linux' && endsWith(matrix.buildplat[1], 'aarch64')
- name: Build wheel(s)
run: pipx run --spec "cibuildwheel>=2.15" cibuildwheel
env:
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.python == '*' && 'all' || matrix.python }}-${{ startsWith(matrix.buildplat[1], 'macosx') && 'macosx' || matrix.buildplat[1] }}
path: ./wheelhouse/*.whl
test-sdist:
name: Test sdist
needs: [build-sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: sdist
path: ./dist
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install sdist
run: pip install dist/*.tar.gz
- run: python -c 'import nitime; print(nitime.__version__)'
- name: Install pytest
run: pip install pytest
- name: Run tests
run: pytest -v --pyargs nitime
pre-publish:
runs-on: ubuntu-latest
needs: [test-sdist, build-wheel]
steps:
- uses: actions/download-artifact@v3
with:
path: dist/
- name: Check artifacts
run: ls -lR
- name: Consolidate and re-check
run: |
mv dist/*/*.{tar.gz,whl} dist
rmdir dist/*/
ls -lR
- run: pipx run twine check dist/*
publish:
runs-on: ubuntu-latest
environment: "Package deployment"
needs: [pre-publish]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v3
with:
path: dist/
- name: Consolidate artifacts
run: |
mv dist/*/*.{tar.gz,whl} dist
rmdir dist/*/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}