2020-02-18 02:48:32 -08:00
|
|
|
name: Build
|
2020-01-15 02:16:13 -08:00
|
|
|
|
2020-03-13 21:20:41 -07:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-03-18 09:13:42 -07:00
|
|
|
tags:
|
2020-06-27 16:38:56 -07:00
|
|
|
- '*'
|
2020-03-13 21:20:41 -07:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-01-15 02:16:13 -08:00
|
|
|
|
2021-05-27 23:16:45 -07:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
2020-01-15 02:16:13 -08:00
|
|
|
jobs:
|
2020-02-18 02:48:32 -08:00
|
|
|
all:
|
2020-03-13 21:20:41 -07:00
|
|
|
name: All
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2020-01-25 19:58:32 -08:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-05-27 18:14:01 -07:00
|
|
|
target:
|
2021-05-27 18:22:59 -07:00
|
|
|
- aarch64-unknown-linux-gnu
|
2021-05-27 18:14:01 -07:00
|
|
|
- x86_64-apple-darwin
|
|
|
|
- x86_64-pc-windows-msvc
|
2021-05-27 18:22:59 -07:00
|
|
|
- x86_64-unknown-linux-musl
|
2020-01-28 02:19:24 -08:00
|
|
|
include:
|
2021-05-27 18:14:01 -07:00
|
|
|
- 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
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2020-01-25 19:58:32 -08:00
|
|
|
runs-on: ${{matrix.os}}
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2020-06-27 16:38:56 -07:00
|
|
|
env:
|
|
|
|
RUSTFLAGS: "-D warnings"
|
|
|
|
|
2020-01-15 02:16:13 -08:00
|
|
|
steps:
|
2020-06-27 16:38:56 -07:00
|
|
|
- uses: actions/checkout@v2
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2021-07-26 17:14:20 -07:00
|
|
|
- name: Download actionlint
|
|
|
|
id: actionlint
|
|
|
|
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
|
|
|
|
|
|
|
|
- name: Check Github Actions Workflow
|
|
|
|
env:
|
|
|
|
SHELLCHECK_OPTS: "-e SC2006 -e SC2002 -e SC2050"
|
|
|
|
run: ${{ steps.actionlint.outputs.executable }} -color
|
|
|
|
|
2020-10-03 13:47:10 -07:00
|
|
|
# An issue with BSD Tar causes sporadic failures on macOS.
|
|
|
|
# c.f https://github.com/actions/cache/issues/403
|
|
|
|
- name: Install GNU Tar
|
2021-07-26 17:14:20 -07:00
|
|
|
if: ${{ matrix.os == 'macos-latest' }}
|
2020-10-03 13:47:10 -07:00
|
|
|
run: |
|
|
|
|
brew install gnu-tar
|
2021-07-26 17:14:20 -07:00
|
|
|
echo /usr/local/opt/gnu-tar/libexec/gnubin > "$GITHUB_PATH"
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2020-11-19 14:47:04 -08:00
|
|
|
- name: Cache Cargo
|
2021-01-07 14:49:13 -08:00
|
|
|
uses: actions/cache@v2
|
2020-03-30 23:39:30 -07:00
|
|
|
with:
|
2020-11-19 14:47:04 -08:00
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
2021-07-26 17:14:20 -07:00
|
|
|
key: ${{ matrix.os }}-${{ matrix.target }} cargo-${{ hashFiles('**/Cargo.lock') }}
|
2021-05-27 18:14:01 -07:00
|
|
|
|
|
|
|
- name: Update Ubuntu Packages
|
2021-07-26 17:14:20 -07:00
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
2021-05-27 18:14:01 -07:00
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2021-06-01 16:37:40 -07:00
|
|
|
- name: Install Rust Toolchain
|
|
|
|
run: |
|
2021-09-16 06:44:40 -07:00
|
|
|
rustup component add clippy rustfmt
|
2021-06-01 16:37:40 -07:00
|
|
|
rustup target add ${{ matrix.target }}
|
2021-07-26 17:14:20 -07:00
|
|
|
rustup default "`cat rust-toolchain`-${{ matrix.target }}"
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2021-05-27 18:14:01 -07:00
|
|
|
- name: Install AArch64 Toolchain
|
2021-07-26 17:14:20 -07:00
|
|
|
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
|
2021-05-27 18:14:01 -07:00
|
|
|
run: sudo apt-get install gcc-aarch64-linux-gnu
|
|
|
|
|
2021-06-01 16:37:40 -07:00
|
|
|
- name: Info
|
2020-01-15 02:16:13 -08:00
|
|
|
run: |
|
|
|
|
rustup --version
|
|
|
|
cargo --version
|
|
|
|
cargo clippy --version
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2021-06-01 16:37:40 -07:00
|
|
|
- name: Check Lockfile
|
|
|
|
run: |
|
|
|
|
cargo update --locked --package just
|
|
|
|
|
2020-01-25 19:58:32 -08:00
|
|
|
- name: Build
|
2021-05-27 18:14:01 -07:00
|
|
|
run: cargo build --all --target ${{ matrix.target }}
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2020-01-25 19:58:32 -08:00
|
|
|
- name: Test
|
2021-07-26 17:14:20 -07:00
|
|
|
if: ${{ matrix.native }}
|
2021-05-27 18:14:01 -07:00
|
|
|
run: cargo test --all --target ${{ matrix.target }}
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2020-01-15 02:30:24 -08:00
|
|
|
- name: Clippy
|
2021-05-07 00:14:38 -07:00
|
|
|
run: cargo clippy --all --all-targets --all-features
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2020-01-15 02:16:13 -08:00
|
|
|
- name: Format
|
2021-09-16 06:44:40 -07:00
|
|
|
run: cargo fmt --all -- --check
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2020-01-15 02:16:13 -08:00
|
|
|
- name: Completion Scripts
|
2021-07-26 17:14:20 -07:00
|
|
|
if: ${{ matrix.os != 'windows-2016' }}
|
2020-01-15 02:16:13 -08:00
|
|
|
run: |
|
2020-03-13 22:19:43 -07:00
|
|
|
./bin/generate-completions
|
2020-01-15 02:16:13 -08:00
|
|
|
git diff --no-ext-diff --quiet --exit-code
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2021-05-10 23:58:05 -07:00
|
|
|
- name: Check for Forbidden Words
|
2021-07-26 17:14:20 -07:00
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
2021-05-10 23:58:05 -07:00
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install ripgrep
|
|
|
|
./bin/forbid
|
|
|
|
|
2021-07-03 21:16:24 -07:00
|
|
|
- name: Ref Type
|
|
|
|
id: ref-type
|
|
|
|
run: cargo run --package ref-type -- --reference ${{ github.ref }}
|
2021-07-03 15:30:16 -07:00
|
|
|
|
2021-05-27 23:16:45 -07:00
|
|
|
- name: Test Install Script With Explicit Target
|
2021-07-26 17:14:20 -07:00
|
|
|
if: ${{ matrix.os != 'windows-2016' && steps.ref-type.outputs.value != 'release' }}
|
2021-05-27 23:16:45 -07:00
|
|
|
run: |
|
2021-07-26 17:14:20 -07:00
|
|
|
cd "`mktemp -d`"
|
|
|
|
cat "$GITHUB_WORKSPACE/docs/install.sh" | bash -s -- --target ${{ matrix.target }} --to .
|
2021-05-27 23:16:45 -07:00
|
|
|
if [[ ${{ matrix.native }} == true ]]; then
|
|
|
|
./just --version
|
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Test Install Script Without Explicit Target
|
2021-07-26 17:14:20 -07:00
|
|
|
if: ${{ matrix.os != 'windows-2016' && steps.ref-type.outputs.value != 'release' }}
|
2021-05-27 23:16:45 -07:00
|
|
|
run: |
|
2021-07-26 17:14:20 -07:00
|
|
|
cd "`mktemp -d`"
|
|
|
|
cat "$GITHUB_WORKSPACE/docs/install.sh" | bash -s -- --to .
|
2021-05-27 23:16:45 -07:00
|
|
|
./just --version
|
|
|
|
|
2020-01-28 02:19:24 -08:00
|
|
|
- name: Package
|
|
|
|
id: package
|
2021-07-26 17:14:20 -07:00
|
|
|
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
2020-01-28 02:19:24 -08:00
|
|
|
run: ./bin/package ${{github.ref}} ${{matrix.os}} ${{ matrix.target }}
|
|
|
|
shell: bash
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2021-07-09 16:58:35 -07:00
|
|
|
- name: Publish Archive
|
2021-06-01 16:37:40 -07:00
|
|
|
uses: softprops/action-gh-release@v0.1.5
|
2021-07-26 17:14:20 -07:00
|
|
|
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
2020-01-28 02:19:24 -08:00
|
|
|
with:
|
|
|
|
draft: false
|
|
|
|
files: ${{ steps.package.outputs.archive }}
|
2021-07-09 16:58:35 -07:00
|
|
|
prerelease: ${{ steps.ref-type.outputs.value != 'release' }}
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Publish Changelog
|
|
|
|
uses: softprops/action-gh-release@v0.1.5
|
2021-07-26 17:14:20 -07:00
|
|
|
if: >-
|
|
|
|
${{
|
|
|
|
startsWith(github.ref, 'refs/tags/')
|
|
|
|
&& matrix.target == 'x86_64-unknown-linux-musl'
|
|
|
|
}}
|
2021-07-09 16:58:35 -07:00
|
|
|
with:
|
|
|
|
draft: false
|
|
|
|
files: CHANGELOG.md
|
|
|
|
prerelease: ${{ steps.ref-type.outputs.value != 'release' }}
|
2020-01-28 02:19:24 -08:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|