Skip to content

feat(metrics): add node metrics collection and /metrics/nodes export #531

feat(metrics): add node metrics collection and /metrics/nodes export

feat(metrics): add node metrics collection and /metrics/nodes export #531

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
# All jobs run on ephemeral GitHub-hosted runners.
# Zero secrets, zero self-hosted runners — safe for fork PRs.
jobs:
deny:
runs-on: ubuntu-latest
env:
CARGO_DENY_VERSION: "0.19.6"
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
run: rustup show
- name: Install cargo-deny
run: |
curl -sL "https://github.com/EmbarkStudios/cargo-deny/releases/download/${CARGO_DENY_VERSION}/cargo-deny-${CARGO_DENY_VERSION}-x86_64-unknown-linux-musl.tar.gz" | tar xz -C /usr/local/bin --strip-components=1
- name: Check dependencies
run: cargo deny check
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
run: rustup show
- name: Check formatting
run: cargo fmt --all --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install protobuf compiler
run: sudo apt-get install -y protobuf-compiler
- name: Install Rust toolchain
run: rustup show
- name: Cache cargo registry and build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ github.job }}-
${{ runner.os }}-cargo-
- name: Clippy
run: cargo clippy --workspace --exclude spur-ffi --all-targets --locked
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install protobuf compiler
run: sudo apt-get install -y protobuf-compiler
- name: Install Rust toolchain
run: rustup show
- name: Cache cargo registry and build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ github.job }}-
${{ runner.os }}-cargo-
- name: Build all targets
run: cargo build --all-targets --locked
- name: Prepare K8s test binary
run: |
BIN=$(cargo test -p spur-tests --lib --no-run --message-format=json 2>/dev/null \
| jq -r 'select(.executable != null) | .executable' | head -1)
mkdir -p artifacts
cp "$BIN" artifacts/spur-k8s-tests
- name: Upload K8s test binary
uses: actions/upload-artifact@v7
with:
name: k8s-test-binary
path: artifacts/spur-k8s-tests
retention-days: 1
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install protobuf compiler
run: sudo apt-get install -y protobuf-compiler
- name: Install Rust toolchain
run: rustup show
- name: Cache cargo registry and build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ github.job }}-
${{ runner.os }}-cargo-
- name: Test
run: cargo test --locked
build-docker-image:
name: Build Docker Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build Docker image
uses: docker/build-push-action@v7
with:
context: .
file: deploy/Dockerfile
push: false
tags: spur:ci
outputs: type=docker,dest=/tmp/spur-image.tar
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Upload Docker image
uses: actions/upload-artifact@v7
with:
name: spur-image
path: /tmp/spur-image.tar
retention-days: 1
- name: Extract release binaries from image
run: |
docker load -i /tmp/spur-image.tar
CID=$(docker create spur:ci)
mkdir -p /tmp/release-binaries
for bin in spur spurctld spurd spurdbd spurrestd spur-k8s-operator; do
docker cp "$CID:/usr/local/bin/$bin" "/tmp/release-binaries/$bin"
done
docker rm "$CID"
- name: Upload release binaries
uses: actions/upload-artifact@v7
with:
name: release-binaries
path: /tmp/release-binaries/
retention-days: 1