2020-12-15 05:16:10 +00:00
|
|
|
# Note, this is used in the badge URL!
|
|
|
|
name: test
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-08-01 09:14:14 +00:00
|
|
|
branches: [dev, master]
|
2021-04-09 15:01:30 +00:00
|
|
|
paths:
|
|
|
|
[
|
|
|
|
"**.rs",
|
|
|
|
"Cargo.toml",
|
2021-05-08 20:41:19 +00:00
|
|
|
"Cargo.lock",
|
|
|
|
"rustfmt.toml",
|
|
|
|
".github/workflows/*",
|
2021-06-20 05:07:33 +00:00
|
|
|
"!*.md",
|
2021-06-18 22:20:27 +00:00
|
|
|
"!contrib/*",
|
|
|
|
"!docs/*",
|
|
|
|
"!LICENSE",
|
2021-06-20 05:07:33 +00:00
|
|
|
"!*.sh",
|
2021-04-09 15:01:30 +00:00
|
|
|
]
|
2020-12-15 05:16:10 +00:00
|
|
|
pull_request:
|
2021-04-09 15:01:30 +00:00
|
|
|
paths:
|
|
|
|
[
|
|
|
|
"**.rs",
|
|
|
|
"Cargo.toml",
|
2021-05-08 20:41:19 +00:00
|
|
|
"Cargo.lock",
|
|
|
|
"rustfmt.toml",
|
|
|
|
".github/workflows/*",
|
2021-06-20 05:07:33 +00:00
|
|
|
"!*.md",
|
2021-06-18 22:20:27 +00:00
|
|
|
"!contrib/*",
|
|
|
|
"!docs/*",
|
|
|
|
"!LICENSE",
|
2021-06-20 05:07:33 +00:00
|
|
|
"!*.sh",
|
2021-04-09 15:01:30 +00:00
|
|
|
]
|
2021-12-29 07:38:08 +00:00
|
|
|
schedule:
|
|
|
|
# Run CI every week
|
|
|
|
- cron: "00 01 * * 0"
|
2021-04-09 15:01:30 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
RUST_BACKTRACE: 1
|
2021-12-27 10:35:05 +00:00
|
|
|
RUSTFLAGS: -D warnings
|
2020-12-15 05:16:10 +00:00
|
|
|
|
2021-12-27 10:35:05 +00:00
|
|
|
# The layering here is as follows, checking in priority from highest to lowest:
|
|
|
|
# 1. absence of errors and warnings on Linux/x86
|
|
|
|
# 2. cross compilation on Windows and Linux/ARM
|
|
|
|
# 3. absence of lints
|
|
|
|
# 4. code formatting
|
2020-12-15 05:16:10 +00:00
|
|
|
|
2021-12-27 10:35:05 +00:00
|
|
|
jobs:
|
2021-04-09 15:01:30 +00:00
|
|
|
test-linux:
|
2021-12-27 10:35:05 +00:00
|
|
|
name: cargo +${{ matrix.toolchain }} check (${{ matrix.os }})
|
2020-12-15 05:16:10 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
continue-on-error: ${{ matrix.experimental }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest]
|
|
|
|
toolchain:
|
2022-07-28 17:32:11 +00:00
|
|
|
- "1.61" # MSRV (Minimum supported rust version)
|
2020-12-15 05:16:10 +00:00
|
|
|
- stable
|
2021-12-27 10:35:05 +00:00
|
|
|
experimental: [false]
|
|
|
|
# Ignore failures in beta
|
2020-12-15 05:16:10 +00:00
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
2021-12-27 10:35:05 +00:00
|
|
|
toolchain: beta
|
2020-12-15 05:16:10 +00:00
|
|
|
experimental: true
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2023-04-11 18:20:09 +00:00
|
|
|
uses: actions/checkout@v3.5.0
|
2021-04-09 15:01:30 +00:00
|
|
|
|
2020-12-15 05:16:10 +00:00
|
|
|
- name: Install toolchain
|
2023-04-11 18:20:09 +00:00
|
|
|
uses: actions-rs/toolchain@v1.0.6
|
2020-12-15 05:16:10 +00:00
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: ${{ matrix.toolchain }}
|
|
|
|
override: true
|
2021-04-09 15:01:30 +00:00
|
|
|
|
|
|
|
- name: Get Rustc version
|
|
|
|
id: get-rustc-version
|
2023-04-11 18:20:09 +00:00
|
|
|
run: echo "version=$(rustc -V)" >> $GITHUB_OUTPUT
|
2021-04-09 15:01:30 +00:00
|
|
|
shell: bash
|
|
|
|
|
2021-01-31 01:55:47 +00:00
|
|
|
- name: Cache Rust dependencies
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry/index
|
|
|
|
~/.cargo/registry/cache
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
2021-05-08 20:41:19 +00:00
|
|
|
key: ${{ runner.os }}-${{ steps.get-rustc-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
|
2021-04-09 15:01:30 +00:00
|
|
|
|
2020-12-15 05:16:10 +00:00
|
|
|
- name: Install developer package dependencies
|
2022-12-03 00:38:39 +00:00
|
|
|
run: sudo apt-get update && sudo apt install -y libunwind-dev && sudo apt-get install libpulse-dev portaudio19-dev libasound2-dev libsdl2-dev gstreamer1.0-dev libgstreamer-plugins-base1.0-dev libavahi-compat-libdnssd-dev
|
2021-04-09 15:01:30 +00:00
|
|
|
|
|
|
|
- run: cargo build --workspace --examples
|
|
|
|
- run: cargo test --workspace
|
|
|
|
|
|
|
|
- run: cargo install cargo-hack
|
2021-12-27 10:35:05 +00:00
|
|
|
- run: cargo hack --workspace --remove-dev-deps
|
|
|
|
- run: cargo check -p librespot-core --no-default-features
|
|
|
|
- run: cargo check -p librespot-core
|
|
|
|
- run: cargo hack check --each-feature -p librespot-discovery
|
|
|
|
- run: cargo hack check --each-feature -p librespot-playback
|
|
|
|
- run: cargo hack check --each-feature
|
2021-04-09 15:01:30 +00:00
|
|
|
|
|
|
|
test-windows:
|
2021-12-27 10:35:05 +00:00
|
|
|
needs: test-linux
|
|
|
|
name: cargo +${{ matrix.toolchain }} check (${{ matrix.os }})
|
2021-04-09 15:01:30 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2021-12-27 10:35:05 +00:00
|
|
|
continue-on-error: false
|
2021-04-09 15:01:30 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os: [windows-latest]
|
2021-12-27 10:35:05 +00:00
|
|
|
toolchain:
|
2022-07-28 17:32:11 +00:00
|
|
|
- "1.61" # MSRV (Minimum supported rust version)
|
2021-12-27 10:35:05 +00:00
|
|
|
- stable
|
2021-04-09 15:01:30 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2023-04-11 18:20:09 +00:00
|
|
|
uses: actions/checkout@v3.5.0
|
2021-04-09 15:01:30 +00:00
|
|
|
|
|
|
|
- name: Install toolchain
|
2023-04-11 18:20:09 +00:00
|
|
|
uses: actions-rs/toolchain@v1.0.6
|
2021-04-09 15:01:30 +00:00
|
|
|
with:
|
|
|
|
toolchain: ${{ matrix.toolchain }}
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- name: Get Rustc version
|
|
|
|
id: get-rustc-version
|
2023-04-11 18:20:09 +00:00
|
|
|
run: echo "version=$(rustc -V)" >> $GITHUB_OUTPUT
|
2021-04-09 15:01:30 +00:00
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Cache Rust dependencies
|
2023-04-11 18:20:09 +00:00
|
|
|
uses: actions/cache@v3.3.1
|
2021-04-09 15:01:30 +00:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry/index
|
|
|
|
~/.cargo/registry/cache
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
2021-05-08 20:41:19 +00:00
|
|
|
key: ${{ runner.os }}-${{ steps.get-rustc-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
|
2021-04-09 15:01:30 +00:00
|
|
|
|
|
|
|
- run: cargo build --workspace --examples
|
|
|
|
- run: cargo test --workspace
|
|
|
|
|
|
|
|
- run: cargo install cargo-hack
|
2021-05-08 20:41:19 +00:00
|
|
|
- run: cargo hack --workspace --remove-dev-deps
|
2021-12-27 10:35:05 +00:00
|
|
|
- run: cargo check --no-default-features
|
|
|
|
- run: cargo check
|
2020-12-15 05:16:10 +00:00
|
|
|
|
|
|
|
test-cross-arm:
|
2021-12-27 10:35:05 +00:00
|
|
|
name: cross +${{ matrix.toolchain }} build ${{ matrix.target }}
|
|
|
|
needs: test-linux
|
2020-12-15 05:16:10 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
continue-on-error: false
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2021-12-27 10:35:05 +00:00
|
|
|
os: [ubuntu-latest]
|
|
|
|
target: [armv7-unknown-linux-gnueabihf]
|
|
|
|
toolchain:
|
2022-07-28 17:32:11 +00:00
|
|
|
- "1.61" # MSRV (Minimum supported rust version)
|
2021-12-27 10:35:05 +00:00
|
|
|
- stable
|
2020-12-15 05:16:10 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2023-04-11 18:20:09 +00:00
|
|
|
uses: actions/checkout@v3.5.0
|
2021-04-09 15:01:30 +00:00
|
|
|
|
2020-12-15 05:16:10 +00:00
|
|
|
- name: Install toolchain
|
2023-04-11 18:20:09 +00:00
|
|
|
uses: actions-rs/toolchain@v1.0.6
|
2020-12-15 05:16:10 +00:00
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
target: ${{ matrix.target }}
|
|
|
|
toolchain: ${{ matrix.toolchain }}
|
|
|
|
override: true
|
2021-04-09 15:01:30 +00:00
|
|
|
|
|
|
|
- name: Get Rustc version
|
|
|
|
id: get-rustc-version
|
2023-04-11 18:20:09 +00:00
|
|
|
run: echo "version=$(rustc -V)" >> $GITHUB_OUTPUT
|
2021-04-09 15:01:30 +00:00
|
|
|
shell: bash
|
|
|
|
|
2021-01-31 01:55:47 +00:00
|
|
|
- name: Cache Rust dependencies
|
2023-04-11 18:20:09 +00:00
|
|
|
uses: actions/cache@v3.3.1
|
2021-01-31 01:55:47 +00:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry/index
|
|
|
|
~/.cargo/registry/cache
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
2021-05-08 20:41:19 +00:00
|
|
|
key: ${{ runner.os }}-${{ matrix.target }}-${{ steps.get-rustc-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
|
2020-12-15 05:16:10 +00:00
|
|
|
- name: Install cross
|
|
|
|
run: cargo install cross || true
|
|
|
|
- name: Build
|
2022-05-21 19:06:29 +00:00
|
|
|
run: cross build --target ${{ matrix.target }} --no-default-features
|
2021-12-27 10:35:05 +00:00
|
|
|
|
|
|
|
clippy:
|
|
|
|
needs: [test-cross-arm, test-windows]
|
|
|
|
name: cargo +${{ matrix.toolchain }} clippy (${{ matrix.os }})
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
continue-on-error: false
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest]
|
|
|
|
toolchain: [stable]
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2023-04-11 18:20:09 +00:00
|
|
|
uses: actions/checkout@v3.5.0
|
2021-12-27 10:35:05 +00:00
|
|
|
|
|
|
|
- name: Install toolchain
|
2023-04-11 18:20:09 +00:00
|
|
|
uses: actions-rs/toolchain@v1.0.6
|
2021-12-27 10:35:05 +00:00
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: ${{ matrix.toolchain }}
|
|
|
|
override: true
|
|
|
|
components: clippy
|
|
|
|
|
|
|
|
- name: Get Rustc version
|
|
|
|
id: get-rustc-version
|
2023-04-11 18:20:09 +00:00
|
|
|
run: echo "version=$(rustc -V)" >> $GITHUB_OUTPUT
|
2021-12-27 10:35:05 +00:00
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Cache Rust dependencies
|
2023-04-11 18:20:09 +00:00
|
|
|
uses: actions/cache@v3.3.1
|
2021-12-27 10:35:05 +00:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry/index
|
|
|
|
~/.cargo/registry/cache
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
|
|
|
key: ${{ runner.os }}-${{ steps.get-rustc-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
|
|
|
|
|
|
|
|
- name: Install developer package dependencies
|
2022-12-03 00:38:39 +00:00
|
|
|
run: sudo apt-get update && sudo apt install -y libunwind-dev && sudo apt-get install libpulse-dev portaudio19-dev libasound2-dev libsdl2-dev gstreamer1.0-dev libgstreamer-plugins-base1.0-dev libavahi-compat-libdnssd-dev
|
2021-12-27 10:35:05 +00:00
|
|
|
|
|
|
|
- run: cargo install cargo-hack
|
|
|
|
- run: cargo hack --workspace --remove-dev-deps
|
|
|
|
- run: cargo clippy -p librespot-core --no-default-features
|
|
|
|
- run: cargo clippy -p librespot-core
|
|
|
|
- run: cargo hack clippy --each-feature -p librespot-discovery
|
|
|
|
- run: cargo hack clippy --each-feature -p librespot-playback
|
|
|
|
- run: cargo hack clippy --each-feature
|
|
|
|
|
|
|
|
fmt:
|
|
|
|
needs: clippy
|
|
|
|
name: cargo +${{ matrix.toolchain }} fmt
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2023-04-11 18:20:09 +00:00
|
|
|
uses: actions/checkout@v3.5.0
|
2021-12-27 10:35:05 +00:00
|
|
|
- name: Install toolchain
|
2023-04-11 18:20:09 +00:00
|
|
|
uses: actions-rs/toolchain@v1.0.6
|
2021-12-27 10:35:05 +00:00
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
|
|
|
components: rustfmt
|
|
|
|
- run: cargo fmt --all -- --check
|