Files
de-mls/.github/workflows/ci.yml
Vinh Trịnh e37a4b435f ci: optimize workflow with parallel jobs and better caching (#42)
* ci: optimize performance with better caching and parallel execution

* ci: hybrid pipeline with strategic build->test sequencing

* ci: try other way

* ci: seperate lint too, try ubuntu-latest-arm64 and some cargo optimize keys

* ci: remove ubuntu-latest-arm64

* ci: back to manual cache

* ci: add needs: [build-stable-release] for lint

* ci: fix CI lint and simplify command for lint and doc CI jobs

* chore: alot of clippy warning fix because of new Rust version

* ci: make all the task parallel

* chore: rerun CI workflow
2025-07-09 12:35:02 +07:00

86 lines
2.2 KiB
YAML

on:
workflow_dispatch:
pull_request:
push:
branches:
- "main"
name: "CI"
env:
PROTOC_VERSION: "3.25.3"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
shared-key: "stable"
- name: Install protoc
uses: taiki-e/install-action@v2
with:
tool: protoc@${{ env.PROTOC_VERSION }}
- name: Check formatting
run: cargo fmt --all --check
- name: Run clippy
run: cargo clippy --all-features --tests -- -D warnings
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install protoc
uses: taiki-e/install-action@v2
with:
tool: protoc@${{ env.PROTOC_VERSION }}
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: "stable"
- name: Generate documentation
run: |
cargo doc --lib --no-deps --all-features --document-private-items
env:
RUSTDOCFLAGS: -Dwarnings
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: "stable"
- name: Install protoc
uses: taiki-e/install-action@v2
with:
tool: protoc@${{ env.PROTOC_VERSION }}
- name: Test
run: cargo test --release
unused_dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
with:
shared-key: "nightly"
- name: Install protoc
uses: taiki-e/install-action@v2
with:
tool: protoc@${{ env.PROTOC_VERSION }}
- name: Install cargo-udeps
uses: taiki-e/install-action@cargo-udeps
- name: Check for unused dependencies
run: cargo +nightly udeps --all-targets