Skip to content

fix(deps): update rust crate quote to 1.0.42 #1326

fix(deps): update rust crate quote to 1.0.42

fix(deps): update rust crate quote to 1.0.42 #1326

permissions:
contents: read
on:
pull_request:
merge_group:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
name: Checks and tests
jobs:
codespell:
name: codespell
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Codespell test
uses: codespell-project/actions-codespell@94259cd8be02ad2903ba34a22d9c13de21a74461
cargo-fmt:
runs-on: ubuntu-latest
name: cargo fmt
steps:
- uses: actions/checkout@v4
- name: Obtain Rust version from project
run: |
RUST_VERSION=$(grep "rust-version" Cargo.toml | cut -d "=" -f2 | tr -d "[:space:]")
echo "RUST_VERSION=${RUST_VERSION}" >> $GITHUB_ENV
- name: Install Rust ${{ env.RUST_VERSION }}
uses: dtolnay/rust-toolchain@master
with:
components: rustfmt
toolchain: ${{ env.RUST_VERSION }}
- name: Check code formatting
run: cargo fmt --check
cargo-clippy:
runs-on: ubuntu-latest
name: cargo clippy
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@v4
- name: Obtain Rust version from project
run: |
RUST_VERSION=$(grep "rust-version" Cargo.toml | cut -d "=" -f2 | tr -d "[:space:]")
echo "RUST_VERSION=${RUST_VERSION}" >> $GITHUB_ENV
- name: Install Rust ${{ env.RUST_VERSION }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
components: clippy
- uses: actions/cache/restore@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-test-dev
- name: cargo clippy with compiler warnings
run: cargo clippy --workspace --all-targets -- -D warnings -D clippy::all
cargo-doc:
runs-on: ubuntu-latest
name: cargo doc
steps:
- uses: actions/checkout@v4
- name: Obtain Rust version from project
run: |
RUST_VERSION=$(grep "rust-version" Cargo.toml | cut -d "=" -f2 | tr -d "[:space:]")
echo "RUST_VERSION=${RUST_VERSION}" >> $GITHUB_ENV
- name: Install Rust ${{ env.RUST_VERSION }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Create documentation
run: cargo doc --no-deps --package newrelic_agent_control
env:
RUSTDOCFLAGS: --cfg docsrs
third-party-notices-check:
runs-on: ubuntu-latest
name: ⚖️ Check third party licenses
steps:
- uses: actions/checkout@v4
- name: Obtain Rust version from project
run: |
RUST_VERSION=$(grep "rust-version" Cargo.toml | cut -d "=" -f2 | tr -d "[:space:]")
echo "RUST_VERSION=${RUST_VERSION}" >> $GITHUB_ENV
- name: Install Rust ${{ env.RUST_VERSION }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Fetch dependencies
run: cargo fetch
- uses: newrelic/rust-licenses-noticer@v1
with:
template-file: THIRD_PARTY_NOTICES.md.tmpl
unused-dependencies-check:
name: cargo shear (unused dependencies)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@575f713d0233afba556737a7b85080563be14186
with:
tool: [email protected]
- run: cargo shear
coverage:
runs-on: ubuntu-latest
name: ubuntu / stable / coverage
steps:
- uses: actions/checkout@v4
- name: Obtain Rust version from project
run: |
RUST_VERSION=$(grep "rust-version" Cargo.toml | cut -d "=" -f2 | tr -d "[:space:]")
echo "RUST_VERSION=${RUST_VERSION}" >> $GITHUB_ENV
- name: Install Rust ${{ env.RUST_VERSION }}
uses: dtolnay/rust-toolchain@master
with:
components: llvm-tools-preview
toolchain: ${{ env.RUST_VERSION }}
- name: cargo install cargo-llvm-cov
uses: taiki-e/install-action@71765c00dd3e08a5484a5b9e82a4c88b86520e0e
# uses: taiki-e/install-action@cargo-llvm-cov
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- uses: actions/cache/restore@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-test-dev
- name: Generate coverage report
run: COVERAGE_OUT_FORMAT=json COVERAGE_OUT_FILEPATH=jcov.info make coverage
- name: Calculate and print total coverage
run: |
echo "Total functions coverage: $(jq '.data[].totals.functions.percent' jcov.info)"
echo "Total lines coverage: $(jq '.data[].totals.lines.percent' jcov.info)"
echo "Total regions coverage: $(jq '.data[].totals.regions.percent' jcov.info)"
echo "Total instantiations coverage: $(jq '.data[].totals.instantiations.percent' jcov.info)"
- name: Fail if function coverage is below 75%
run: |
fn_cov=$(jq '.data[].totals.functions.percent' jcov.info)
expected=75
if (( $(echo "$fn_cov < $expected" | bc -l) )); then
echo "Function coverage is below ${expected}%"
exit 1
fi
- name: Fail if line coverage is below 80%
run: |
ln_cov=$(jq '.data[].totals.lines.percent' jcov.info)
expected=80
if (( $(echo "$ln_cov < $expected" | bc -l) )); then
echo "Line coverage is below ${expected}%"
exit 1
fi
security:
uses: ./.github/workflows/component_security.yml
generate-release-build:
runs-on: ubuntu-latest
name: "Build release binaries"
steps:
- uses: actions/checkout@v4
- name: Obtain Rust version from project
run: |
RUST_VERSION=$(grep "rust-version" Cargo.toml | cut -d "=" -f2 | tr -d "[:space:]")
echo "RUST_VERSION=${RUST_VERSION}" >> $GITHUB_ENV
- name: Install Rust ${{ env.RUST_VERSION }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
targets: >-
x86_64-unknown-linux-musl
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-release
- name: Install Zig
uses: mlugg/setup-zig@v2
- name: Install cargo-zigbuild
run: |
cargo install --locked cargo-zigbuild --force
- name: Build k8s in release mode
run: cargo zigbuild --release --package newrelic_agent_control --bin newrelic-agent-control-k8s --target x86_64-unknown-linux-musl
- name: Build onhost in release mode
run: cargo zigbuild --release --package newrelic_agent_control --bin newrelic-agent-control --target x86_64-unknown-linux-musl
unit-docs-onhost-integration-tests:
runs-on: ubuntu-latest
name: Unit, docs and onhost integration tests
steps:
- uses: actions/checkout@v4
- name: Obtain Rust version from project
run: |
RUST_VERSION=$(grep "rust-version" Cargo.toml | cut -d "=" -f2 | tr -d "[:space:]")
echo "RUST_VERSION=${RUST_VERSION}" >> $GITHUB_ENV
- name: Install Rust ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
targets: >-
aarch64-unknown-linux-musl,
x86_64-unknown-linux-musl
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- uses: actions/cache/restore@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-test-dev
- name: Install Zig
uses: mlugg/setup-zig@v2
- name: Install cargo-zigbuild
run: |
cargo install --locked cargo-zigbuild --force
- name: Run workspace tests excluding the agent control package
run: cargo test --workspace --exclude 'newrelic_agent_control' --all-targets
- name: Run tests agent control lib excluding root-required tests (on-host)
run: make -C agent-control test/onhost
- name: Run tests agent control integration_test excluding root-required tests (on-host)
run: make -C agent-control test/onhost/integration
- name: Run tests agent control (k8s)
run: make -C agent-control test/k8s
- name: Run documentation tests
run: cargo test --locked --doc
# Test using root can be troublesome to perform as usually the Rust toolchain is installed local to the user.
# To test for root privileges, we can run from a container (disabling the test that fail if running non-root).
on-host-root-tests:
runs-on: ubuntu-latest
container: rust:latest
name: tests as root
steps:
- uses: actions/checkout@v4
- name: Obtain Rust version from project
run: |
RUST_VERSION=$(grep "rust-version" Cargo.toml | cut -d "=" -f2 | tr -d "[:space:]")
echo "RUST_VERSION=${RUST_VERSION}" >> $GITHUB_ENV
- name: Install Rust ${{ env.RUST_VERSION }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: actions/cache/restore@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-test-dev
- name: Run onHost root-required integration-tests only
run: make -C agent-control test/onhost/root/integration
embedded-downloader-tests:
name: Unit test for embedded downloader
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: "build/embedded/go.mod"
- name: run tests for embedded downloader
run: make -C build/embedded test
k8s-integration-tests:
name: K8s integration tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
group: [ part1, part2, flux-self-update ]
steps:
- uses: actions/checkout@v4
- name: Setup Minikube
uses: manusa/[email protected]
with:
minikube version: v1.35.0
kubernetes version: "v1.30.14"
driver: docker
github token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Tilt
run: |
curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | bash
- name: Obtain Rust version from project
run: |
RUST_VERSION=$(grep "rust-version" Cargo.toml | cut -d "=" -f2 | tr -d "[:space:]")
echo "RUST_VERSION=${RUST_VERSION}" >> $GITHUB_ENV
- name: Install Rust ${{ env.RUST_VERSION }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
targets: >-
x86_64-unknown-linux-musl
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-test-dev
- name: Install Zig
uses: mlugg/setup-zig@v2
- name: Install cargo-zigbuild
run: |
cargo install --locked cargo-zigbuild --force
- name: Run k8s integration tests
env:
# Tilt configs
ARCH: amd64
run: make -C agent-control test/k8s/integration-${{ matrix.group }}
k8s-e2e-tests:
uses: ./.github/workflows/component_k8s_e2e.yml
with:
scenarios: '["infra"]'
secrets:
E2E_ACCOUNT_ID: ${{ secrets.AC_PROD_E2E_ACCOUNT_ID }}
E2E_API_KEY: ${{ secrets.AC_PROD_E2E_API_KEY }}
E2E_LICENSE_KEY: ${{ secrets.AC_PROD_E2E_LICENSE_KEY }}
build-windows:
name: build-windows-binary
runs-on: windows-2025
steps:
- uses: actions/checkout@v4
- name: Obtain Rust version from project
shell: bash
run: |
RUST_VERSION=$(grep "rust-version" Cargo.toml | cut -d "=" -f2 | tr -d "[:space:]")
echo "RUST_VERSION=${RUST_VERSION}" >> $GITHUB_ENV
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-windows-release
- name: Install Rust ${{ env.RUST_VERSION }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Build
run: cargo build --all --release --target x86_64-pc-windows-msvc
- name: Test fs crate
run: cargo test --package fs
- name: Run tests agent control lib excluding root-required tests (on-host)
shell: bash
run: make -C agent-control test/onhost
check-all-green:
name: 🟢 All required checks and tests pass
if: always()
needs:
# checks
- cargo-clippy
- cargo-fmt
- cargo-doc
- third-party-notices-check
- unused-dependencies-check
- codespell
- security
- coverage
- build-windows
# tests
- generate-release-build
- unit-docs-onhost-integration-tests
- on-host-root-tests
- embedded-downloader-tests
- k8s-integration-tests
- k8s-e2e-tests
runs-on: Ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
# allowed-failures: docs, linters
# allowed-skips: non-voting-flaky-job
jobs: ${{ toJSON(needs) }}