Cache build artifacts
Use `actions/cache` to cache cargo registry, index, and build between workflow runs. type: development
This commit is contained in:
parent
83ee172b72
commit
2515399081
38
.github/workflows/build.yaml
vendored
38
.github/workflows/build.yaml
vendored
|
@ -13,6 +13,7 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
all:
|
all:
|
||||||
name: All
|
name: All
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
|
@ -26,11 +27,33 @@ 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}}
|
||||||
|
|
||||||
env:
|
env:
|
||||||
RUSTFLAGS: "-D warnings"
|
RUSTFLAGS: "-D warnings"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- 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 Stable
|
- name: Install Stable
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
|
@ -39,20 +62,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: ./bin/lint
|
run: ./bin/lint
|
||||||
|
|
||||||
- name: Install Nightly
|
- name: Install Nightly
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
|
@ -60,27 +89,34 @@ 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: Readme
|
- name: Readme
|
||||||
if: matrix.os != 'windows-latest'
|
if: matrix.os != 'windows-latest'
|
||||||
run: |
|
run: |
|
||||||
cargo run --package update-readme toc
|
cargo run --package update-readme toc
|
||||||
git diff --no-ext-diff --quiet --exit-code
|
git diff --no-ext-diff --quiet --exit-code
|
||||||
|
|
||||||
- name: Install `mdbook`
|
- name: Install `mdbook`
|
||||||
uses: peaceiris/actions-mdbook@v1
|
uses: peaceiris/actions-mdbook@v1
|
||||||
with:
|
with:
|
||||||
mdbook-version: latest
|
mdbook-version: latest
|
||||||
|
|
||||||
- name: Build Book
|
- name: Build Book
|
||||||
run: mdbook build book --dest-dir ../www/book
|
run: mdbook build book --dest-dir ../www/book
|
||||||
|
|
||||||
- name: Record Git Revision
|
- name: Record Git Revision
|
||||||
if: github.ref == 'refs/heads/master' && matrix.os == 'ubuntu-latest'
|
if: github.ref == 'refs/heads/master' && matrix.os == 'ubuntu-latest'
|
||||||
run: git rev-parse --verify HEAD > www/head.txt
|
run: git rev-parse --verify HEAD > www/head.txt
|
||||||
|
|
||||||
- name: Deploy Pages
|
- name: Deploy Pages
|
||||||
uses: peaceiris/actions-gh-pages@v3
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
if: github.ref == 'refs/heads/master' && matrix.os == 'ubuntu-latest'
|
if: github.ref == 'refs/heads/master' && matrix.os == 'ubuntu-latest'
|
||||||
|
@ -88,11 +124,13 @@ jobs:
|
||||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||||
publish_branch: gh-pages
|
publish_branch: gh-pages
|
||||||
publish_dir: ./www
|
publish_dir: ./www
|
||||||
|
|
||||||
- name: Package
|
- name: Package
|
||||||
id: package
|
id: package
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./bin/package ${{github.ref}} ${{matrix.os}} ${{matrix.target}}
|
run: ./bin/package ${{github.ref}} ${{matrix.os}} ${{matrix.target}}
|
||||||
|
|
||||||
- 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