-
Notifications
You must be signed in to change notification settings - Fork 137
171 lines (148 loc) · 3.75 KB
/
build.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
159
160
161
162
163
164
165
166
167
168
169
170
171
name: build
on:
push:
tags:
- v*
branches:
- master
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
env:
STABLE_PYTHON_VERSION: "3.11"
CIBW_BUILD_FRONTEND: build
CIBW_TEST_COMMAND: >
python -c
"from pact import EachLike;
assert EachLike(1).generate() == {'json_class': 'Pact::ArrayLike', 'contents': 1, 'min': 1}
"
jobs:
build-x86_64:
name: Build wheels on ${{ matrix.os }} (x86, 64-bit)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
archs: x86_64
- os: macos-latest
archs: x86_64
- os: windows-latest
archs: AMD64
steps:
- uses: actions/checkout@v4
with:
# Fetch all tags
fetch-depth: 0
- name: Create wheels
uses: pypa/cibuildwheel@v2.15.0
env:
CIBW_ARCHS: ${{ matrix.archs }}
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: ./wheelhouse/*.whl
if-no-files-found: error
build-x86:
name: Build wheels on ${{ matrix.os }} (x86, 32-bit)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
archs: x86
steps:
- uses: actions/checkout@v4
with:
# Fetch all tags
fetch-depth: 0
- name: Create wheels
uses: pypa/cibuildwheel@v2.15.0
env:
CIBW_ARCHS: ${{ matrix.archs }}
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: ./wheelhouse/*.whl
if-no-files-found: error
build-arm64:
name: Build wheels on ${{ matrix.os }} (arm64)
runs-on: ${{ matrix.os }}
# As this requires emulation, it's not worth running on PRs
if: >-
github.event_name == 'push' &&
startsWith(github.event.ref, 'refs/tags')
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
archs: aarch64
build: '*manylinux*'
- os: macos-latest
archs: arm64
build: '*'
steps:
- uses: actions/checkout@v4
with:
# Fetch all tags
fetch-depth: 0
- name: Set up QEMU
if: matrix.os == 'ubuntu-latest'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Create wheels
uses: pypa/cibuildwheel@v2.15.0
env:
CIBW_ARCHS: ${{ matrix.archs }}
CIBW_BUILD: ${{ matrix.build }}
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: ./wheelhouse/*.whl
if-no-files-found: error
check:
name: Check wheels
needs:
- build-x86_64
- build-x86
- build-arm64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.STABLE_PYTHON_VERSION }}
- uses: actions/download-artifact@v3
with:
name: wheels
path: wheelhouse
- run: |
pipx run twine check --strict wheelhouse/*
publish:
name: Publish wheels
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
needs: [check]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifacts
path: wheelhouse
- name: Push build artifacts to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.10
with:
skip_existing: true
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}
packages-dir: wheelhouse