forked from spiceai/spiceai
-
Notifications
You must be signed in to change notification settings - Fork 0
257 lines (224 loc) · 8.81 KB
/
pr.yml
File metadata and controls
257 lines (224 loc) · 8.81 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
---
name: pr
on:
pull_request:
branches:
- trunk
- release-*
- release/*
- feature-*
merge_group:
branches:
- trunk
- release-*
- release/*
- feature-*
workflow_dispatch:
inputs:
profile_option:
description: 'Which Rust build profile to use? (Default is lint)'
required: false
type: choice
options:
- 'lint'
- 'release'
- 'release-lto'
default: 'lint'
update_snapshots:
description: 'Update the snapshots?'
required: false
default: 'no'
type: choice
options:
- 'always'
- 'no'
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'trunk' && github.sha || 'any-sha' }}
cancel-in-progress: true
env:
IGNORED_PATHS: '(^./docs/|^README.md$|^version.txt$|^acknowledgements.md$)'
RUST_PROFILE: ${{ github.event.inputs.profile_option || 'lint' }}
# CI performance optimizations
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
CARGO_NET_RETRY: 10
CARGO_HTTP_TIMEOUT: 60
CARGO_INCREMENTAL: 0
CARGO_NET_GIT_FETCH_WITH_CLI: true
# Use fast linkers for PR builds (mold for x86_64, lld for aarch64)
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: clang
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS: -C link-arg=-fuse-ld=mold
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: clang
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS: -C link-arg=-fuse-ld=lld
jobs:
# `pr` is a required check for pull requests. Therefore we cannot skip the workflow via
# `on.pull_requests.paths-ignore`. Instead, we conditionally run the jobs (which report
# a success when skipped).
check_changes:
runs-on: spiceai-dev-runners
outputs:
relevant_changes: ${{ steps.check.outputs.relevant_changes }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
# Use fetch-depth 2 for PR change detection (dorny/paths-filter only needs base + head)
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
- name: Check for code changes
id: check
uses: ./.github/actions/check-code-changes
- name: Validate datafusion-table-providers commit
run: bash .github/scripts/validate_table_providers_commit.sh
env:
BRANCH: spiceai-52
# Run Rust linting
lint-rust:
name: Rust Lint
runs-on: spiceai-dev-runners
needs: check_changes
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
if: needs.check_changes.outputs.relevant_changes == 'true'
with:
fetch-depth: 1
- name: Cache Cargo registry
if: needs.check_changes.outputs.relevant_changes == 'true'
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Set up Rust
if: needs.check_changes.outputs.relevant_changes == 'true'
uses: ./.github/actions/setup-rust
- name: Set up sccache
if: needs.check_changes.outputs.relevant_changes == 'true'
uses: ./.github/actions/setup-sccache
with:
minio_endpoint: ${{ secrets.TEST_MINIO_ENDPOINT }}
- name: Install Protoc
if: needs.check_changes.outputs.relevant_changes == 'true'
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up make
if: needs.check_changes.outputs.relevant_changes == 'true'
uses: ./.github/actions/setup-make
- name: Set up cc
if: needs.check_changes.outputs.relevant_changes == 'true'
uses: ./.github/actions/setup-cc
- name: Run Rust lint
if: needs.check_changes.outputs.relevant_changes == 'true'
run: make lint-rust
env:
RUSTC_WRAPPER: ${{ env.RUSTC_WRAPPER }}
AWS_ACCESS_KEY_ID: ${{ secrets.TEST_MINIO_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_MINIO_SECRET_KEY }}
RUST_PROFILE: ${{ env.RUST_PROFILE }}
- name: Cancel workflow on failure
if: failure()
run: gh run cancel ${{ github.run_id }}
env:
GH_TOKEN: ${{ github.token }}
- name: Show sccache stats
if: ${{ needs.check_changes.outputs.relevant_changes == 'true' && env.SCCACHE_SETUP == 'true' }}
run: sccache --show-stats
# Build and test
build-test:
name: Build and Test
runs-on: spiceai-dev-runners
needs: [check_changes]
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
if: needs.check_changes.outputs.relevant_changes == 'true'
with:
fetch-depth: 1
- name: Cache Cargo registry
if: needs.check_changes.outputs.relevant_changes == 'true'
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Set up Rust
if: needs.check_changes.outputs.relevant_changes == 'true'
uses: ./.github/actions/setup-rust
- name: Set up Nextest
if: needs.check_changes.outputs.relevant_changes == 'true'
uses: ./.github/actions/setup-nextest
- name: Check if sccache can be set up
run: |
if [ -z "${{ secrets.TEST_MINIO_ENDPOINT }}" ]; then
echo "SCCACHE_SETUP=false" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=" >> $GITHUB_ENV
else
echo "SCCACHE_SETUP=true" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
fi
- name: Set up sccache
if: ${{ needs.check_changes.outputs.relevant_changes == 'true' && env.SCCACHE_SETUP == 'true' }}
uses: ./.github/actions/setup-sccache
with:
minio_endpoint: ${{ secrets.TEST_MINIO_ENDPOINT }}
- name: Install Protoc
if: needs.check_changes.outputs.relevant_changes == 'true'
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up make
if: needs.check_changes.outputs.relevant_changes == 'true'
uses: ./.github/actions/setup-make
- name: Set up cc
if: needs.check_changes.outputs.relevant_changes == 'true'
uses: ./.github/actions/setup-cc
- name: Build CLI and run nextest
if: needs.check_changes.outputs.relevant_changes == 'true'
run: make build-cli nextest
env:
RUSTC_WRAPPER: ${{ env.RUSTC_WRAPPER }}
AWS_ACCESS_KEY_ID: ${{ secrets.TEST_MINIO_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_MINIO_SECRET_KEY }}
RUST_PROFILE: ${{ env.RUST_PROFILE }}
AWS_S3_CLIENT_ID: ${{ secrets.AWS_S3_CLIENT_ID }}
AWS_S3_IDENTITY_POOL_ID: ${{ secrets.AWS_S3_IDENTITY_POOL_ID }}
AWS_S3_USERNAME: ${{ secrets.AWS_S3_USERNAME }}
AWS_S3_PASSWORD: ${{ secrets.AWS_S3_PASSWORD }}
AWS_COGNITO_IDP_URI: ${{ vars.AWS_COGNITO_IDP_URI }}
AWS_REGION: ${{ vars.AWS_REGION }}
AWS_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }}
INSTA_UPDATE: ${{ github.event.inputs.update_snapshots || 'no' }}
- name: Cancel workflow on failure
if: failure()
run: gh run cancel ${{ github.run_id }}
env:
GH_TOKEN: ${{ github.token }}
- name: Build testoperator
if: needs.check_changes.outputs.relevant_changes == 'true'
env:
RUSTC_WRAPPER: ${{ env.RUSTC_WRAPPER }}
AWS_ACCESS_KEY_ID: ${{ secrets.TEST_MINIO_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_MINIO_SECRET_KEY }}
run: cargo build -p testoperator --all-features --locked
- name: Show sccache stats
if: ${{ needs.check_changes.outputs.relevant_changes == 'true' && env.SCCACHE_SETUP == 'true' }}
run: sccache --show-stats
- name: Check if Cargo.lock is updated
if: needs.check_changes.outputs.relevant_changes == 'true'
run: |
if git diff --exit-code Cargo.lock; then
echo "Cargo.lock is up to date"
else
echo "Update Cargo.lock"
exit 1
fi
- name: Push snapshots to branch
if: github.event.inputs.update_snapshots == 'always'
uses: ./.github/actions/push-snap-changes
with:
token: ${{ secrets.GITHUB_TOKEN }}