Skip to content

Commit 3213acb

Browse files
feat: build caches nightly
1 parent 8fbfd54 commit 3213acb

File tree

2 files changed

+133
-1
lines changed

2 files changed

+133
-1
lines changed

.github/workflows/nightly.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,125 @@ permissions:
1212
contents: read
1313

1414
jobs:
15+
build-clean-caches-clippy:
16+
name: Build clean caches
17+
runs-on: ${{ matrix.os }}
18+
matrix:
19+
os: [ ubuntu-latest ]
20+
component: [ clippy ]
21+
steps:
22+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
23+
24+
- uses: ./.github/actions/install-rust-toolchain
25+
with:
26+
components: clippy
27+
28+
- uses: ./.github/actions/rust-cache
29+
with:
30+
identifier: 'clippy'
31+
restore-strategy: ${{ github.ref == 'refs/heads/main' && 'exact' || 'nearest' }}
32+
save-cache: true
33+
34+
- name: cargo clippy with compiler warnings
35+
run: cargo clippy --workspace --all-targets -- -D warnings -D clippy::all
36+
37+
build-clean-caches-test-dev:
38+
name: Build clean caches
39+
runs-on: ${{ matrix.os }}
40+
matrix:
41+
os: [ ubuntu-latest ]
42+
component: [ ]
43+
steps:
44+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
45+
46+
- uses: ./.github/actions/install-rust-toolchain
47+
48+
- uses: ./.github/actions/rust-cache
49+
with:
50+
identifier: 'test-dev'
51+
restore-strategy: ${{ github.ref == 'refs/heads/main' && 'exact' || 'nearest' }}
52+
save-cache: true
53+
54+
- name: Install Zig
55+
uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2
56+
57+
- name: cargo clippy with compiler warnings
58+
run: |
59+
cargo test --no-run --workspace --exclude 'newrelic_agent_control' --all-targets -- --include-ignored
60+
make -C agent-control test/cache
61+
62+
build-clean-caches-coverage:
63+
name: Build clean caches
64+
runs-on: ${{ matrix.os }}
65+
matrix:
66+
os: [ ubuntu-latest ]
67+
component: [ llvm-tools-preview ]
68+
steps:
69+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
70+
71+
- uses: ./.github/actions/install-rust-toolchain
72+
with:
73+
components: llvm-tools-preview
74+
75+
- name: cargo install cargo-llvm-cov
76+
uses: taiki-e/install-action@71765c00dd3e08a5484a5b9e82a4c88b86520e0e # 71765c00dd3e08a5484a5b9e82a4c88b86520e0e
77+
78+
- uses: ./.github/actions/rust-cache
79+
with:
80+
identifier: 'coverage'
81+
restore-strategy: ${{ github.ref == 'refs/heads/main' && 'exact' || 'nearest' }}
82+
save-cache: true
83+
84+
- name: Generate coverage report
85+
run: COVERAGE_OUT_FORMAT=json COVERAGE_OUT_FILEPATH=jcov.info make coverage
86+
87+
build-clean-caches-release:
88+
name: Build clean caches
89+
runs-on: ${{ matrix.os }}
90+
matrix:
91+
os: [ ubuntu-latest ]
92+
component: [ clippy ]
93+
steps:
94+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
95+
96+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
97+
with:
98+
go-version-file: 'build/embedded/go.mod'
99+
check-latest: true
100+
101+
- uses: ./.github/actions/install-rust-toolchain
102+
with:
103+
targets: >-
104+
aarch64-unknown-linux-musl,
105+
x86_64-unknown-linux-musl,
106+
x86_64-pc-windows-msvc
107+
108+
- name: Install Zig
109+
uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2
110+
111+
- name: Install cargo-zigbuild
112+
run: |
113+
cargo install --locked cargo-zigbuild --force
114+
115+
- name: Install Windows cross-compilation dependencies
116+
run: |
117+
sudo apt-get install -y llvm
118+
119+
- name: Install cargo-xwin
120+
run: |
121+
cargo install --locked cargo-xwin --force
122+
123+
- uses: ./.github/actions/rust-cache
124+
with:
125+
identifier: 'release'
126+
restore-strategy: ${{ github.ref == 'refs/heads/main' && 'exact' || 'nearest' }}
127+
save-cache: true
128+
129+
- name: Build k8s in release mode
130+
run: cargo zigbuild --release --package newrelic_agent_control --bin newrelic-agent-control-k8s --target x86_64-unknown-linux-musl
131+
- name: Build onhost in release mode
132+
run: cargo zigbuild --release --package newrelic_agent_control --bin newrelic-agent-control --target x86_64-unknown-linux-musl
133+
15134
build-packages:
16135
name: Build packages
17136
uses: ./.github/workflows/component_packages.yml

agent-control/Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
.DEFAULT_GOAL := onhost/cargo
22

33
CARGO_ARGS ?= ""
4-
CARGO_CMD ?= "test"
4+
CARGO_CMD ?= test
55
PACKAGE_SA = --locked --package newrelic_agent_control
66

77
TEST_FIXTURES = TEST_MACHINE_ID_PATH="/tmp/machine-id"
88

9+
.PHONY: test/cache
10+
test/cache:
11+
# Precompile all relevant tests by invoking existing targets with --no-run
12+
$(MAKE) CARGO_CMD="test --no-run" test/onhost
13+
$(MAKE) CARGO_CMD="test --no-run" test/onhost/integration
14+
$(MAKE) CARGO_CMD="test --no-run" test/onhost/root/integration
15+
$(MAKE) CARGO_CMD="test --no-run" test/k8s
16+
# K8s specific test binaries
17+
cargo test --no-run k8s::scenarios -- --nocapture --ignored --test-threads=10
18+
cargo test --no-run k8s::agent_control_cli -- --nocapture --ignored --test-threads=10
19+
cargo test --no-run k8s::flux_self_update -- --nocapture --ignored --test-threads=10
20+
cargo test k8s_ --no-run -- --skip k8s::scenarios --skip k8s::agent_control_cli --skip k8s::flux_self_update --nocapture --ignored --test-threads=10
21+
922
.PHONY: onhost/cargo
1023
onhost/cargo:
1124
@echo "testing-machine-id" > /tmp/machine-id

0 commit comments

Comments
 (0)