-
Notifications
You must be signed in to change notification settings - Fork 10
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
2 changed files
with
52 additions
and
53 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# .github/workflows/release.yml | ||
name: Rust Release | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
release: | ||
name: release ${{ matrix.target }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- target: x86_64-pc-windows-gnu | ||
archive: zip | ||
- target: x86_64-unknown-linux-musl | ||
archive: tar.gz tar.xz tar.zst | ||
- target: x86_64-apple-darwin | ||
archive: zip | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Compile and release | ||
uses: rust-build/rust-build.action@v1.4.5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
RUSTTARGET: ${{ matrix.target }} | ||
ARCHIVE_TYPES: ${{ matrix.archive }} |
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,71 +1,40 @@ | ||
name: Rust CI and Release | ||
name: Rust CI | ||
|
||
# 当推送到 main 或 dev 分支时触发 Rust CI 工作流 | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
tags: | ||
- v[0-9]+.* | ||
- dev # 在 push 到 main 或 dev 分支时触发 | ||
pull_request: | ||
branches: | ||
- main | ||
- dev | ||
|
||
- dev # 在拉取请求到 main 或 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 | ||
- uses: taiki-e/upload-rust-binary-action@v1 | ||
with: | ||
bin: typikon | ||
tar: unix | ||
zip: windows | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- 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 }} |