99 lines
2.6 KiB
YAML
99 lines
2.6 KiB
YAML
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened, ready_for_review]
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
name: CI
|
|
|
|
env:
|
|
RUST_TOOLCHAIN: stable
|
|
|
|
jobs:
|
|
typos:
|
|
name: Spell Check with Typos
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: crate-ci/typos@master
|
|
|
|
check:
|
|
name: Check
|
|
if: github.event.pull_request.draft == false
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.18.4"
|
|
- uses: arduino/setup-protoc@v3
|
|
with:
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
- uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
- name: Rust Cache
|
|
uses: Swatinem/rust-cache@v2
|
|
- name: Run cargo check
|
|
run: cargo check --workspace --all-targets
|
|
- name: Check Go protbuf generation
|
|
run: |
|
|
make go
|
|
test $(git status --porcelain=v1 | wc -l) -eq 0 || (echo "Fail: generated go protobuf in github action is different from pushed ones" ; exit 1)
|
|
|
|
proto-fmt:
|
|
name: Protobuf Format
|
|
if: github.event.pull_request.draft == false
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup Buf
|
|
uses: bufbuild/buf-action@v1
|
|
with:
|
|
setup_only: true
|
|
- name: Run Buf Format
|
|
run: buf format --diff --exit-code
|
|
|
|
fmt:
|
|
name: Rustfmt
|
|
if: github.event.pull_request.draft == false
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: arduino/setup-protoc@v3
|
|
with:
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
- uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
components: rustfmt
|
|
- name: Rust Cache
|
|
uses: Swatinem/rust-cache@v2
|
|
- name: Run cargo fmt
|
|
run: cargo fmt --all -- --check
|
|
|
|
clippy:
|
|
name: Clippy
|
|
if: github.event.pull_request.draft == false
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: arduino/setup-protoc@v3
|
|
with:
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
- uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
components: clippy
|
|
- name: Rust Cache
|
|
uses: Swatinem/rust-cache@v2
|
|
- name: Run cargo clippy
|
|
run: cargo clippy --workspace --all-targets -- -D warnings -D clippy::print_stdout -D clippy::print_stderr
|