Bump actions/checkout from 3 to 4 #82
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
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
name: ci | |
env: | |
CARGO_INCREMENTAL: 0 | |
CARGO_NET_RETRY: 10 | |
RUSTUP_MAX_RETRIES: 10 | |
RUST_BACKTRACE: 1 | |
# Pin the nightly toolchain to prevent breakage. | |
# This should be occasionally updated. | |
RUST_NIGHTLY_TOOLCHAIN: nightly-2023-02-14 | |
jobs: | |
env: | |
runs-on: ubuntu-latest | |
outputs: | |
rust-versions: ${{ steps.definitions.outputs.versions }} | |
msrv: ${{ steps.definitions.outputs.msrv }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Evaluate definitions | |
id: definitions | |
run: | | |
export MSRV=$(cat rust-toolchain | awk '{$1=$1};1') | |
echo "::set-output name=msrv::$MSRV" | |
export RAW_VERSIONS="stable $MSRV" | |
export VERSIONS=$(echo $RAW_VERSIONS | jq -scR 'rtrimstr("\n")|split(" ")|.') | |
echo "::set-output name=versions::$VERSIONS" | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
id: toolchain | |
with: | |
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }} | |
profile: minimal | |
override: true | |
components: rustfmt | |
- name: Run cargo fmt | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install dependencies | |
run: | | |
sudo apt-get -o Acquire::Retries=3 update | |
sudo apt-get -o Acquire::Retries=3 install -y libasound2-dev | |
- uses: actions-rs/[email protected] | |
id: toolchain | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
components: clippy | |
- uses: camshaft/rust-cache@v1 | |
# TODO translate json reports to in-action warnings | |
- name: Run cargo clippy | |
uses: actions-rs/[email protected] | |
with: | |
command: clippy | |
args: --all-features --all-targets -- -D warnings | |
udeps: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install dependencies | |
run: | | |
sudo apt-get -o Acquire::Retries=3 update | |
sudo apt-get -o Acquire::Retries=3 install -y libasound2-dev | |
- uses: actions-rs/[email protected] | |
id: toolchain | |
with: | |
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }} | |
profile: minimal | |
override: true | |
- uses: camshaft/rust-cache@v1 | |
- uses: camshaft/install@v1 | |
with: | |
crate: cargo-udeps | |
- name: Run cargo udeps | |
run: cargo udeps --workspace --all-targets | |
env: | |
RUSTC_WRAPPER: "" | |
test: | |
runs-on: ${{ matrix.os }} | |
needs: env | |
strategy: | |
matrix: | |
rust: ${{ fromJson(needs.env.outputs.rust-versions) }} | |
os: [ubuntu-latest, macOS-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Install dependencies | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
sudo apt-get -o Acquire::Retries=3 update | |
sudo apt-get -o Acquire::Retries=3 install -y libasound2-dev | |
- uses: actions-rs/toolchain@v1 | |
id: toolchain | |
with: | |
toolchain: ${{ matrix.rust }} | |
override: true | |
- uses: camshaft/rust-cache@v1 | |
with: | |
key: ${{ matrix.target }} | |
- name: Run cargo test | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test |