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
|
2024-09-16 17:42:55 +00:00
|
|
|
RUSTFLAGS: -D warnings
|
2020-12-15 05:16:10 +00:00
|
|
|
|
2023-04-12 17:58:20 +00:00
|
|
|
# The layering here is as follows:
|
|
|
|
# 1. code formatting
|
|
|
|
# 2. absence of lints
|
|
|
|
# 3. absence of errors and warnings on Linux/x86
|
|
|
|
# 4. cross compilation on Windows and Linux/ARM
|
2020-12-15 05:16:10 +00:00
|
|
|
|
2021-12-27 10:35:05 +00:00
|
|
|
jobs:
|
2023-04-12 17:58:20 +00:00
|
|
|
fmt:
|
|
|
|
name: cargo fmt
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2024-10-12 16:45:41 +00:00
|
|
|
uses: actions/checkout@v4.2.1
|
2023-04-12 17:58:20 +00:00
|
|
|
- name: Install toolchain
|
|
|
|
run: curl https://sh.rustup.rs -sSf | sh -s -- --profile default --default-toolchain stable -y
|
|
|
|
- run: cargo fmt --all -- --check
|
|
|
|
|
|
|
|
clippy:
|
|
|
|
needs: fmt
|
|
|
|
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
|
2024-10-12 16:45:41 +00:00
|
|
|
uses: actions/checkout@v4.2.1
|
2023-04-12 17:58:20 +00:00
|
|
|
|
|
|
|
- name: Install toolchain
|
|
|
|
run: curl https://sh.rustup.rs -sSf | sh -s -- --profile default --default-toolchain ${{ matrix.toolchain }} -y
|
|
|
|
|
|
|
|
- name: Get Rustc version
|
|
|
|
id: get-rustc-version
|
|
|
|
run: echo "version=$(rustc -V)" >> $GITHUB_OUTPUT
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Cache Rust dependencies
|
2024-10-12 16:45:30 +00:00
|
|
|
uses: actions/cache@v4.1.1
|
2023-04-12 17:58:20 +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
|
|
|
|
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
|
|
|
|
|
|
|
|
- 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
|
|
|
|
|
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 }}
|
2023-04-12 17:58:20 +00:00
|
|
|
needs: clippy
|
2020-12-15 05:16:10 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest]
|
|
|
|
toolchain:
|
2024-08-27 21:16:48 +00:00
|
|
|
- "1.74" # 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
|
2024-10-12 16:45:41 +00:00
|
|
|
uses: actions/checkout@v4.2.1
|
2021-04-09 15:01:30 +00:00
|
|
|
|
2020-12-15 05:16:10 +00:00
|
|
|
- name: Install toolchain
|
2023-04-11 20:34:58 +00:00
|
|
|
run: curl https://sh.rustup.rs -sSf | sh -s -- --profile minimal --default-toolchain ${{ matrix.toolchain }} -y
|
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
|
2024-10-12 16:45:30 +00:00
|
|
|
uses: actions/cache@v4.1.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 }}-${{ 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
|
|
|
|
2024-09-17 14:37:20 +00:00
|
|
|
- run: cargo fetch --locked
|
|
|
|
- run: cargo build --frozen --workspace --examples
|
2021-04-09 15:01:30 +00:00
|
|
|
- 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:
|
2024-09-13 05:40:22 +00:00
|
|
|
needs: clippy
|
2021-12-27 10:35:05 +00:00
|
|
|
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:
|
2024-08-27 21:16:48 +00:00
|
|
|
- "1.74" # 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
|
2024-10-12 16:45:41 +00:00
|
|
|
uses: actions/checkout@v4.2.1
|
2024-08-29 13:33:40 +00:00
|
|
|
|
|
|
|
# hyper-rustls >=0.27 uses aws-lc as default backend which requires NASM to build
|
|
|
|
- name: Install NASM
|
|
|
|
uses: ilammy/setup-nasm@v1.5.1
|
2021-04-09 15:01:30 +00:00
|
|
|
|
|
|
|
- name: Install toolchain
|
2023-04-11 20:34:58 +00:00
|
|
|
run: curl https://sh.rustup.rs -sSf | sh -s -- --profile minimal --default-toolchain ${{ matrix.toolchain }} -y
|
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
|
|
|
|
|
|
|
|
- name: Cache Rust dependencies
|
2024-10-12 16:45:30 +00:00
|
|
|
uses: actions/cache@v4.1.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
|
|
|
|
2024-09-17 14:37:20 +00:00
|
|
|
- run: cargo fetch --locked
|
|
|
|
- run: cargo build --frozen --workspace --examples
|
2021-04-09 15:01:30 +00:00
|
|
|
- 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
|
|
|
|
2024-09-14 16:46:14 +00:00
|
|
|
test-cross-linux:
|
2021-12-27 10:35:05 +00:00
|
|
|
name: cross +${{ matrix.toolchain }} build ${{ matrix.target }}
|
2024-09-13 05:40:22 +00:00
|
|
|
needs: clippy
|
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]
|
2024-09-14 16:46:14 +00:00
|
|
|
target:
|
|
|
|
- armv7-unknown-linux-gnueabihf
|
|
|
|
- aarch64-unknown-linux-gnu
|
|
|
|
- riscv64gc-unknown-linux-gnu
|
2021-12-27 10:35:05 +00:00
|
|
|
toolchain:
|
2024-08-27 21:16:48 +00:00
|
|
|
- "1.74" # 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
|
2024-10-12 16:45:41 +00:00
|
|
|
uses: actions/checkout@v4.2.1
|
2021-04-09 15:01:30 +00:00
|
|
|
|
2020-12-15 05:16:10 +00:00
|
|
|
- name: Install toolchain
|
2023-04-11 20:34:58 +00:00
|
|
|
run: curl https://sh.rustup.rs -sSf | sh -s -- --profile minimal --default-toolchain ${{ matrix.toolchain }} -y
|
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
|
2024-10-12 16:45:30 +00:00
|
|
|
uses: actions/cache@v4.1.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') }}
|
2024-08-29 13:46:03 +00:00
|
|
|
|
2024-09-13 05:40:22 +00:00
|
|
|
- name: Install the cross compiler rust targets
|
2024-08-29 13:46:03 +00:00
|
|
|
run: rustup target add ${{ matrix.target }}
|
|
|
|
|
2024-09-13 05:40:22 +00:00
|
|
|
- name: Install cross compiler
|
|
|
|
run: |
|
|
|
|
if [ ${{ matrix.target }} = "armv7-unknown-linux-gnueabihf" ]; then
|
|
|
|
sudo apt-get install -y gcc-arm-linux-gnueabihf
|
|
|
|
fi
|
2024-09-14 16:46:14 +00:00
|
|
|
if [ ${{ matrix.target }} = "aarch64-unknown-linux-gnu" ]; then
|
|
|
|
sudo apt-get install -y gcc-aarch64-linux-gnu
|
|
|
|
fi
|
|
|
|
if [ ${{ matrix.target }} = "riscv64gc-unknown-linux-gnu" ]; then
|
|
|
|
sudo apt-get install -y gcc-riscv64-linux-gnu
|
|
|
|
fi
|
2024-09-13 05:40:22 +00:00
|
|
|
|
|
|
|
- name: Set target link compiler
|
|
|
|
run: |
|
|
|
|
# Convert target to uppercase and replace - with _
|
|
|
|
target=${{ matrix.target }}
|
|
|
|
target=${target^^}
|
|
|
|
target=${target//-/_}
|
|
|
|
if [ ${{ matrix.target }} = "armv7-unknown-linux-gnueabihf" ]; then
|
|
|
|
echo "CARGO_TARGET_${target}_LINKER=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV
|
|
|
|
fi
|
2024-09-14 16:46:14 +00:00
|
|
|
if [ ${{ matrix.target }} = "aarch64-unknown-linux-gnu" ]; then
|
|
|
|
echo "CARGO_TARGET_${target}_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
|
|
|
|
fi
|
|
|
|
if [ ${{ matrix.target }} = "riscv64gc-unknown-linux-gnu" ]; then
|
|
|
|
echo "CARGO_TARGET_${target}_LINKER=riscv64-linux-gnu-gcc" >> $GITHUB_ENV
|
|
|
|
fi
|
|
|
|
|
2024-09-17 14:37:20 +00:00
|
|
|
- name: Fetch
|
|
|
|
run: cargo fetch --locked
|
2020-12-15 05:16:10 +00:00
|
|
|
- name: Build
|
2024-09-17 14:37:20 +00:00
|
|
|
run: cargo build --frozen --verbose --target ${{ matrix.target }} --no-default-features
|
2024-08-29 13:46:03 +00:00
|
|
|
|
|
|
|
- name: Check binary
|
|
|
|
run: file target/${{ matrix.target }}/debug/librespot
|