-
Notifications
You must be signed in to change notification settings - Fork 42
209 lines (176 loc) Β· 6.14 KB
/
publish.yaml
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
name: publish
on:
release:
types: [published] # Runs both for releases and prereleases
jobs:
test:
uses: google/temporian/.github/workflows/test.yaml@main
secrets: inherit
build-linux:
runs-on: ubuntu-latest
container: gcr.io/tfx-oss-public/manylinux2014-bazel:bazel-5.3.0
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v3 # v4 doesn't work on the container
- name: Build package
run: |
version="${{ matrix.python-version }}"
versionstr=${version//./}
PYTHON_VERSION=$versionstr ./tools/build_manylinux.sh
- name: Save package for following jobs
uses: actions/upload-artifact@v3
with:
name: dist-ubuntu-${{ matrix.python-version }}
path: dist
# macos-XXX-large are Intel runners, macos-XXX-xlarge are arm64 runners
# https://docs.github.com/en/actions/using-github-hosted-runners/about-larger-runners/about-larger-runners
build-macos-intel:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
platform:
[
{ runner: macos-12-large, artifact: macos12-intel },
{ runner: macos-13-large, artifact: macos13-intel },
{ runner: macos-14-large, artifact: macos14-intel },
]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: pip install poetry
- name: Build package
run: poetry build
- name: Save package for following jobs
uses: actions/upload-artifact@v3
with:
name: dist-${{ matrix.platform.artifact }}-${{ matrix.python-version }}
path: dist
build-macos-arm:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
platform:
[
# there is not runner for macos12 on arm
{ runner: macos-13-xlarge, artifact: macos-13-arm },
{ runner: macos-14-xlarge, artifact: macos-14-arm }
]
steps:
- name: Checkout
uses: actions/checkout@v4
# actions/setup-python doesn't support py < 3.10 on macos arm
# https://github.com/actions/setup-python/issues/696#issuecomment-1637587760
- name: Install Python
run: |
brew update
brew install python@${{ matrix.python-version }}
- name: Install pip
run: |
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python${{ matrix.python-version }} get-pip.py
- name: Install poetry
run: pip install poetry
- name: Build package
run: poetry build
- name: Save package for following jobs
uses: actions/upload-artifact@v3
with:
name: dist-${{ matrix.platform.artifact }}-${{ matrix.python-version }}
path: dist
test-install:
needs: [build-linux, build-macos-intel]
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
platform:
[
{ runner: ubuntu-latest, artifact: ubuntu },
{ runner: macos-12-large, artifact: macos12-intel },
{ runner: macos-13-large, artifact: macos13-intel },
{ runner: macos-14-large, artifact: macos14-intel },
]
runs-on: ${{ matrix.platform.runner }}
env:
# Workaround for macos pip compatibility issue
# See https://github.com/actions/setup-python/issues/469
SYSTEM_VERSION_COMPAT: 0
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Download build
uses: actions/download-artifact@v3
with:
name: dist-${{ matrix.platform.artifact }}-${{ matrix.python-version }}
path: dist
- name: Install from wheel
run: pip install dist/*.whl
- name: Test installation
run: python tools/check_install.py
test-macos-arm-install:
needs: [build-macos-arm]
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
platform:
[
{ runner: macos-13-xlarge, artifact: macos-13-arm },
{ runner: macos-14-xlarge, artifact: macos-14-arm }
]
runs-on: ${{ matrix.platform.runner }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Python
run: |
brew update
brew install python@${{ matrix.python-version }}
- name: Install pip
run: |
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python${{ matrix.python-version }} get-pip.py
- name: Download build
uses: actions/download-artifact@v3
with:
name: dist-${{ matrix.platform.artifact }}-${{ matrix.python-version }}
path: dist
- name: Install from wheel
run: pip install dist/*.whl
- name: Test installation
run: python${{ matrix.python-version }} tools/check_install.py
publish:
needs: [test, test-install, test-macos-arm-install]
runs-on: ubuntu-latest
environment: pypi
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install poetry
run: pip install poetry
- name: Download builds for all Python versions and platforms
uses: actions/download-artifact@v3
with:
# Skipping `name` key to download all artifacts from this workflow
# Artifacts are downloaded to dist/<artifact-name>
path: dist
- name: Move wheels and sources to dist/
run: |
mv dist/*/*.whl dist/
mv -n dist/*/*.tar.gz dist/
- name: Publish to PyPI
run: poetry publish --no-interaction --skip-existing