Skip to content

Merge tag 'v1.6.0' into develop #6

Merge tag 'v1.6.0' into develop

Merge tag 'v1.6.0' into develop #6

Workflow file for this run

#!#
# Copyright (c) 2025 Hangzhou Guanwaii Technology Co., Ltd.
#
# This source code is licensed under the MIT License,
# which is located in the LICENSE file in the source tree's root directory.
#
# File: rust.yml
# Author: mingcheng <[email protected]>
# File Created: 2025-03-05 11:10:40
#
# Modified By: mingcheng <[email protected]>
# Last Modified: 2025-10-22 00:33:40
##
name: Cargo Build & Test
on:
push:
branches:
- main
- master
- develop
- "feature/**"
pull_request:
branches:
- main
- master
- develop
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
# Code quality checks (clippy and rustfmt)
lint:
name: Lint (clippy & rustfmt)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Run cargo fmt check
run: cargo fmt --all -- --check
- name: Run cargo clippy
run: cargo clippy --all-targets --all-features -- -D warnings
# Security audit
security_audit:
name: Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install cargo-audit
run: cargo install cargo-audit --locked
- name: Run cargo audit
run: cargo audit
# Build and test on stable/beta/nightly
build_and_test:
name: Build & Test (${{ matrix.toolchain }})
runs-on: ubuntu-latest
needs:
- lint
- security_audit
strategy:
fail-fast: false
matrix:
toolchain:
- stable
- beta
- nightly
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup Rust toolchain (${{ matrix.toolchain }})
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.toolchain }}
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Show Rust version
run: |
rustc --version
cargo --version
- name: Run tests
run: cargo test --all --locked
- name: Verify package can be built
run: cargo package --locked --allow-dirty