Install correct toolchain on GitHub Actions #649
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- master | |
defaults: | |
run: | |
shell: bash | |
env: | |
# Cache issues can sometimes be fixed by incrementing this value. | |
CACHE_KEY: 6 | |
jobs: | |
all: | |
name: All | |
strategy: | |
matrix: | |
os: | |
- macos-latest | |
- ubuntu-latest | |
- windows-latest | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
runs-on: ${{matrix.os}} | |
env: | |
RUSTFLAGS: --deny warnings | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
# An issue with BSD Tar causes sporadic failures on macOS. | |
# c.f https://github.com/actions/cache/issues/403 | |
- name: Install GNU Tar | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew install gnu-tar | |
echo /usr/local/opt/gnu-tar/libexec/gnubin > $GITHUB_PATH | |
- name: Cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: cargo-${{ env.CACHE_KEY }}-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Rust Toolchain Components | |
uses: actions-rs/toolchain@v1 | |
with: | |
components: clippy, rustfmt | |
override: true | |
target: ${{ matrix.target }} | |
toolchain: 1.56.0 | |
- name: Info | |
run: | | |
rustup --version | |
cargo --version | |
cargo clippy --version | |
- name: Build | |
run: cargo build --all | |
- name: Test | |
run: cargo test --all | |
- name: Clippy | |
run: cargo clippy --all-targets --all-features | |
- name: Lint | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew install ripgrep | |
./bin/lint | |
- name: Check Formatting | |
run: cargo fmt --all -- --check | |
- name: Check Generated | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew install help2man | |
cargo run --package gen -- --bin target/debug/imdl all | |
git diff --no-ext-diff --exit-code | |
- name: Install `mdbook` | |
if: matrix.os != 'windows-latest' | |
uses: peaceiris/actions-mdbook@v1 | |
with: | |
mdbook-version: latest | |
- name: Build Book | |
if: matrix.os != 'windows-latest' | |
run: | | |
cargo run --package gen -- --bin target/debug/imdl book | |
mdbook build book --dest-dir ../www/book | |
- name: Record Git Revision | |
if: github.ref == 'refs/heads/master' && matrix.os == 'ubuntu-latest' | |
run: git rev-parse --verify HEAD > www/head.txt | |
- name: Deploy Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
if: github.ref == 'refs/heads/master' && matrix.os == 'ubuntu-latest' | |
with: | |
github_token: ${{secrets.GITHUB_TOKEN}} | |
publish_branch: gh-pages | |
publish_dir: ./www | |
- name: Package | |
id: package | |
if: startsWith(github.ref, 'refs/tags/') | |
run: ./bin/package ${{github.ref}} ${{matrix.os}} ${{matrix.target}} | |
- name: Publish Release Archive | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
draft: false | |
files: ${{steps.package.outputs.archive}} | |
prerelease: ${{ ! startsWith(github.ref, 'refs/tags/v') }} | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |