Skip to content

Commit 2b91886

Browse files
authored
ci(caching): switch to rust_cache for caching (#1342)
ci(caching): switch to rust_cache for caching Co-authored-by: bjorn.antonsson <[email protected]>
1 parent ccf7479 commit 2b91886

File tree

7 files changed

+63
-73
lines changed

7 files changed

+63
-73
lines changed

.github/actions/cache/action.yaml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/coverage.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
env:
1313
CARGO_TERM_COLOR: always
14+
CARGO_INCREMENTAL: 0
1415
steps:
1516
- name: Free Disk Space
1617
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
@@ -29,6 +30,11 @@ jobs:
2930
uses: taiki-e/install-action@2c41309d51ede152b6f2ee6bf3b71e6dc9a8b7df # 2.49.27
3031
with:
3132
33+
- name: Cache [rust]
34+
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1
35+
with:
36+
cache-targets: true # cache build artifacts
37+
cache-bin: true # cache the ~/.cargo/bin directory
3238
- name: Generate code coverage (including doc tests)
3339
run: |
3440
cargo llvm-cov --all-features --workspace --no-report nextest

.github/workflows/fuzz.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: Fuzz test
22
on:
33
push:
4-
54
jobs:
65
run-fuzz:
76
runs-on: ubuntu-latest
@@ -10,6 +9,7 @@ jobs:
109
directory: [libdd-alloc, libdd-profiling, libdd-common-ffi, libdd-trace-utils]
1110
env:
1211
CARGO_TERM_COLOR: always
12+
CARGO_INCREMENTAL: 0
1313
steps:
1414
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
1515
- name: Set up Rust
@@ -21,6 +21,11 @@ jobs:
2121
- uses: taiki-e/install-action@2c41309d51ede152b6f2ee6bf3b71e6dc9a8b7df # 2.49.27
2222
with:
2323
tool: cargo-bolero
24+
- name: Cache [rust]
25+
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1
26+
with:
27+
cache-targets: true # cache build artifacts
28+
cache-bin: true # cache the ~/.cargo/bin directory
2429
- run: |
2530
set -e
2631
# cargo bolero list outputs {"package":"package-name","test":"test-name"}

.github/workflows/lint.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,19 @@ jobs:
1616
shellcheck_opts: '-e SC2086'
1717
rustfmt:
1818
runs-on: ubuntu-latest
19+
env:
20+
CARGO_TERM_COLOR: always
21+
CARGO_INCREMENTAL: 0
1922
steps:
2023
- name: Checkout sources
2124
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
22-
- name: Cache
23-
uses: ./.github/actions/cache
2425
- name: Install nightly-2024-12-16 toolchain and rustfmt
2526
run: rustup install nightly-2024-12-16 && rustup default nightly-2024-12-16 && rustup component add rustfmt
27+
- name: Cache [rust]
28+
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1
29+
with:
30+
cache-targets: true # cache build artifacts
31+
cache-bin: true # cache the ~/.cargo/bin directory
2632
- run: cargo fmt --all -- --check
2733
clippy:
2834
name: "clippy #${{ matrix.platform }} ${{ matrix.rust_version }}"
@@ -35,12 +41,13 @@ jobs:
3541
steps:
3642
- name: Checkout sources
3743
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
38-
- name: Cache
39-
uses: ./.github/actions/cache
40-
with:
41-
rust_version: ${{ matrix.rust_version }}
4244
- name: Install ${{ matrix.rust_version }} toolchain and clippy
4345
run: rustup install ${{ matrix.rust_version }} && rustup default ${{ matrix.rust_version }} && rustup component add clippy
46+
- name: Cache [rust]
47+
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1
48+
with:
49+
cache-targets: true # cache build artifacts
50+
cache-bin: true # cache the ~/.cargo/bin directory
4451
- name: Run clippy on ${{ matrix.platform }} ${{ matrix.rust_version }}
4552
shell: bash
4653
run: |

.github/workflows/miri.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
partition: [1, 2, 3, 4, 5]
1111
env:
1212
CARGO_TERM_COLOR: always
13+
CARGO_INCREMENTAL: 0
1314
PROPTEST_CASES: 1
1415
steps:
1516
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
@@ -22,6 +23,11 @@ jobs:
2223
- uses: taiki-e/install-action@2c41309d51ede152b6f2ee6bf3b71e6dc9a8b7df # 2.49.27
2324
with:
2425
26+
- name: Cache [rust]
27+
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1
28+
with:
29+
cache-targets: true # cache build artifacts
30+
cache-bin: true # cache the ~/.cargo/bin directory
2531
- run: MIRIFLAGS="-Zmiri-disable-isolation" cargo miri nextest run --partition count:${{ matrix.partition }}/5
2632
# We need to disable isolation because
2733
# "unsupported operation: `clock_gettime` with `REALTIME` clocks not available when isolation is enabled"

.github/workflows/test.yml

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ jobs:
88
test:
99
name: "cargo test --workspace #${{ matrix.platform }} ${{ matrix.rust_version }}"
1010
runs-on: ${{ matrix.platform }}
11+
env:
12+
CARGO_TERM_COLOR: always
13+
CARGO_INCREMENTAL: 0
1114
strategy:
1215
matrix:
1316
platform: [windows-latest, ubuntu-latest, macos-15]
@@ -28,13 +31,8 @@ jobs:
2831
large-packages: true
2932
docker-images: false
3033
swap-storage: true
31-
3234
- name: Checkout sources
3335
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
34-
- name: Cache
35-
uses: ./.github/actions/cache
36-
with:
37-
rust_version: ${{ matrix.rust_version }}
3836
- name: Install Rust ${{ matrix.rust_version }}
3937
if: matrix.rust_version != ''
4038
run: rustup install ${{ matrix.rust_version }} && rustup default ${{ matrix.rust_version }}
@@ -45,6 +43,11 @@ jobs:
4543
uses: taiki-e/install-action@2c41309d51ede152b6f2ee6bf3b71e6dc9a8b7df # 2.49.27
4644
with:
4745
46+
- name: Cache [rust]
47+
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1
48+
with:
49+
cache-targets: true # cache build artifacts
50+
cache-bin: true # cache the ~/.cargo/bin directory
4851
- name: "Remove nextest CI report"
4952
shell: bash
5053
run: rm -rf target/nextest/ci/junit.xml
@@ -90,6 +93,9 @@ jobs:
9093
ffi:
9194
name: "FFI #${{ matrix.platform }} ${{ matrix.rust_version }}"
9295
runs-on: ${{ matrix.platform }}
96+
env:
97+
CARGO_TERM_COLOR: always
98+
CARGO_INCREMENTAL: 0
9399
strategy:
94100
matrix:
95101
platform: [windows-latest, ubuntu-latest, macos-15]
@@ -106,7 +112,6 @@ jobs:
106112
steps:
107113
- name: Checkout sources
108114
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
109-
110115
- name: Setup output dir
111116
shell: bash
112117
run: |
@@ -115,7 +120,6 @@ jobs:
115120
WORKSPACE_PATH=$(cygpath -ua '${{ github.workspace }}')
116121
fi
117122
echo "LIBDD_OUTPUT_FOLDER=$WORKSPACE_PATH/artifacts" >> $GITHUB_ENV
118-
119123
- name: Free Disk Space (Ubuntu only)
120124
if: runner.os == 'Linux' && matrix.platform == 'ubuntu-latest'
121125
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # 1.3.1
@@ -127,14 +131,6 @@ jobs:
127131
large-packages: false
128132
docker-images: false
129133
swap-storage: true
130-
131-
132-
- name: Cache
133-
uses: ./.github/actions/cache
134-
with:
135-
rust_version: ${{ matrix.rust_version }}
136-
build_profile: "release"
137-
138134
- name: Install Rust ${{ matrix.rust_version }}
139135
if: matrix.rust_version != ''
140136
run: rustup install ${{ matrix.rust_version }} && rustup default ${{ matrix.rust_version }}
@@ -143,13 +139,19 @@ jobs:
143139
# On Windows run happens in a PowerShell, so start bash explicitly
144140
run: bash -c 'echo "version=$(rustc --version)" >> $GITHUB_OUTPUT'
145141

142+
- name: Cache [rust]
143+
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1
144+
env:
145+
RUSTFLAGS: "${{ matrix.flags }}"
146+
with:
147+
cache-targets: true # cache build artifacts
148+
cache-bin: true # cache the ~/.cargo/bin directory
146149
- name: "Generate profiling FFI"
147150
shell: bash
148151
env:
149152
RUSTFLAGS: "${{ matrix.flags }}"
150153
run: |
151154
cargo run --bin release --release -- --out $LIBDD_OUTPUT_FOLDER
152-
153155
- name: 'Publish libdatadog'
154156
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1
155157
# Only upload the artifacts built with the default Rust version
@@ -159,7 +161,6 @@ jobs:
159161
name: libdatadog.${{ matrix.platform }}
160162
path: ${{ github.workspace }}/artifacts
161163
retention-days: 1
162-
163164
- name: "(Windows) Test building Profiling C bindings - dynamic link vc runtime"
164165
if: matrix.platform == 'windows-latest'
165166
shell: bash
@@ -170,7 +171,6 @@ jobs:
170171
cd examples/ffi/build_dll
171172
cmake -S .. -DDatadog_ROOT=$LIBDD_OUTPUT_FOLDER -DVCRUNTIME_LINK_TYPE=DLL
172173
cmake --build .
173-
174174
- name: "(Windows) Test building Profiling C bindings - static link vc runtime"
175175
if: matrix.platform == 'windows-latest'
176176
shell: bash
@@ -181,7 +181,6 @@ jobs:
181181
cd examples/ffi/build_static
182182
cmake -S .. -DDatadog_ROOT=$LIBDD_OUTPUT_FOLDER -DVCRUNTIME_LINK_TYPE=STATIC
183183
cmake --build .
184-
185184
- name: "Test building Profiling C bindings"
186185
shell: bash
187186
if: matrix.platform != 'windows-latest'
@@ -219,10 +218,11 @@ jobs:
219218
swap-storage: true
220219
- name: Checkout
221220
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
222-
- name: Cache
223-
uses: ./.github/actions/cache
221+
- name: Cache [rust]
222+
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1
224223
with:
225-
rust_version: cross-centos7
224+
cache-targets: true # cache build artifacts
225+
cache-bin: true # cache the ~/.cargo/bin directory
226226
- run: cargo install cross || true
227227
- run: cross build --workspace --target x86_64-unknown-linux-gnu --exclude builder
228228
- run: cross test --workspace --features libdd-crashtracker/generate-unit-test-files --target x86_64-unknown-linux-gnu --exclude builder -- --skip "::single_threaded_tests::" --skip "tracing_integration_tests::"
@@ -233,25 +233,20 @@ jobs:
233233
matrix:
234234
target: [alpine-build] # debian-build-aarch64 is oom killed at the moment
235235
name: "FFI ${{ matrix.target }} via docker bake"
236-
237236
concurrency:
238237
group: ci-${{ github.ref }}-${{ matrix.target }}
239238
cancel-in-progress: true
240-
241239
runs-on:
242240
labels: ubuntu-latest-16-cores
243241
group: APM Larger Runners
244242
steps:
245-
-
246-
name: Checkout
243+
- name: Checkout
247244
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
248-
-
249-
name: Set up Docker Buildx
245+
- name: Set up Docker Buildx
250246
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # 3.10.0
251247
with:
252248
buildkitd-config: .github/buildkitd-16-cores.toml
253-
-
254-
name: Build and Generate FFI
249+
- name: Build and Generate FFI
255250
uses: docker/bake-action@4ba453fbc2db7735392b93edf935aaf9b1e8f747 # 6.5.0
256251
with:
257252
targets: ${{ matrix.target }}

.github/workflows/verify-proto-files.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: 'Verify trace-protobuf'
22
on:
33
pull_request:
44
types: [ opened, synchronize, reopened ]
5-
65
env:
76
DATADOG_AGENT_TAG: "7f6d07c93ba087f23f80a3f0c2da4b1f3dc664d7"
87
rust_version: "1.84.1"
9-
8+
CARGO_TERM_COLOR: always
9+
CARGO_INCREMENTAL: 0
1010
jobs:
1111
verify-proto-files:
1212
name: "Verify trace-protobuf .proto files are in sync with datadog-agent"
@@ -45,12 +45,13 @@ jobs:
4545
working-directory: libdd-trace-protobuf/src/pb
4646
run: |
4747
../../../.github/workflows/diff-proto-files.sh --file idx/span.proto --tag ${{ env.DATADOG_AGENT_TAG }}
48-
- name: Cache
49-
uses: ./.github/actions/cache
50-
with:
51-
rust_version: ${{ env.rust_version }}
5248
- name: Install ${{ env.rust_version }} toolchain
5349
run: rustup install ${{ env.rust_version }} && rustup default ${{ env.rust_version }}
50+
- name: Cache [rust]
51+
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1
52+
with:
53+
cache-targets: true # cache build artifacts
54+
cache-bin: true # cache the ~/.cargo/bin directory
5455
- name: diff pb.rs
5556
working-directory: libdd-trace-protobuf
5657
run: |

0 commit comments

Comments
 (0)