name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
linux:
name: Build & Test (Linux)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Build
run: cargo build --verbose
- name: Test
run: cargo test --verbose
macos:
name: Build & Test (macOS)
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install Protoc
run: brew install protobuf
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Build
run: cargo build --verbose
- name: Test
run: cargo test --verbose
windows:
name: Build & Test (Windows / MSVC)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install Protoc
run: choco install protoc --yes
shell: powershell
- name: Install Rust (stable MSVC toolchain)
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable-x86_64-pc-windows-msvc
components: rustfmt, clippy
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: windows-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build (lib only)
run: cargo build --lib --verbose
env:
GRPC_GW_WINDOWS_CI: "1"
- name: Test (lib only)
run: cargo test --lib --verbose
env:
GRPC_GW_WINDOWS_CI: "1"