Skip to content

Commit

Permalink
Improve caching of CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannesd3 committed Apr 9, 2021
1 parent e947ccf commit 9979616
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
components: rustfmt
- run: cargo fmt --all -- --check

test:
test-linux:
needs: fmt
name: cargo +${{ matrix.toolchain }} build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -74,6 +74,11 @@ jobs:
toolchain: ${{ matrix.toolchain }}
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:
Expand All @@ -82,7 +87,7 @@ jobs:
~/.cargo/registry/cache
~/.cargo/git
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
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
Expand All @@ -93,7 +98,7 @@ jobs:
- run: cargo install cargo-hack
- run: cargo hack --workspace --remove-dev-deps
- run: cargo build -p librespot-core --no-default-features
- run: cargo build -p librespot-core
- run: cargo build -p librespot-core
- run: cargo hack build --each-feature -p librespot-audio
- run: cargo build -p librespot-connect
- run: cargo build -p librespot-connect --no-default-features --features with-dns-sd
Expand All @@ -119,6 +124,11 @@ jobs:
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:
Expand All @@ -127,7 +137,7 @@ jobs:
~/.cargo/registry/cache
~/.cargo/git
target
key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-${{ steps.get-rustc-version.outputs.version }}-${{ hashFiles('**/Cargo.lock') }}

- run: cargo build --workspace --examples
- run: cargo test --workspace
Expand Down Expand Up @@ -162,6 +172,11 @@ jobs:
toolchain: ${{ matrix.toolchain }}
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:
Expand All @@ -170,7 +185,7 @@ jobs:
~/.cargo/registry/cache
~/.cargo/git
target
key: ${{ runner.os }}-build-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-${{ matrix.target }}-${{ steps.get-rustc-version.outputs.version }}-${{ hashFiles('**/Cargo.lock') }}
- name: Install cross
run: cargo install cross || true
- name: Build
Expand Down

0 comments on commit 9979616

Please sign in to comment.