Skip to content

Commit 31e8d2e

Browse files
authored
chore(ci): cache vdev (#24103)
* chore(ci): cache vdev * fix cache key * vdev dep, implies rust dep
1 parent caf1592 commit 31e8d2e

File tree

5 files changed

+56
-5
lines changed

5 files changed

+56
-5
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "Install vdev"
2+
description: "Install vdev CLI tool with caching based on source code changes"
3+
4+
branding:
5+
icon: tool
6+
color: purple
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Cache vdev binary
12+
id: cache-vdev
13+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
14+
with:
15+
path: ~/.cargo/bin/vdev
16+
key: ${{ runner.os }}-vdev-${{ hashFiles('vdev/**', 'Cargo.toml', 'Cargo.lock') }}
17+
restore-keys: |
18+
${{ runner.os }}-vdev-
19+
20+
- name: Build and install vdev
21+
if: steps.cache-vdev.outputs.cache-hit != 'true'
22+
shell: bash
23+
run: |
24+
echo "Building vdev from source (cache miss)"
25+
cargo install --path vdev --locked

.github/actions/setup/action.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ inputs:
5858
required: false
5959
default: false
6060
description: "Install wasm-pack for Rust to WASM bridge."
61+
vdev:
62+
required: false
63+
default: false
64+
description: "Install vdev CLI tool (cached by vdev/ directory changes)."
6165

6266
# prepare.sh - npm
6367
markdownlint:
@@ -87,7 +91,8 @@ runs:
8791
"${{ inputs.cargo-deny }}" \
8892
"${{ inputs.cargo-msrv }}" \
8993
"${{ inputs.dd-rust-license-tool }}" \
90-
"${{ inputs.wasm-pack }}"; do
94+
"${{ inputs.wasm-pack }}" \
95+
"${{ inputs.vdev }}"; do
9196
if [[ "$val" == "true" ]]; then
9297
rust="true"
9398
break
@@ -201,6 +206,10 @@ runs:
201206
sudo cp "${TEMP}/cue" /usr/bin/cue
202207
rm -rf "$TEMP"
203208
209+
- name: Install vdev
210+
if: ${{ inputs.vdev == 'true' }}
211+
uses: ./.github/actions/install-vdev
212+
204213
- name: Run prepare.sh
205214
shell: bash
206215
run: |

.github/workflows/build-test-runner.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ jobs:
2828
with:
2929
ref: ${{ inputs.checkout_ref || inputs.commit_sha }}
3030

31+
- uses: ./.github/actions/setup
32+
with:
33+
vdev: true
34+
3135
- name: Login to GitHub Container Registry
3236
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
3337
with:
@@ -38,7 +42,7 @@ jobs:
3842
- name: Build and push integration test runner image
3943
run: |
4044
# Build integration test runner image with all-integration-tests feature
41-
cargo vdev int build
45+
vdev int build
4246
# Get rust version from rust-toolchain.toml (same as vdev does)
4347
RUST_VERSION=$(grep '^channel = ' rust-toolchain.toml | cut -d'"' -f2)
4448
LOCAL_IMAGE="vector-test-runner-${RUST_VERSION}:latest"

.github/workflows/changes.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,15 @@ jobs:
316316
steps:
317317
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
318318

319+
- uses: ./.github/actions/setup
320+
with:
321+
vdev: true
322+
319323
# creates a yaml file that contains the filters for each integration,
320324
# extracted from the output of the `vdev int ci-paths` command, which
321325
# sources the paths from the scripts/integration/.../test.yaml files
322326
- name: Create filter rules for integrations
323-
run: cargo vdev int ci-paths > int_test_filters.yaml
327+
run: vdev int ci-paths > int_test_filters.yaml
324328

325329
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
326330
id: filter
@@ -400,11 +404,15 @@ jobs:
400404
steps:
401405
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
402406

407+
- uses: ./.github/actions/setup
408+
with:
409+
vdev: true
410+
403411
# creates a yaml file that contains the filters for each test,
404412
# extracted from the output of the `vdev int ci-paths` command, which
405413
# sources the paths from the scripts/e2e/.../test.yaml files
406414
- name: Create filter rules for e2e tests
407-
run: cargo vdev e2e ci-paths > int_test_filters.yaml
415+
run: vdev e2e ci-paths > int_test_filters.yaml
408416

409417
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
410418
id: filter

.github/workflows/k8s_e2e.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,12 @@ jobs:
9797
- run: bash scripts/environment/prepare.sh --modules=rustup,cross
9898
- run: rustup target add x86_64-unknown-linux-gnu
9999
- run: echo "::add-matcher::.github/matchers/rust.json"
100-
- run: VECTOR_VERSION="$(cargo vdev version)" make package-deb-x86_64-unknown-linux-gnu
100+
101+
# TODO: Use the setup action in this workflow.
102+
- name: Install vdev
103+
uses: ./.github/actions/install-vdev
104+
105+
- run: VECTOR_VERSION="$(vdev version)" make package-deb-x86_64-unknown-linux-gnu
101106

102107
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
103108
with:

0 commit comments

Comments
 (0)