Update GitHub actions workflows #695
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: | |
RUSTFLAGS: --deny warnings | |
jobs: | |
all: | |
name: All | |
strategy: | |
matrix: | |
target: | |
- aarch64-apple-darwin | |
- aarch64-pc-windows-msvc | |
- aarch64-unknown-linux-musl | |
- arm-unknown-linux-musleabihf | |
- armv7-unknown-linux-musleabihf | |
- x86_64-apple-darwin | |
- x86_64-pc-windows-msvc | |
- x86_64-unknown-linux-musl | |
include: | |
- target: aarch64-apple-darwin | |
os: macos-latest | |
target_rustflags: '' | |
- target: aarch64-pc-windows-msvc | |
os: windows-latest | |
target_rustflags: '' | |
- target: aarch64-unknown-linux-musl | |
os: ubuntu-latest | |
target_rustflags: '--codegen linker=aarch64-linux-gnu-gcc' | |
- target: arm-unknown-linux-musleabihf | |
os: ubuntu-latest | |
target_rustflags: '--codegen linker=arm-linux-gnueabihf-gcc' | |
- target: armv7-unknown-linux-musleabihf | |
os: ubuntu-latest | |
target_rustflags: '--codegen linker=arm-linux-gnueabihf-gcc' | |
- target: x86_64-apple-darwin | |
os: macos-latest | |
target_rustflags: '' | |
- target: x86_64-pc-windows-msvc | |
os: windows-latest | |
- target: x86_64-unknown-linux-musl | |
os: ubuntu-latest | |
target_rustflags: '' | |
runs-on: ${{matrix.os}} | |
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: Install Rust Toolchain Components | |
uses: actions-rs/toolchain@v1 | |
with: | |
components: clippy, rustfmt | |
override: true | |
target: ${{ matrix.target }} | |
toolchain: stable | |
- uses: Swatinem/rust-cache@v2 | |
- 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.target == 'x86_64-apple-darwin' | |
run: | | |
brew install ripgrep | |
./bin/lint | |
- name: Check Formatting | |
run: cargo fmt --all -- --check | |
- name: Check Generated | |
if: matrix.target == 'x86_64-apple-darwin' | |
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@v2 | |
with: | |
mdbook-version: 0.4.40 | |
- 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 == 'x86_64-unknown-linux-musl' | |
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 == 'x86_64-unknown-linux-musl' | |
with: | |
github_token: ${{secrets.GITHUB_TOKEN}} | |
publish_branch: gh-pages | |
publish_dir: ./www | |
- name: Install AArch64 Toolchain | |
if: ${{ matrix.target == 'aarch64-unknown-linux-musl' }} | |
run: | | |
sudo apt-get update | |
sudo apt-get install gcc-aarch64-linux-gnu libc6-dev-i386 | |
- name: Install ARM Toolchain | |
if: ${{ matrix.target == 'arm-unknown-linux-musleabihf' || matrix.target == 'armv7-unknown-linux-musleabihf' }} | |
run: | | |
sudo apt-get update | |
sudo apt-get install gcc-arm-linux-gnueabihf | |
- name: Install AArch64 Toolchain (Windows) | |
if: ${{ matrix.target == 'aarch64-pc-windows-msvc' }} | |
run: | | |
rustup target add aarch64-pc-windows-msvc | |
- name: Package | |
id: package | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
TARGET: ${{ matrix.target }} | |
REF: ${{ github.ref }} | |
OS: ${{ matrix.os }} | |
TARGET_RUSTFLAGS: ${{ matrix.target_rustflags }} | |
run: ./bin/package | |
- 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}} |