Skip to content

dev

dev #15

Workflow file for this run

# Verify the most basic static properties of the code
# - formatting (with `rustfmt`);
# - static analysis (with `clippy`).
name: Static
on:
push:
pull_request:
branches: [ master ]
env:
RUST_VERSIONS: "['1.69.0','stable']"
APT_DEPENDENCIES: "['libasound2-dev']"
jobs:
get-env-vars:
name: Get Environment vars
runs-on: ubuntu-latest
outputs:
RUST_VERSIONS: ${{ env.RUST_VERSIONS }}
APT_DEPENDENCIES: ${{ env.APT_DEPENDENCIES }}
steps:
- run: echo "null"
fmt:
name: Rustfmt on rust '${{ matrix.rust }}'
runs-on: ubuntu-latest
needs: [ get-env-vars ]
strategy:
matrix:
# https://github.com/orgs/community/discussions/46785#discussioncomment-4909718
# https://github.com/actions/runner/issues/2372#issuecomment-1591370444
rust: ${{ fromJSON(needs.get-env-vars.outputs.RUST_VERSIONS) }}
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
components: rustfmt
override: true
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
name: Clippy on rust '${{ matrix.rust }}'
runs-on: ubuntu-latest
needs: [ get-env-vars ]
strategy:
matrix:
rust: ${{ fromJSON(needs.get-env-vars.outputs.RUST_VERSIONS) }}
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install deps
# https://github.com/orgs/community/discussions/27125#discussioncomment-3254720
if: ${{ fromJSON(needs.get-env-vars.outputs.APT_DEPENDENCIES)[0] != null }}
run: sudo apt-get -y install ${{ join(fromJSON(needs.get-env-vars.outputs.APT_DEPENDENCIES), ' ') }}
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
components: clippy
override: true
#- name: Generate Cargo.lock before the hash
# uses: actions-rs/cargo@v1
# with:
# command: generate-lockfile
- name: Cache cargo registry
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo_registry-
- name: Cache cargo build
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-${{ matrix.rust }}-cargo_target-clippy-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
- ${{ runner.os }}-${{ matrix.rust }}-cargo_target-clippy-
- ${{ runner.os }}-${{ matrix.rust }}-cargo_target-
- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --workspace -- -D warnings -W clippy::nursery #-W clippy::pedantic
- name: Run cargo clippy with all features
uses: actions-rs/cargo@v1
#uses: actions-rs/clippy-check@v1
with:
command: clippy
#token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --all-features --workspace -- -D warnings -W clippy::nursery #-W clippy::pedantic