Skip to content

Commit

Permalink
fix: Update GitHub Actions
Browse files Browse the repository at this point in the history
- Replace deprecated actions
- Add udeps, pants, audit, deny GitHub Action checks
- Fix MainClock::RcOscillator4Mhz typo for atsam4n targets
- Fix clippy warning
  • Loading branch information
haata committed Nov 29, 2022
1 parent 0a29442 commit 79e7912
Show file tree
Hide file tree
Showing 5 changed files with 394 additions and 75 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: "Audit Dependencies"
on:
push:
paths:
# Run if workflow changes
- '.github/workflows/audit.yml'
# Run on changed dependencies
- '**/Cargo.toml'
- '**/Cargo.lock'
# Run if the configuration file changes
- '**/audit.toml'
# Rerun periodicly to pick up new advisories
schedule:
- cron: '0 0 * * *'
# Run manually
workflow_dispatch:

permissions: read-all

jobs:
audit:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
- uses: actions-rust-lang/audit@v1
name: Audit Rust Dependencies

deny:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
- name: cargo-binstall
run: |
mkdir -p ~/.cargo/bin
wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
tar xf cargo-binstall*.tgz -C ~/.cargo/bin
- run: cargo binstall --no-confirm cargo-deny
- name: Cargo Deny
run: cargo deny check licenses

pants:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
- name: cargo-binstall
run: |
mkdir -p ~/.cargo/bin
wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
tar xf cargo-binstall*.tgz -C ~/.cargo/bin
- run: cargo binstall --no-confirm cargo-pants
- name: Cargo Pants
run: cargo pants
129 changes: 55 additions & 74 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,113 +24,94 @@ jobs:
]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
# atsam4e toolchain
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
if: ${{ contains(matrix.mcu, 'atsam4e') }}
with:
target: thumbv7em-none-eabihf
toolchain: stable
override: true
- uses: actions-rs/toolchain@v1
targets: thumbv7em-none-eabihf
- uses: dtolnay/rust-toolchain@stable
if: ${{ contains(matrix.mcu, 'atsam4s') || contains(matrix.mcu, 'atsam4n') }}
with:
target: thumbv7em-none-eabi
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
targets: thumbv7em-none-eabi
- name: Cargo Check (atsam4e)
if: ${{ contains(matrix.mcu, 'atsam4e') }}
with:
command: check
args: --target thumbv7em-none-eabihf --no-default-features --features ${{ matrix.mcu }}
- uses: actions-rs/cargo@v1
run: cargo check --target thumbv7em-none-eabihf --no-default-features --features ${{ matrix.mcu }}
- name: Cargo Check (atsam4e,usb)
if: ${{ contains(matrix.mcu, 'atsam4e') }}
with:
command: check
args: --target thumbv7em-none-eabihf --no-default-features --features ${{ matrix.mcu }},usb
- uses: actions-rs/cargo@v1
run: cargo check --target thumbv7em-none-eabihf --no-default-features --features ${{ matrix.mcu }},usb
- name: Cargo Check (atsam4s|atsam4n)
if: ${{ contains(matrix.mcu, 'atsam4s') || contains(matrix.mcu, 'atsam4n') }}
with:
command: check
args: --target thumbv7em-none-eabi --no-default-features --features ${{ matrix.mcu }}
- uses: actions-rs/cargo@v1
if: ${{ contains(matrix.mcu, 'atsam4s') }}
with:
command: check
args: --target thumbv7em-none-eabi --no-default-features --features ${{ matrix.mcu }},usb
run: cargo check --target thumbv7em-none-eabi --no-default-features --features ${{ matrix.mcu }}
- name: Cargo Check (atsam4s|atsam4n,usb)
if: ${{ contains(matrix.mcu, 'atsam4s') || contains(matrix.mcu, 'atsam4n') }}
run: cargo check --target thumbv7em-none-eabi --no-default-features --features ${{ matrix.mcu }},usb

build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
# Default build
- uses: actions-rs/cargo@v1
with:
command: build
args: --target x86_64-unknown-linux-gnu
- name: Cargo Build (default)
run: cargo build --target x86_64-unknown-linux-gnu
# USB build
- uses: actions-rs/cargo@v1
with:
command: build
args: --target x86_64-unknown-linux-gnu --features usb
- name: Cargo Build (usb)
run: cargo build --target x86_64-unknown-linux-gnu --features usb

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
command: fmt
args: -- --check
components: rustfmt
- name: Cargo fmt
run: cargo fmt -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --target x86_64-unknown-linux-gnu -- -D warnings
components: clippy
- name: Cargo Clippy (default)
run: cargo clippy --target x86_64-unknown-linux-gnu -- -D warnings
# Test USB + atsam4e
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --target x86_64-unknown-linux-gnu --features usb -- -D warnings
- name: Cargo Clippy (atsam4e,usb)
run: cargo clippy --target x86_64-unknown-linux-gnu --features usb -- -D warnings
# Test USB + atsam4s
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --target x86_64-unknown-linux-gnu --no-default-features --features atsam4sd32c,usb -- -D warnings
- name: Cargo Clippy (atsam4s,usb)
run: cargo clippy --no-default-features --target x86_64-unknown-linux-gnu --features atsam4sd32c,usb -- -D warnings

doc:
name: Doc Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Cargo Doc Check
env:
RUSTDOCFLAGS: -Dwarnings
with:
command: doc
args: --target x86_64-unknown-linux-gnu
run: cargo doc --target x86_64-unknown-linux-gnu

udeps:
name: cargo-udeps
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
targets: thumbv7em-none-eabihf
- name: cargo-binstall
run: |
mkdir -p ~/.cargo/bin
wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
tar xf cargo-binstall*.tgz -C ~/.cargo/bin
- run: cargo binstall --no-confirm cargo-udeps
- name: Cargo Udeps
run: cargo udeps
Loading

0 comments on commit 79e7912

Please sign in to comment.