Skip to content

Commit

Permalink
add: github action release.
Browse files Browse the repository at this point in the history
  • Loading branch information
auula committed Jul 26, 2024
1 parent 05ee418 commit 8081776
Showing 1 changed file with 53 additions and 22 deletions.
75 changes: 53 additions & 22 deletions .github/workflows/rust.yml
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 }}

0 comments on commit 8081776

Please sign in to comment.