-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
53 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,71 @@ | ||
name: Rust CI | ||
name: Rust CI and Release | ||
|
||
# 当推送到 main 或 dev 分支时触发 Rust CI 工作流 | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev # 在 push 到 main 或 dev 分支时触发 | ||
- dev | ||
tags: | ||
- v[0-9]+.* | ||
pull_request: | ||
branches: | ||
- main | ||
- dev # 在拉取请求到 main 或 dev 分支时触发 | ||
- dev | ||
|
||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
# Rust CI 工作流 | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
- name: Install Cargo Tarpaulin | ||
run: cargo install cargo-tarpaulin | ||
- name: Build | ||
run: cargo build --verbose | ||
- name: Run tests | ||
run: cargo test --verbose | ||
- name: Run cargo-tarpaulin | ||
run: cargo tarpaulin --out Xml | ||
- name: Install cargo-audit | ||
run: cargo install cargo-audit | ||
- name: Run cargo-audit | ||
run: cargo audit | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v4.0.1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
# Release 工作流 | ||
create-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: taiki-e/create-gh-release-action@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
upload-assets: | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
- windows-latest | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
- name: Install Cargo Tarpaulin | ||
run: cargo install cargo-tarpaulin | ||
- name: Build | ||
run: cargo build --verbose | ||
- name: Run tests | ||
run: cargo test --verbose | ||
- name: Run cargo-tarpaulin | ||
run: cargo tarpaulin --out Xml | ||
- name: Run cargo-audit | ||
run: cargo install cargo-audit && cargo-audit audit | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v4.0.1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
- uses: actions/checkout@v4 | ||
- uses: taiki-e/upload-rust-binary-action@v1 | ||
with: | ||
bin: typikon | ||
tar: unix | ||
zip: windows | ||
token: ${{ secrets.GITHUB_TOKEN }} |