-
-
Notifications
You must be signed in to change notification settings - Fork 5
277 lines (215 loc) · 8.49 KB
/
Copy pathci.yml
File metadata and controls
277 lines (215 loc) · 8.49 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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
name: CI
on:
push:
branches:
- main
- release/**
- release-library/**
pull_request:
env:
CARGO_TERM_COLOR: always
permissions:
id-token: write
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Install Rust Toolchain
run: |
rustup toolchain install stable --profile minimal --no-self-update
rustup component add clippy rustfmt rust-docs --toolchain stable
- name: Install protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
with:
key: ${{ github.job }}
- name: Format
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --workspace --all-targets --all-features --no-deps -- -D warnings
- name: Docs
run: cargo doc --workspace --all-features --no-deps --document-private-items
env:
RUSTDOCFLAGS: -Dwarnings
lint-python:
name: Lint Python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: astral-sh/setup-uv@5a7eac68fb9809dea845d802897dc5c723910fa3 # v7.1.3
- name: Install dependencies
run: uv sync --all-packages --all-groups
- name: Format
run: uv run ruff format
- name: Lint
run: uv run ruff check
- name: Run mypy
run: uv run mypy .
test-all:
name: Test (all features)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Start Bigtable Emulator
run: |
docker run -d \
--name bigtable-emulator \
-p 8086:8086 \
-e BIGTABLE_EMULATOR_HOST=localhost:8086 \
-v $PWD/devservices/run-bigtable.sh:/run-bigtable.sh \
google/cloud-sdk \
/run-bigtable.sh
- name: Build GCS Emulator
run: |
docker build -t gcs-emulator-local https://github.com/getsentry/google-cloud-storage-testbench.git#main
- name: Start GCS Emulator
run: |
docker run -d \
--name gcs-emulator \
-p 8087:9000 \
-e GOOGLE_CLOUD_CPP_STORAGE_TEST_BUCKET_NAME=test-bucket \
gcs-emulator-local
- name: Start MinIO
run: |
docker run -d \
--name minio \
-p 8089:9000 \
--entrypoint /run-minio.sh \
-v $PWD/devservices/run-minio.sh:/run-minio.sh \
minio/minio
- name: Install Rust Toolchain
run: |
rustup toolchain install stable --profile minimal --no-self-update
rustup component add llvm-tools-preview
- name: Install protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
with:
key: ${{ github.job }}
- uses: taiki-e/install-action@cargo-llvm-cov
- name: Run tests with coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info --locked
- name: Upload Rust coverage
uses: codecov/codecov-action@v5
continue-on-error: true
with:
files: lcov.info
flags: rust
use_oidc: true
test-python:
name: Test Python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Install Rust Toolchain
run: |
rustup toolchain install stable --profile minimal --no-self-update
- name: Install protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
- name: Build server binary
run: cargo build --locked
- uses: astral-sh/setup-uv@5a7eac68fb9809dea845d802897dc5c723910fa3 # v7.1.3
- name: Install dependencies
run: uv sync --all-packages --all-groups
- name: Run tests with coverage
run: uv run pytest clients/python --cov=clients/python/src --cov-report=xml:python-coverage.xml
- name: Upload Python coverage
uses: codecov/codecov-action@v5
continue-on-error: true
with:
files: python-coverage.xml
flags: python
use_oidc: true
docs:
name: Build and Publish Documentation
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Install Rust Toolchain
run: rustup toolchain install stable --profile minimal --component rust-docs --no-self-update
- name: Install protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
with:
key: ${{ github.job }}
- name: Build Rust Docs
run: |
cargo doc --workspace --all-features --no-deps
echo '<meta http-equiv="refresh" content="0; url=objectstore/" />Redirecting to <a href="objectstore/">objectstore</a>' > target/doc/index.html
env:
RUSTDOCFLAGS: -Dwarnings
- uses: astral-sh/setup-uv@5a7eac68fb9809dea845d802897dc5c723910fa3 # v7.1.3
- name: Install Python dependencies
run: uv sync --all-packages --all-groups
- name: Build Python Docs
run: |
mkdir -p docs/_build
uv run sphinx-apidoc -o clients/python/docs/ clients/python/src/ --force --module-first --no-toc
uv run sphinx-build -vv -W -b html clients/python/docs/ docs/_build
- name: Setup combined docs directory
run: |
mkdir -p gh-pages/rust
mkdir -p gh-pages/python
cp -r target/doc/* gh-pages/rust/
cp -r docs/_build/* gh-pages/python/
cp docs/index.html gh-pages/index.html
- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
- name: Upload artifact
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
with:
path: "gh-pages"
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
if: github.ref == 'refs/heads/main'
validate_gocd:
if: ${{ !startsWith(github.ref, 'refs/heads/release/') && !startsWith(github.ref, 'refs/heads/release-library/') }}
name: Validate GoCD Pipelines
runs-on: ubuntu-latest
permissions:
contents: "read"
id-token: "write"
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: getsentry/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
id: changes
with:
filters: |
gocd:
- 'gocd/**'
- id: "auth"
if: steps.changes.outputs.gocd == 'true'
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0
with:
workload_identity_provider: "projects/868781662168/locations/global/workloadIdentityPools/prod-github/providers/github-oidc-pool"
service_account: "gha-gocd-api@sac-prod-sa.iam.gserviceaccount.com"
token_format: "id_token"
id_token_audience: "610575311308-9bsjtgqg4jm01mt058rncpopujgk3627.apps.googleusercontent.com"
id_token_include_email: true
- uses: getsentry/action-gocd-jsonnet@3aec6fd54ac8d2fecfe700360f5d020e6902ba2d # v1.1.0
if: steps.changes.outputs.gocd == 'true'
with:
jb-install: true
jsonnet-dir: gocd/templates
generated-dir: gocd/generated-pipelines
- uses: getsentry/action-validate-gocd-pipelines@5662a2b631d4e2aa1bfc21e878f9e131c31c40c1 # v1.0.0
if: steps.changes.outputs.gocd == 'true'
with:
configrepo: objectstore__main
gocd_access_token: ${{ secrets.GOCD_ACCESS_TOKEN }}
google_oidc_token: ${{ steps.auth.outputs.id_token }}