name: Release
on:
push:
branches:
- master
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
./target/
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt, clippy
- uses: EmbarkStudios/cargo-deny-action@v1
- run: cargo fmt --all --check
- run: cargo clippy --no-deps --all-targets --all-features -- -D warnings
test:
needs: prepare
strategy:
matrix:
toolchain: [stable, nightly]
os: [windows-latest, ubuntu-latest, macos-latest]
exclude:
- os: macos-latest
toolchain: nightly
- os: windows-latest
toolchain: nightly
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
./target/
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }}
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
profile: minimal
- if: runner.os == 'linux'
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- run: cargo test --all-features
env:
CARGO_INCREMENTAL: 1
release:
needs: [prepare, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
./target/
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.toml') }}
- uses: cycjimmy/semantic-release-action@v3
with:
extra_plugins: |
@semantic-release/exec
@semantic-release/git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
GIT_AUTHOR_NAME: ${{ github.event.pusher.name }}
GIT_AUTHOR_EMAIL: ${{ github.event.pusher.email }}
GIT_COMMITTER_NAME: ${{ github.event.pusher.name }}
GIT_COMMITTER_EMAIL: ${{ github.event.pusher.email }}