mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Improve CI
Run the tests and add build for Windows.
This commit is contained in:
parent
ff499825e0
commit
317e586472
1 changed files with 104 additions and 33 deletions
137
.github/workflows/test.yml
vendored
137
.github/workflows/test.yml
vendored
|
@ -4,36 +4,49 @@ name: test
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [master, dev]
|
branches: [master, dev]
|
||||||
paths: ['**.rs', '**.toml', '**.lock', '**.yml']
|
paths:
|
||||||
|
[
|
||||||
|
"**.rs",
|
||||||
|
"Cargo.toml",
|
||||||
|
"/Cargo.lock",
|
||||||
|
"/rustfmt.toml",
|
||||||
|
"/.github/workflows",
|
||||||
|
]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [master, dev]
|
paths:
|
||||||
paths: ['**.rs', '**.toml', '**.lock', '**.yml']
|
[
|
||||||
|
"**.rs",
|
||||||
|
"Cargo.toml",
|
||||||
|
"/Cargo.lock",
|
||||||
|
"/rustfmt.toml",
|
||||||
|
"/.github/workflows",
|
||||||
|
]
|
||||||
|
schedule:
|
||||||
|
# Run CI every week
|
||||||
|
- cron: "00 01 * * 0"
|
||||||
|
|
||||||
|
env:
|
||||||
|
RUST_BACKTRACE: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
fmt:
|
fmt:
|
||||||
name: 'Rust: format check'
|
name: rustfmt
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
# Only run the formatting check for stable
|
|
||||||
include:
|
|
||||||
- os: ubuntu-latest
|
|
||||||
toolchain: stable
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Install toolchain
|
- name: Install toolchain
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
# Use default profile to get rustfmt
|
profile: minimal
|
||||||
profile: default
|
toolchain: stable
|
||||||
toolchain: ${{ matrix.toolchain }}
|
|
||||||
override: true
|
override: true
|
||||||
- run: cargo fmt --verbose --all -- --check
|
components: rustfmt
|
||||||
|
- run: cargo fmt --all -- --check
|
||||||
|
|
||||||
test:
|
test-linux:
|
||||||
needs: fmt
|
needs: fmt
|
||||||
|
name: cargo +${{ matrix.toolchain }} build (${{ matrix.os }})
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
continue-on-error: ${{ matrix.experimental }}
|
continue-on-error: ${{ matrix.experimental }}
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -45,7 +58,7 @@ jobs:
|
||||||
- stable
|
- stable
|
||||||
- beta
|
- beta
|
||||||
experimental: [false]
|
experimental: [false]
|
||||||
# Ignore failures in nightly, not ideal, but necessary
|
# Ignore failures in nightly
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
toolchain: nightly
|
toolchain: nightly
|
||||||
|
@ -53,12 +66,19 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Install toolchain
|
- name: Install toolchain
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
profile: minimal
|
||||||
toolchain: ${{ matrix.toolchain }}
|
toolchain: ${{ matrix.toolchain }}
|
||||||
override: true
|
override: true
|
||||||
|
|
||||||
|
- name: Get Rustc version
|
||||||
|
id: get-rustc-version
|
||||||
|
run: echo "::set-output name=version::$(rustc -V)"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- name: Cache Rust dependencies
|
- name: Cache Rust dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
|
@ -67,21 +87,65 @@ jobs:
|
||||||
~/.cargo/registry/cache
|
~/.cargo/registry/cache
|
||||||
~/.cargo/git
|
~/.cargo/git
|
||||||
target
|
target
|
||||||
key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock') }}
|
key: ${{ runner.os }}-${{ steps.get-rustc-version.outputs.version }}-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
- name: Install developer package dependencies
|
- name: Install developer package dependencies
|
||||||
run: sudo apt-get update && sudo apt-get install libpulse-dev portaudio19-dev libasound2-dev libsdl2-dev gstreamer1.0-dev libgstreamer-plugins-base1.0-dev
|
run: sudo apt-get update && 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 build --locked --no-default-features
|
|
||||||
- run: cargo build --locked --examples
|
- run: cargo build --workspace --examples
|
||||||
- run: cargo build --locked --no-default-features --features "with-tremor"
|
- run: cargo test --workspace
|
||||||
- run: cargo build --locked --no-default-features --features "with-vorbis"
|
|
||||||
- run: cargo build --locked --no-default-features --features "alsa-backend"
|
- run: cargo install cargo-hack
|
||||||
- run: cargo build --locked --no-default-features --features "portaudio-backend"
|
- run: cargo hack --workspace --remove-dev-deps
|
||||||
- run: cargo build --locked --no-default-features --features "pulseaudio-backend"
|
- run: cargo build -p librespot-core --no-default-features
|
||||||
- run: cargo build --locked --no-default-features --features "jackaudio-backend"
|
- run: cargo build -p librespot-core
|
||||||
- run: cargo build --locked --no-default-features --features "rodiojack-backend"
|
- run: cargo hack build --each-feature -p librespot-audio
|
||||||
- run: cargo build --locked --no-default-features --features "rodio-backend"
|
- run: cargo build -p librespot-connect
|
||||||
- run: cargo build --locked --no-default-features --features "sdl-backend"
|
- run: cargo build -p librespot-connect --no-default-features --features with-dns-sd
|
||||||
- run: cargo build --locked --no-default-features --features "gstreamer-backend"
|
- run: cargo hack build --locked --each-feature
|
||||||
|
|
||||||
|
test-windows:
|
||||||
|
needs: fmt
|
||||||
|
name: cargo build (${{ matrix.os }})
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [windows-latest]
|
||||||
|
toolchain: [stable]
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: ${{ matrix.toolchain }}
|
||||||
|
profile: minimal
|
||||||
|
override: true
|
||||||
|
|
||||||
|
- name: Get Rustc version
|
||||||
|
id: get-rustc-version
|
||||||
|
run: echo "::set-output name=version::$(rustc -V)"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Cache Rust dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry/index
|
||||||
|
~/.cargo/registry/cache
|
||||||
|
~/.cargo/git
|
||||||
|
target
|
||||||
|
key: ${{ runner.os }}-${{ steps.get-rustc-version.outputs.version }}-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- run: cargo build --workspace --examples
|
||||||
|
- run: cargo test --workspace
|
||||||
|
|
||||||
|
- run: cargo install cargo-hack
|
||||||
|
- run: cargo hack --workspace --remove-dev-deps
|
||||||
|
- run: cargo build --no-default-features
|
||||||
|
- run: cargo build
|
||||||
|
|
||||||
test-cross-arm:
|
test-cross-arm:
|
||||||
needs: fmt
|
needs: fmt
|
||||||
|
@ -97,6 +161,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Install toolchain
|
- name: Install toolchain
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
|
@ -104,6 +169,12 @@ jobs:
|
||||||
target: ${{ matrix.target }}
|
target: ${{ matrix.target }}
|
||||||
toolchain: ${{ matrix.toolchain }}
|
toolchain: ${{ matrix.toolchain }}
|
||||||
override: true
|
override: true
|
||||||
|
|
||||||
|
- name: Get Rustc version
|
||||||
|
id: get-rustc-version
|
||||||
|
run: echo "::set-output name=version::$(rustc -V)"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- name: Cache Rust dependencies
|
- name: Cache Rust dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
|
@ -112,7 +183,7 @@ jobs:
|
||||||
~/.cargo/registry/cache
|
~/.cargo/registry/cache
|
||||||
~/.cargo/git
|
~/.cargo/git
|
||||||
target
|
target
|
||||||
key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock') }}
|
key: ${{ runner.os }}-${{ matrix.target }}-${{ steps.get-rustc-version.outputs.version }}-${{ hashFiles('**/Cargo.lock') }}
|
||||||
- name: Install cross
|
- name: Install cross
|
||||||
run: cargo install cross || true
|
run: cargo install cross || true
|
||||||
- name: Build
|
- name: Build
|
||||||
|
|
Loading…
Reference in a new issue