Adds gh action to check examples to ensure they're valid #2494
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous integration | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
rust_actions: | |
name: Rust Actions (Check/Fmt/Clippy) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
include: | |
- tool: check | |
protobuf: true | |
components: "" | |
command: cargo check | |
- tool: fmt | |
protobuf: true | |
components: "rustfmt" | |
command: cargo fmt --all -- --check | |
- tool: clippy | |
protobuf: true | |
components: "clippy" | |
command: cargo clippy --all-features | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1.8 | |
with: | |
components: ${{matrix.components}} | |
- name: Install Protobuf | |
if: matrix.protobuf | |
uses: ./.github/actions/install-protobuf | |
- name: Run ${{ matrix.tool }} | |
run: ${{ matrix.command }} | |
cargo-deny: # only runs on Linux | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: EmbarkStudios/cargo-deny-action@v1 | |
test: | |
name: Test Suite | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1.8 | |
- name: Install Protobuf | |
uses: ./.github/actions/install-protobuf | |
- name: Install nextest | |
uses: taiki-e/install-action@nextest | |
- run: cargo nextest run | |
integration-test: | |
name: Integration Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1.8 | |
- name: Install Protobuf | |
uses: ./.github/actions/install-protobuf | |
- run: cargo test -p sheepdog | |
timeout-minutes: 30 | |
config-smoke-tests: | |
name: Example Config smoke test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1.8 | |
- name: Install Protobuf | |
uses: ./.github/actions/install-protobuf | |
- run: cargo build --bin lading --release | |
- run: | | |
for config in ./examples/*.yaml; do | |
echo "Testing with config $config" | |
timeout 1 ./target/release/lading --no-target --config-path "$config" | |
exit_code=$? | |
if [ $exit_code -ne 124 ]; then | |
echo "Test failed or did not timeout for $config" | |
exit 1 | |
fi | |
done | |
kani: | |
name: Kani Proofs | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
crate: [lading_throttle, lading_payload] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1.8 | |
- name: Install Protobuf | |
uses: ./.github/actions/install-protobuf | |
- name: Install kani | |
run: cargo install kani-verifier | |
- run: cargo kani --solver cadical | |
working-directory: ${{ matrix.crate }} | |
timeout-minutes: 30 | |
buf: | |
runs-on: ubuntu-latest | |
steps: | |
# Check our protobufs for lint cleanliness and for lack of breaking | |
# changes | |
- uses: actions/checkout@v4 | |
- name: buf-setup | |
uses: bufbuild/buf-setup-action@v1.31.0 | |
- name: buf-lint | |
uses: bufbuild/buf-lint-action@v1.1.1 | |
- name: buf-breaking | |
uses: bufbuild/buf-breaking-action@v1.1.4 | |
with: | |
against: 'https://github.com/datadog/lading.git#branch=main' |