ci: Cache xtask and reuse it between jobs
This commit is contained in:
parent
f60202c554
commit
191a747541
88
.github/workflows/ci.yml
vendored
88
.github/workflows/ci.yml
vendored
@ -10,8 +10,37 @@ on:
|
||||
branches: [main, next]
|
||||
|
||||
jobs:
|
||||
xtask:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Check xtask cache
|
||||
uses: actions/cache@v3
|
||||
id: xtask-cache
|
||||
with:
|
||||
path: target/debug/xtask
|
||||
key: xtask-${{ hashFiles('xtask/src/**', 'xtask/Cargo.toml') }}
|
||||
|
||||
- name: Install rust stable toolchain
|
||||
if: steps.xtask-cache.outputs.cache-hit != 'true'
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- name: Build
|
||||
if: steps.xtask-cache.outputs.cache-hit != 'true'
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: build
|
||||
args: -p xtask
|
||||
|
||||
style:
|
||||
name: Style
|
||||
needs: xtask
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
@ -34,14 +63,18 @@ jobs:
|
||||
with:
|
||||
crate: cargo-sort
|
||||
|
||||
- name: Run lints
|
||||
uses: actions-rs/cargo@v1
|
||||
- name: Get xtask
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
command: run
|
||||
args: -p xtask --no-default-features ci lint
|
||||
path: target/debug/xtask
|
||||
key: xtask-${{ hashFiles('xtask/src/**', 'xtask/Cargo.toml') }}
|
||||
|
||||
- name: Run lints
|
||||
run: target/debug/xtask ci lint
|
||||
|
||||
msrv:
|
||||
name: Rust 1.60 / ${{ matrix.name }}
|
||||
needs: xtask
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
@ -86,14 +119,18 @@ jobs:
|
||||
# fresh cache.
|
||||
sharedKey: msrv1.60
|
||||
|
||||
- name: Run checks
|
||||
uses: actions-rs/cargo@v1
|
||||
- name: Get xtask
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
command: run
|
||||
args: -p xtask --no-default-features ci ${{ matrix.cmd }}
|
||||
path: target/debug/xtask
|
||||
key: xtask-${{ hashFiles('xtask/src/**', 'xtask/Cargo.toml') }}
|
||||
|
||||
- name: Run checks
|
||||
run: target/debug/xtask ci ${{ matrix.cmd }}
|
||||
|
||||
stable:
|
||||
name: Rust Stable / ${{ matrix.name }}
|
||||
needs: xtask
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
@ -129,14 +166,18 @@ jobs:
|
||||
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
|
||||
- name: Run checks
|
||||
uses: actions-rs/cargo@v1
|
||||
- name: Get xtask
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
command: run
|
||||
args: -p xtask --no-default-features ci ${{ matrix.cmd }}
|
||||
path: target/debug/xtask
|
||||
key: xtask-${{ hashFiles('xtask/src/**', 'xtask/Cargo.toml') }}
|
||||
|
||||
- name: Run checks
|
||||
run: target/debug/xtask ci ${{ matrix.cmd }}
|
||||
|
||||
nightly:
|
||||
name: Rust Nightly / ${{ matrix.name }}
|
||||
needs: xtask
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
@ -173,14 +214,18 @@ jobs:
|
||||
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
|
||||
- name: Run checks
|
||||
uses: actions-rs/cargo@v1
|
||||
- name: Get xtask
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
command: run
|
||||
args: -p xtask --no-default-features ci ${{ matrix.cmd }}
|
||||
path: target/debug/xtask
|
||||
key: xtask-${{ hashFiles('xtask/src/**', 'xtask/Cargo.toml') }}
|
||||
|
||||
- name: Run checks
|
||||
run: target/debug/xtask ci ${{ matrix.cmd }}
|
||||
|
||||
docs:
|
||||
name: Docs
|
||||
needs: xtask
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
@ -196,11 +241,14 @@ jobs:
|
||||
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
|
||||
- name: Build docs
|
||||
uses: actions-rs/cargo@v1
|
||||
- name: Get xtask
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
command: run
|
||||
args: -p xtask --no-default-features -- doc --deny-warnings
|
||||
path: target/debug/xtask
|
||||
key: xtask-${{ hashFiles('xtask/src/**', 'xtask/Cargo.toml') }}
|
||||
|
||||
- name: Build docs
|
||||
run: target/debug/xtask doc --deny-warnings
|
||||
|
||||
- name: Deploy to docs branch
|
||||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user