Skip to content

Commit 6b23099

Browse files
committed
added GHA release workflow
1 parent 11a30e1 commit 6b23099

File tree

1 file changed

+195
-0
lines changed

1 file changed

+195
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
on: push
2+
3+
jobs:
4+
sdist:
5+
runs-on: ubuntu-20.04
6+
steps:
7+
- name: clone repo
8+
uses: actions/checkout@v2
9+
10+
- name: build sdist
11+
run: |
12+
rm -rf dist/
13+
python -m pip install build
14+
python -m build --sdist
15+
16+
- name: upload sdist artifact
17+
uses: actions/upload-artifact@v2
18+
with:
19+
path: dist
20+
if-no-files-found: error
21+
22+
linux:
23+
runs-on: ubuntu-20.04
24+
strategy:
25+
matrix:
26+
include:
27+
- spec: cp27-manylinux_x86_64
28+
cibw_version: cibuildwheel<2.0 # py2.7 is not supported on CIBW 2.0+
29+
manylinux_img: manylinux1 # build really old Pythons on manylinux1
30+
- spec: cp36-manylinux_x86_64
31+
manylinux_img: manylinux1 # build really old Pythons on manylinux1
32+
- spec: cp37-manylinux_x86_64
33+
- spec: cp38-manylinux_x86_64
34+
- spec: cp39-manylinux_x86_64
35+
- spec: cp310-manylinux_x86_64
36+
- spec: cp27-manylinux_i686
37+
cibw_version: cibuildwheel<2.0 # py2.7 is not supported on CIBW 2.0+
38+
manylinux_img: manylinux1 # build really old Pythons on manylinux1
39+
- spec: cp36-manylinux_i686
40+
manylinux_img: manylinux1 # build really old Pythons on manylinux1
41+
- spec: cp37-manylinux_i686
42+
- spec: cp38-manylinux_i686
43+
- spec: cp39-manylinux_i686
44+
- spec: cp310-manylinux_i686
45+
steps:
46+
- name: clone repo
47+
uses: actions/checkout@v2
48+
49+
- name: build/test wheels
50+
env:
51+
CIBW_ARCHS_LINUX: auto
52+
CIBW_BUILD: ${{ matrix.spec }}
53+
CIBW_BEFORE_BUILD: |
54+
set -eux && \
55+
curl -L -O https://github.com/libffi/libffi/archive/v3.4.2.tar.gz && \
56+
tar zxf v3.4.2.tar.gz && cd libffi-3.4.2 && \
57+
./autogen.sh && \
58+
./configure --without-gcc-arch --disable-docs && \
59+
make && \
60+
make install && \
61+
ldconfig
62+
# TODO: update default to '' once CIBW 2.1.3 ships: https://github.com/pypa/cibuildwheel/pull/829
63+
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_img || 'manylinux2010' }}
64+
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_img || 'manylinux2010' }}
65+
CIBW_TEST_REQUIRES: pytest
66+
CIBW_TEST_COMMAND: python -m pytest {project}/c {project}/testing
67+
run: |
68+
python -m pip install --upgrade "${{ matrix.cibw_version || 'cibuildwheel' }}"
69+
70+
# actually build libyaml + wheel (using env tweaks above)
71+
python -m cibuildwheel --output-dir dist .
72+
73+
74+
- name: upload artifacts
75+
uses: actions/upload-artifact@v2
76+
with:
77+
path: dist
78+
if-no-files-found: error
79+
80+
81+
macos:
82+
defaults:
83+
run:
84+
shell: ${{ matrix.run_wrapper || 'bash --noprofile --norc -eo pipefail {0}' }}
85+
runs-on: ${{ matrix.runs_on || 'macos-10.15' }}
86+
strategy:
87+
matrix:
88+
include:
89+
# build for x86_64 under the default hosted macOS 10.x x86_64 runner
90+
- spec: cp27-macosx_x86_64
91+
cibw_version: cibuildwheel<2.0 # py2.7 is not supported on CIBW 2.0+
92+
- spec: cp36-macosx_x86_64
93+
- spec: cp37-macosx_x86_64
94+
- spec: cp38-macosx_x86_64
95+
- spec: cp39-macosx_x86_64
96+
- spec: cp310-macosx_x86_64
97+
# build for arm64 under a hacked macOS 12 self-hosted x86_64-on-arm64 runner until arm64 is fully supported
98+
# FIXME: ? cp38-macosx_arm64 requires special handling and fails some test_zdist tests under cibw 2.1.2, skip it (so Apple's XCode python3 won't have a wheel)
99+
- spec: cp39-macosx_arm64
100+
deployment_target: '11.0'
101+
runs_on: [self-hosted, macOS]
102+
run_wrapper: arch -arm64 bash --noprofile --norc -eo pipefail {0}
103+
sdkroot: macosx11.3
104+
105+
- spec: cp310-macosx_arm64
106+
deployment_target: '11.0'
107+
runs_on: [self-hosted, macOS]
108+
run_wrapper: arch -arm64 bash --noprofile --norc -eo pipefail {0}
109+
sdkroot: macosx11.3
110+
steps:
111+
- name: clone repo
112+
uses: actions/checkout@v2
113+
114+
- name: build wheel prereqs
115+
run: |
116+
/usr/bin/pip3 install --user --upgrade "${{ matrix.cibw_version || 'cibuildwheel' }}"
117+
brew uninstall --ignore-dependencies libffi || true
118+
119+
- name: build/test wheels
120+
env:
121+
CIBW_BUILD: ${{ matrix.spec }}
122+
CIBW_TEST_REQUIRES: pytest
123+
CIBW_TEST_COMMAND: pip install pip --upgrade; cd {project}; pytest
124+
run: |
125+
if [[ -n "${{ matrix.deployment_target || '' }}" ]]
126+
then
127+
export MACOSX_DEPLOYMENT_TARGET="${{ matrix.deployment_target || '' }}"
128+
fi
129+
130+
if [[ -n "${{ matrix.sdkroot || '' }}" ]]
131+
then
132+
export SDKROOT="${{ matrix.sdkroot || '' }}"
133+
fi
134+
135+
/usr/bin/python3 -m cibuildwheel --output-dir dist
136+
137+
- name: upload artifacts
138+
uses: actions/upload-artifact@v2
139+
with:
140+
path: dist
141+
if-no-files-found: error
142+
143+
windows:
144+
runs-on: windows-2016
145+
strategy:
146+
matrix:
147+
include:
148+
- spec: cp27-win_amd64
149+
cibw_version: cibuildwheel==1.10 # last release with proper py2.7 Windows support
150+
- spec: cp36-win_amd64
151+
- spec: cp37-win_amd64
152+
- spec: cp38-win_amd64
153+
- spec: cp39-win_amd64
154+
- spec: cp310-win_amd64
155+
- spec: cp27-win32
156+
cibw_version: cibuildwheel==1.10 # last release with proper py2.7 Windows support
157+
- spec: cp36-win32
158+
- spec: cp37-win32
159+
- spec: cp38-win32
160+
- spec: cp39-win32
161+
- spec: cp310-win32
162+
steps:
163+
- name: clone repo
164+
uses: actions/checkout@v2
165+
166+
# HACK: MS killed this SDK support package and removed downloads, as did chocolatey, install from a private archive
167+
- name: install Windows Python 2.7 SDK
168+
run: |
169+
$msiPath = Join-Path ([IO.Path]::GetTempPath()) 'VCForPython27.msi'
170+
[Net.WebClient]::new().DownloadFile('https://raw.githubusercontent.com/nitzmahone/VCPython27/master/VCForPython27.msi', $msiPath)
171+
Start-Process -FilePath msiexec.exe -Wait -ArgumentList @(
172+
'/i',
173+
$msiPath,
174+
'/qn',
175+
'/norestart'
176+
)
177+
shell: powershell
178+
if: ${{ contains(matrix.spec, 'cp27') }}
179+
180+
- name: build/test wheels
181+
env:
182+
CIBW_BUILD: ${{ matrix.spec }}
183+
run: |
184+
python -m pip install --upgrade pip
185+
pip install "${{ matrix.cibw_version || 'cibuildwheel'}}"
186+
# FIXME: /testing takes ~45min on Windows and has some failures...
187+
# CIBW_TEST_REQUIRES=pytest CIBW_TEST_COMMAND='python -m pytest {project}/c {project}/testing' cibuildwheel --output-dir dist .
188+
CIBW_TEST_REQUIRES=pytest CIBW_TEST_COMMAND='python -m pytest {project}/c' cibuildwheel --output-dir dist .
189+
shell: bash
190+
191+
- name: upload artifacts
192+
uses: actions/upload-artifact@v2
193+
with:
194+
path: dist
195+
if-no-files-found: error

0 commit comments

Comments
 (0)