Update outdated test.yml
Actions workflow
#42
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: Test | |
on: | |
- push | |
- pull_request | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Rust stable | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
components: rustfmt | |
- name: Check code format | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
test: | |
needs: lint | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
rust-toolchain: | |
- stable | |
- beta | |
- nightly | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Rust ${{ matrix.rust-toolchain }} | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: ${{ matrix.rust-toolchain }} | |
override: true | |
- name: Check code | |
uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
- name: Measure code coverage | |
uses: actions-rs/tarpaulin@v0.1 | |
with: | |
version: '0.19.0' | |
args: '-v --out Xml --ciserver github-actions' | |
- name: Upload to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
flags: ${{ matrix.rust-toolchain }} | |
name: test-${{ matrix.rust-toolchain }} | |
fail_ci_if_error: false | |
token: ${{ secrets.CODECOV_TOKEN }} | |
codecov_curl_args: "--globoff" | |
verbose: true | |
publish: | |
needs: test | |
runs-on: ubuntu-latest | |
if: "startsWith(github.ref, 'refs/tags/v')" | |
environment: Crates.io | |
name: Publish crates | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Rust ${{ matrix.rust-toolchain }} | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Package and publish crate | |
uses: actions-rs/cargo@v1 | |
with: | |
command: publish | |
args: --token ${{ secrets.CRATES_IO_TOKEN }} | |
release: | |
needs: publish | |
environment: GitHub Releases | |
runs-on: ubuntu-latest | |
if: "startsWith(github.ref, 'refs/tags/v')" | |
name: Release | |
permissions: | |
contents: write | |
pull-requests: read | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Release a Changelog | |
uses: rasmus-saks/release-a-changelog-action@v1.0.1 | |
with: | |
github-token: '${{ secrets.GITHUB_TOKEN }}' | |