docs: add all docs. #91
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
name: Rust CI/CD | |
on: | |
push: | |
branches: | |
- main | |
- dev # 在 push 到 main 或 dev 分支时触发 | |
pull_request: | |
branches: | |
- main | |
- dev # 在拉取请求到 main 或 dev 分支时触发 | |
release: | |
types: [published] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
arch: [x86_64, arm] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Build binary | |
run: cargo build --verbose --release --target ${{ matrix.arch }}-unknown-linux-gnu | |
- name: Run tests | |
run: | | |
cargo test --verbose | |
- name: Run cargo-tarpaulin | |
run: | | |
cargo install cargo-tarpaulin | |
cargo tarpaulin --out Xml | |
- name: Run cargo-audit | |
run: | | |
cargo install cargo-audit | |
cargo audit | |
- name: Package binary | |
run: | | |
mkdir -p release | |
cp target/${{ matrix.arch }}/release/typikon release/typikon_${{ matrix.arch }} | |
- name: Upload Release Asset | |
if: github.event_name == 'release' | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: release/typikon_${{ matrix.arch }} | |
asset_name: typikon_${{ matrix.arch }} | |
asset_content_type: application/octet-stream | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload coverage to Codecov | |
if: github.event_name == 'release' | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |