CI/CD: Add clippy and update actions
* Add clippy to CI. * Update .github/workflows/ci.yml * Update .github/workflows/ci.yml * Use `cargo check` instead of `cargo build` * Update CD workflow --------- Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
This commit is contained in:
19
.github/workflows/cd.yml
vendored
19
.github/workflows/cd.yml
vendored
@@ -49,12 +49,9 @@ jobs:
|
|||||||
features: '--no-default-features --features rodio_backend,pancurses_backend,share_clipboard,notify'
|
features: '--no-default-features --features rodio_backend,pancurses_backend,share_clipboard,notify'
|
||||||
steps:
|
steps:
|
||||||
- name: Install Rust toolchain
|
- name: Install Rust toolchain
|
||||||
uses: actions-rs/toolchain@v1
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
|
||||||
override: true
|
|
||||||
target: ${{ matrix.target }}
|
target: ${{ matrix.target }}
|
||||||
profile: minimal
|
|
||||||
- name: Install macOS dependencies
|
- name: Install macOS dependencies
|
||||||
if: matrix.os == 'macos-latest'
|
if: matrix.os == 'macos-latest'
|
||||||
run: brew install portaudio pkg-config
|
run: brew install portaudio pkg-config
|
||||||
@@ -69,19 +66,17 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
apt update
|
apt update
|
||||||
apt install -y ${{ matrix.dependencies }}
|
apt install -y ${{ matrix.dependencies }}
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
name: Checkout src
|
name: Checkout src
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cargo/registry
|
~/.cargo/registry/index/
|
||||||
~/.cargo/git
|
~/.cargo/registry/cache/
|
||||||
|
~/.cargo/git/db/
|
||||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
- name: Running cargo build
|
- name: Running cargo build
|
||||||
uses: actions-rs/cargo@v1
|
run: cargo build --release --target ${{ matrix.target }} ${{ matrix.features }}
|
||||||
with:
|
|
||||||
command: build
|
|
||||||
args: --locked --release --target ${{ matrix.target }} ${{ matrix.features }}
|
|
||||||
- name: Extract git tag
|
- name: Extract git tag
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF#refs/tags/})"
|
run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF#refs/tags/})"
|
||||||
|
|||||||
75
.github/workflows/ci.yml
vendored
75
.github/workflows/ci.yml
vendored
@@ -7,7 +7,8 @@ on:
|
|||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-macos:
|
# Build the Rust code.
|
||||||
|
build:
|
||||||
name: Checking ${{ matrix.build_target }}
|
name: Checking ${{ matrix.build_target }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
@@ -30,13 +31,22 @@ jobs:
|
|||||||
target: x86_64-pc-windows-msvc
|
target: x86_64-pc-windows-msvc
|
||||||
features: '--no-default-features --features rodio_backend,pancurses_backend,share_clipboard,notify'
|
features: '--no-default-features --features rodio_backend,pancurses_backend,share_clipboard,notify'
|
||||||
steps:
|
steps:
|
||||||
- name: Install Rust toolchain
|
- uses: actions/checkout@v3
|
||||||
uses: actions-rs/toolchain@v1
|
- uses: actions/cache@v3
|
||||||
|
name: Cache build data
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/bin/
|
||||||
|
~/.cargo/registry/index/
|
||||||
|
~/.cargo/registry/cache/
|
||||||
|
~/.cargo/git/db/
|
||||||
|
target/
|
||||||
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
- name: Install Rust toolchain
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
|
||||||
override: true
|
|
||||||
target: ${{ matrix.target }}
|
target: ${{ matrix.target }}
|
||||||
profile: minimal
|
components: clippy, rustfmt
|
||||||
- name: Install macOS dependencies
|
- name: Install macOS dependencies
|
||||||
if: matrix.os == 'macos-latest'
|
if: matrix.os == 'macos-latest'
|
||||||
run: brew install portaudio pkg-config
|
run: brew install portaudio pkg-config
|
||||||
@@ -45,23 +55,48 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install libpulse-dev libdbus-1-dev libncursesw5-dev libxcb-shape0-dev libxcb-xfixes0-dev
|
sudo apt install libpulse-dev libdbus-1-dev libncursesw5-dev libxcb-shape0-dev libxcb-xfixes0-dev
|
||||||
- uses: actions/checkout@v2
|
- name: Running cargo build
|
||||||
name: Checkout src
|
run: cargo check --locked --target ${{ matrix.target }} ${{ matrix.features }}
|
||||||
- uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cargo/registry
|
|
||||||
~/.cargo/git
|
|
||||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
- name: Running cargo check
|
|
||||||
uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: check
|
|
||||||
args: --locked --release --target ${{ matrix.target }} ${{ matrix.features }}
|
|
||||||
|
|
||||||
|
# Check Rust code formatting.
|
||||||
fmt:
|
fmt:
|
||||||
|
name: Running `cargo fmt`
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
- name: Install Rust toolchain
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
components: clippy, rustfmt
|
||||||
- name: cargo fmt
|
- name: cargo fmt
|
||||||
run: cargo fmt --all -- --check
|
run: cargo fmt --all -- --check
|
||||||
|
|
||||||
|
# Run `cargo clippy` on all the targets in all workspace members with all
|
||||||
|
# features enabled, and return an error if there are any clippy suggestions.
|
||||||
|
clippy:
|
||||||
|
name: Running `cargo clippy`
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/cache@v3
|
||||||
|
name: Cache build data
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/bin/
|
||||||
|
~/.cargo/registry/index/
|
||||||
|
~/.cargo/registry/cache/
|
||||||
|
~/.cargo/git/db/
|
||||||
|
target/
|
||||||
|
key: ${{ runner.os }}-clippy-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
- name: Install Rust toolchain
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
components: clippy, rustfmt
|
||||||
|
- name: Install Linux dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install portaudio19-dev libasound2-dev libpulse-dev libdbus-1-dev libncursesw5-dev libxcb-shape0-dev libxcb-xfixes0-dev
|
||||||
|
- name: cargo clippy
|
||||||
|
run: cargo clippy --locked --no-deps --workspace --all-targets --all-features --verbose -- -D warnings
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ impl CoverView {
|
|||||||
if ueberzug.is_none() {
|
if ueberzug.is_none() {
|
||||||
*ueberzug = Some(
|
*ueberzug = Some(
|
||||||
std::process::Command::new("ueberzug")
|
std::process::Command::new("ueberzug")
|
||||||
.args(&["layer", "--silent"])
|
.args(["layer", "--silent"])
|
||||||
.stdin(Stdio::piped())
|
.stdin(Stdio::piped())
|
||||||
.stdout(Stdio::piped())
|
.stdout(Stdio::piped())
|
||||||
.spawn()?,
|
.spawn()?,
|
||||||
|
|||||||
Reference in New Issue
Block a user