Cache build artifacts (#620)
Use `actions/cache` to cache cargo registry, index, and build between workflow runs.
This commit is contained in:
parent
42c22b5744
commit
1f8c230512
33
.github/workflows/main.yaml
vendored
33
.github/workflows/main.yaml
vendored
@ -13,6 +13,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
all:
|
all:
|
||||||
name: All
|
name: All
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
@ -26,9 +27,31 @@ jobs:
|
|||||||
target: x86_64-apple-darwin
|
target: x86_64-apple-darwin
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
target: x86_64-pc-windows-msvc
|
target: x86_64-pc-windows-msvc
|
||||||
|
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Cache cargo registry
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/registry
|
||||||
|
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Cache cargo index
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/git
|
||||||
|
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Cache cargo build
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: target
|
||||||
|
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
- name: Install Main Toolchain
|
- name: Install Main Toolchain
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
@ -37,20 +60,26 @@ jobs:
|
|||||||
profile: minimal
|
profile: minimal
|
||||||
components: clippy, rustfmt
|
components: clippy, rustfmt
|
||||||
override: true
|
override: true
|
||||||
|
|
||||||
- name: Version
|
- name: Version
|
||||||
run: |
|
run: |
|
||||||
rustup --version
|
rustup --version
|
||||||
cargo --version
|
cargo --version
|
||||||
cargo clippy --version
|
cargo clippy --version
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo build --all --verbose
|
run: cargo build --all --verbose
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: cargo test --all --verbose
|
run: cargo test --all --verbose
|
||||||
|
|
||||||
- name: Clippy
|
- name: Clippy
|
||||||
run: cargo clippy --all
|
run: cargo clippy --all
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
if: matrix.os != 'windows-latest'
|
if: matrix.os != 'windows-latest'
|
||||||
run: cargo run lint
|
run: cargo run lint
|
||||||
|
|
||||||
- name: Install Rustfmt Toolchain
|
- name: Install Rustfmt Toolchain
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
@ -58,18 +87,22 @@ jobs:
|
|||||||
target: ${{ matrix.target }}
|
target: ${{ matrix.target }}
|
||||||
profile: minimal
|
profile: minimal
|
||||||
components: rustfmt
|
components: rustfmt
|
||||||
|
|
||||||
- name: Format
|
- name: Format
|
||||||
run: cargo +nightly fmt --all -- --check
|
run: cargo +nightly fmt --all -- --check
|
||||||
|
|
||||||
- name: Completion Scripts
|
- name: Completion Scripts
|
||||||
if: matrix.os != 'windows-latest'
|
if: matrix.os != 'windows-latest'
|
||||||
run: |
|
run: |
|
||||||
./bin/generate-completions
|
./bin/generate-completions
|
||||||
git diff --no-ext-diff --quiet --exit-code
|
git diff --no-ext-diff --quiet --exit-code
|
||||||
|
|
||||||
- name: Package
|
- name: Package
|
||||||
id: package
|
id: package
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
run: ./bin/package ${{github.ref}} ${{matrix.os}} ${{ matrix.target }}
|
run: ./bin/package ${{github.ref}} ${{matrix.os}} ${{ matrix.target }}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Publish
|
- name: Publish
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
Loading…
Reference in New Issue
Block a user