Skip to content

chore: release (#6) #76

chore: release (#6)

chore: release (#6) #76

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
# Build and test on native targets that developers use locally.
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: aarch64-apple-darwin
steps:
- uses: actions/checkout@v4
# rdkafka (spear-lib) requires cmake + curl headers on Linux.
# header-gen is excluded from this job and tested separately in test-header-gen.
- name: Install build dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y cmake libcurl4-openssl-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-
- name: Build
run: cargo build --release --target ${{ matrix.target }} --workspace --exclude header-gen
- name: Test
run: cargo test --release --target ${{ matrix.target }} --workspace --exclude header-gen
# Verify the musl target compiles on every push so issues don't
# surface for the first time during a release build.
#
# spear-gen is pure Rust so musl-tools is sufficient here.
# NOTE: when spear-gateway is added, this job will also need
# cmake + libcurl4-openssl-dev (same as the test job above).
check-musl:
name: Check (x86_64-unknown-linux-musl)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install musl tools
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: musl-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
musl-cargo-
- name: Check (musl)
run: cargo check --target x86_64-unknown-linux-musl -p spear-gen
# Build and test header-gen on Linux where libclang is available.
# header-gen is excluded from the matrix `test` job above because macOS
# runners don't ship with libclang; it gets full test coverage here instead.
test-header-gen:
name: Test header-gen (Linux x86_64)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install libclang/LLVM dev packages
run: sudo apt-get update && sudo apt-get install -y llvm-dev libclang-dev clang
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: header-gen-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
header-gen-cargo-
- name: Test header-gen
run: |
LLVM_CONFIG=$(ls /usr/bin/llvm-config-* 2>/dev/null | sort -V | tail -1)
LIBCLANG_PATH=$(${LLVM_CONFIG} --libdir)
echo "LIBCLANG_PATH=${LIBCLANG_PATH}" >> $GITHUB_ENV
LIBCLANG_PATH="${LIBCLANG_PATH}" cargo test -p header-gen
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# rdkafka (spear-lib) requires cmake + curl headers to compile.
# header-gen requires llvm-dev + libclang-dev.
- name: Install build dependencies
run: sudo apt-get update && sudo apt-get install -y cmake libcurl4-openssl-dev llvm-dev libclang-dev clang libc-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Set LIBCLANG_PATH
run: |
LLVM_CONFIG=$(ls /usr/bin/llvm-config-* 2>/dev/null | sort -V | tail -1)
echo "LIBCLANG_PATH=$(${LLVM_CONFIG} --libdir)" >> $GITHUB_ENV
- name: Check formatting
run: cargo fmt -- --check
- name: Clippy
run: cargo clippy -- -D warnings