Repository navigation
Merge pull request #20 from Praying/dependabot/github_actions/actions… #65
This file contains hidden or 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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| pull_request: {} | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| lint: | |
| name: lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: stable | |
| override: true | |
| components: clippy | |
| - run: cargo clippy --all-targets | |
| test: | |
| name: test | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| build: [msrv, stable, macos, windows] | |
| include: | |
| - build: msrv | |
| os: ubuntu-latest | |
| rust: 1.87.0 | |
| - build: stable | |
| os: ubuntu-latest | |
| rust: stable | |
| - build: macos | |
| os: macos-latest | |
| rust: stable | |
| - build: windows | |
| os: windows-latest | |
| rust: stable | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: ${{ matrix.rust }} | |
| override: true | |
| - uses: actions-rs/cargo@v1 | |
| with: | |
| command: test | |
| args: --all-features | |
| fmt: | |
| name: format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| profile: minimal | |
| components: rustfmt | |
| - uses: actions-rs/cargo@v1 | |
| with: | |
| command: fmt | |
| args: --all -- --check | |
| publish: | |
| name: Publish to crates.io | |
| runs-on: ubuntu-latest | |
| needs: [lint, test, fmt] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| - name: Publish crate | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} # 需在仓库 Secrets 中配置 | |
| run: cargo publish --locked | |