-
Notifications
You must be signed in to change notification settings - Fork 123
263 lines (248 loc) · 9.51 KB
/
per-pr.yml
File metadata and controls
263 lines (248 loc) · 9.51 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
name: Per merge CI
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- master
permissions:
contents: read
actions: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-and-lint:
name: "Format, docs, and lint"
timeout-minutes: ${{ github.ref == 'refs/heads/master' && 15 || 10 }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
# TODO: Upgrade proto once https://github.com/arduino/setup-protoc/issues/99 is fixed
version: "23.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: rustup component add rustfmt clippy
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/master' }}
- run: cargo fmt --all --check
- run: cargo doc --workspace --all-features --no-deps
env:
RUSTDOCFLAGS: "-D warnings"
- run: cargo lint
- run: cargo test-lint
- run: cargo check
- run: git diff --exit-code
test:
name: Unit Tests
# Give extra time to ensure pushes to main have time to populate the cache
timeout-minutes: ${{ github.ref == 'refs/heads/master' && 20 || 15 }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest]
include:
- os: windows-latest
- os: ubuntu-latest
- os: ubuntu-arm
runsOn: ubuntu-24.04-arm64-2-core
- os: macos-arm
runsOn: macos-14
- os: macos-intel
runsOn: macos-15-intel
runs-on: ${{ matrix.runsOn || matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
# TODO: Upgrade proto once https://github.com/arduino/setup-protoc/issues/99 is fixed
version: "23.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Workaround for https://github.com/actions/runner-images/issues/12432
# from https://github.com/rust-lang/rust/issues/141626#issuecomment-2919419236
# Visual Studio bug tracker https://developercommunity.visualstudio.com/t/Regression-from-1943:-linkexe-crashes/10912960
- name: Setup RUSTFLAGS (Windows)
if: runner.os == 'Windows'
uses: actions/github-script@v7
with:
script: |
core.exportVariable('RUSTFLAGS', '-Csymbol-mangling-version=v0');
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/master' }}
- run: cargo test -- --include-ignored --nocapture
- name: Find test executable for cgroup tests
id: find-cgroup-test
if: runner.os == 'Linux' && runner.arch == 'X64'
run: |
test_executable=$(cargo build --tests --message-format json | jq -r 'select(.profile?.test == true and .target?.name == "temporalio_sdk_core" and .executable) | .executable')
cp $test_executable ./core-tests
- name: Upload cgroup test executable
uses: actions/upload-artifact@v4
if: runner.os == 'Linux' && runner.arch == 'X64'
with:
name: cgroup-tests-linux-x86_64
path: ./core-tests
- uses: actions/upload-artifact@v4
with:
name: coverage-report
path: tarpaulin-report.html
- uses: actions/upload-artifact@v4
with:
name: state-machine-coverage
path: machine_coverage/
msrv:
name: "Verify MSRV"
timeout-minutes: ${{ github.ref == 'refs/heads/master' && 15 || 10 }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
# TODO: Upgrade proto once https://github.com/arduino/setup-protoc/issues/99 is fixed
version: "23.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: rustup component add rustfmt clippy
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/master' }}
key: msrv
- run: cargo install cargo-msrv
- run: cargo msrv verify
working-directory: ./crates/sdk-core
cgroup-tests:
name: cgroup tests
needs: test
runs-on: ubuntu-latest
container:
image: ubuntu
options: --cpus=1 --memory=512m
env:
CGROUP_TESTS_ENABLED: true
steps:
- name: Download cgroup test executable
uses: actions/download-artifact@v5
with:
name: cgroup-tests-linux-x86_64
- name: Run tests
run: |
chmod +x ./core-tests
./core-tests cgroup_ --nocapture
integ-tests:
name: Integ tests
timeout-minutes: ${{ github.ref == 'refs/heads/master' && 30 || 25 }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest]
include:
- os: windows-latest
- os: ubuntu-latest
- os: ubuntu-arm
runsOn: ubuntu-24.04-arm64-2-core
- os: macos-arm
runsOn: macos-14
- os: macos-intel
runsOn: macos-15-intel
runs-on: ${{ matrix.runsOn || matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
# TODO: Upgrade proto once https://github.com/arduino/setup-protoc/issues/99 is fixed
version: "23.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Workaround for https://github.com/actions/runner-images/issues/12432
# from https://github.com/rust-lang/rust/issues/141626#issuecomment-2919419236
# Visual Studio bug tracker https://developercommunity.visualstudio.com/t/Regression-from-1943:-linkexe-crashes/10912960
- name: Setup RUSTFLAGS (Windows)
if: runner.os == 'Windows'
uses: actions/github-script@v7
with:
script: |
core.exportVariable('RUSTFLAGS', '-Csymbol-mangling-version=v0');
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/master' }}
- run: cargo integ-test
cloud-tests:
if: github.event.pull_request.head.repo.full_name == '' || github.event.pull_request.head.repo.full_name == 'temporalio/sdk-core'
name: Cloud tests
env:
TEMPORAL_CLOUD_ADDRESS: https://${{ vars.TEMPORAL_CLIENT_NAMESPACE }}.tmprl.cloud:7233
TEMPORAL_NAMESPACE: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }}
TEMPORAL_CLIENT_CERT: ${{ secrets.TEMPORAL_CLIENT_CERT }}
TEMPORAL_CLIENT_KEY: ${{ secrets.TEMPORAL_CLIENT_KEY }}
timeout-minutes: ${{ github.ref == 'refs/heads/master' && 25 || 20 }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
# TODO: Upgrade proto once https://github.com/arduino/setup-protoc/issues/99 is fixed
version: "23.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/master' }}
- run: cargo test --features=test-utilities --test cloud_tests
docker-integ-tests:
name: Docker integ tests
env:
TEMPORAL_CLOUD_ADDRESS: https://${{ vars.TEMPORAL_CLIENT_NAMESPACE }}.tmprl.cloud:7233
TEMPORAL_CLOUD_NAMESPACE: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }}
TEMPORAL_CLIENT_CERT: ${{ secrets.TEMPORAL_CLIENT_CERT }}
TEMPORAL_CLIENT_KEY: ${{ secrets.TEMPORAL_CLIENT_KEY }}
DOCKER_PROMETHEUS_RUNNING: true
timeout-minutes: ${{ github.ref == 'refs/heads/master' && 25 || 20 }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
# TODO: Upgrade proto once https://github.com/arduino/setup-protoc/issues/99 is fixed
version: "23.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Start container for otel-collector and prometheus
uses: hoverkraft-tech/compose-action@v2.0.1
with:
compose-file: ./etc/docker/docker-compose-ci.yaml
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/master' }}
- run: cargo integ-test docker_
c-bridge-static-link-test:
name: "C bridge static link test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
# TODO: Upgrade proto once https://github.com/arduino/setup-protoc/issues/99 is fixed
version: "23.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build crate as static library
run: cargo rustc --package temporalio-sdk-core-c-bridge --features xz2-static -- --crate-type=staticlib
- name: Build C test program
run: gcc -I./crates/sdk-core-c-bridge/include crates/sdk-core/tests/c_bridge_smoke_test.c target/debug/deps/libtemporalio_sdk_core_c_bridge.a -lpthread -ldl -lm -o test
- name: Run C test program
run: ./test