-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathstatsig-python.yml
More file actions
207 lines (175 loc) · 6.31 KB
/
Copy pathstatsig-python.yml
File metadata and controls
207 lines (175 loc) · 6.31 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
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
# This file generated and copied from statsig-pyo3
# To update, see statsig-pyo3/.github/workflows/CI.yml
name: Statsig Python
on:
push:
branches:
- main
- master
tags:
- '*'
pull_request:
workflow_dispatch:
release:
types: [released, prereleased]
permissions:
contents: read
jobs:
linux:
strategy:
fail-fast: false
matrix:
config:
- distro: debian
arch: x86_64
arch_alias: amd64
runner: ubuntu-latest
always_build: true
- distro: debian
arch: aarch64
arch_alias: arm64
runner: statsig-ubuntu-arm64
always_build: true
- distro: alpine
arch: x86_64
arch_alias: amd64
runner: ubuntu-latest
always_build: true
- distro: alpine
arch: aarch64
arch_alias: arm64
runner: statsig-ubuntu-arm64
always_build: true
runs-on: ${{ matrix.config.runner }}
timeout-minutes: 15
env:
SHOULD_BUILD: ${{ github.ref_name == 'main' || matrix.config.always_build || github.event_name == 'release' }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: pnpm/action-setup@f40ffcd9367d9f12939873eb1018b921a783ffaa # v4
with:
version: 7.32.4
- name: Cache Cargo
uses: Swatinem/rust-cache@42dc69e1aa15d09112580998cf2ef0119e2e91ae # v2
- name: Install CLI Dependencies
run: cd cli && pnpm install
- name: Build Docker Image
if: ${{ env.SHOULD_BUILD == 'true' }}
id: build-docker-image
uses: ./.github/actions/build-docker-image
with:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_TOKEN }}
dockerfile_path: cli/src/docker/Dockerfile.${{ matrix.config.distro }}
docker_image_tag: statsig/server-core-${{ matrix.config.distro }}-${{ matrix.config.arch }}
gh_token: ${{ secrets.KONG_FINE_GRAINED_REPO_PAT }}
platform: linux/${{ matrix.config.arch_alias }}
- name: Build for Release
if: ${{ env.SHOULD_BUILD == 'true' }}
shell: 'script --return --quiet --log-out /dev/null --command "bash -e {0}"'
run: ./tore py-build --distro ${{ matrix.config.distro }} --arch ${{ matrix.config.arch }} --release --out dist --skip-docker-build
- name: Upload wheels
if: ${{ env.SHOULD_BUILD == 'true' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: wheels-${{ matrix.config.distro }}-${{ matrix.config.arch }}
if-no-files-found: error
path: statsig-pyo3/dist
macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-13
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: 3.x
- name: Cache Cargo
uses: Swatinem/rust-cache@42dc69e1aa15d09112580998cf2ef0119e2e91ae # v2
- name: Build wheels
uses: PyO3/maturin-action@423a6347767a8b16e65c2a7a7042e4a921528da8 # v1
with:
working-directory: statsig-pyo3
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: wheels-macos-${{ matrix.platform.target }}
if-no-files-found: error
path: statsig-pyo3/dist
windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: 3.x
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@423a6347767a8b16e65c2a7a7042e4a921528da8 # v1
with:
working-directory: statsig-pyo3
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: wheels-windows-${{ matrix.platform.target }}
if-no-files-found: error
path: statsig-pyo3/dist
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Build sdist
uses: PyO3/maturin-action@423a6347767a8b16e65c2a7a7042e4a921528da8 # v1
with:
working-directory: statsig-pyo3
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: wheels-sdist
if-no-files-found: error
path: statsig-pyo3/dist
release:
name: Release
runs-on: ubuntu-latest
needs: [linux, macos, windows, sdist]
if: ${{ github.event_name == 'release' }}
permissions:
id-token: write
contents: write
attestations: write
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
- name: Generate artifact attestation
uses: actions/attest-build-provenance@92c65d2898f1f53cfdc910b962cecff86e7f8fcc # v1
with:
subject-path: 'wheels-*/*'
- name: Publish to PyPI
uses: PyO3/maturin-action@423a6347767a8b16e65c2a7a7042e4a921528da8 # v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.STATSIG_PYPI_PROD_TOKEN }}
MATURIN_REPOSITORY: pypi
# MATURIN_PYPI_TOKEN: ${{ secrets.SIGTAT_PYPI_TEST_TOKEN }}
# MATURIN_REPOSITORY: testpypi
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*