161 lines
4.1 KiB
YAML
161 lines
4.1 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- '*'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
all:
|
|
name: All
|
|
|
|
strategy:
|
|
matrix:
|
|
target:
|
|
- aarch64-unknown-linux-gnu
|
|
- x86_64-apple-darwin
|
|
- x86_64-pc-windows-msvc
|
|
- x86_64-unknown-linux-musl
|
|
include:
|
|
- target: x86_64-unknown-linux-musl
|
|
os: ubuntu-latest
|
|
native: true
|
|
- target: x86_64-apple-darwin
|
|
os: macos-latest
|
|
native: true
|
|
- target: x86_64-pc-windows-msvc
|
|
os: windows-2016
|
|
native: true
|
|
- target: aarch64-unknown-linux-gnu
|
|
os: ubuntu-latest
|
|
native: false
|
|
|
|
runs-on: ${{matrix.os}}
|
|
|
|
env:
|
|
RUSTFLAGS: "-D warnings"
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
# 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 Cargo
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ matrix.configration.os }}-${{ matrix.target }} cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Update Ubuntu Packages
|
|
if: matrix.os == 'ubuntu-latest'
|
|
run: |
|
|
sudo apt-get update
|
|
|
|
- name: Install Rust Toolchain
|
|
run: |
|
|
rustup component add clippy
|
|
rustup target add ${{ matrix.target }}
|
|
rustup default `cat rust-toolchain`-${{ matrix.target }}
|
|
|
|
- name: Install AArch64 Toolchain
|
|
if: matrix.target == 'aarch64-unknown-linux-gnu'
|
|
run: sudo apt-get install gcc-aarch64-linux-gnu
|
|
|
|
- name: Info
|
|
run: |
|
|
rustup --version
|
|
cargo --version
|
|
cargo clippy --version
|
|
|
|
- name: Check Lockfile
|
|
run: |
|
|
cargo update --locked --package just
|
|
|
|
- name: Build
|
|
run: cargo build --all --target ${{ matrix.target }}
|
|
|
|
- name: Test
|
|
if: matrix.native
|
|
run: cargo test --all --target ${{ matrix.target }}
|
|
|
|
- name: Clippy
|
|
run: cargo clippy --all --all-targets --all-features
|
|
|
|
- name: Install Rustfmt Toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly
|
|
target: ${{ matrix.target }}
|
|
profile: minimal
|
|
components: rustfmt
|
|
|
|
- name: Format
|
|
run: cargo +nightly fmt --all -- --check
|
|
|
|
- name: Completion Scripts
|
|
if: matrix.os != 'windows-2016'
|
|
run: |
|
|
./bin/generate-completions
|
|
git diff --no-ext-diff --quiet --exit-code
|
|
|
|
- name: Check for Forbidden Words
|
|
if: matrix.os == 'ubuntu-latest'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install ripgrep
|
|
./bin/forbid
|
|
|
|
- name: Prerelease Check
|
|
id: is_prerelease
|
|
run: cargo run --package prerelease -- --reference ${{ github.ref }}
|
|
|
|
- name: Test Install Script With Explicit Target
|
|
if: matrix.os != 'windows-2016' && steps.is_prerelease.outputs.value
|
|
run: |
|
|
cd `mktemp -d`
|
|
cat $GITHUB_WORKSPACE/docs/install.sh | bash -s -- --target ${{ matrix.target }} --to .
|
|
if [[ ${{ matrix.native }} == true ]]; then
|
|
./just --version
|
|
fi
|
|
|
|
- name: Test Install Script Without Explicit Target
|
|
if: matrix.os != 'windows-2016' && steps.is_prerelease.outputs.value
|
|
run: |
|
|
cd `mktemp -d`
|
|
cat $GITHUB_WORKSPACE/docs/install.sh | bash -s -- --to .
|
|
./just --version
|
|
|
|
- name: Package
|
|
id: package
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
run: ./bin/package ${{github.ref}} ${{matrix.os}} ${{ matrix.target }}
|
|
shell: bash
|
|
|
|
- name: Publish
|
|
uses: softprops/action-gh-release@v0.1.5
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
with:
|
|
draft: false
|
|
files: ${{ steps.package.outputs.archive }}
|
|
prerelease: ${{ steps.is_prerelease.outputs.value }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|