name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
repository_dispatch:
types: [protos-updated]
env:
CARGO_TERM_COLOR: always
jobs:
build-test:
name: Build & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --workspace
- name: Test
run: cargo test --workspace --lib
- name: Clippy
run: cargo clippy --workspace -- -D warnings
- name: Format check
run: cargo fmt --check
notify-downstream:
name: Notify Downstream Repos
runs-on: ubuntu-latest
needs: build-test
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
steps:
- name: Trigger examples-rust rebuild
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_DISPATCH_TOKEN }}
repository: angzarr-io/angzarr-examples-rust
event-type: client-updated
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'