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
|
|
|
|
|
|
|
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:
|
|
|
|
os:
|
|
|
|
- macos-latest
|
|
|
|
- ubuntu-latest
|
2020-08-05 19:20:11 -07:00
|
|
|
- windows-2016
|
2020-01-28 02:19:24 -08:00
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
target: x86_64-unknown-linux-musl
|
|
|
|
- os: macos-latest
|
|
|
|
target: x86_64-apple-darwin
|
2020-08-05 19:20:11 -07:00
|
|
|
- os: windows-2016
|
2020-01-28 02:19:24 -08:00
|
|
|
target: x86_64-pc-windows-msvc
|
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
|
|
|
|
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
|
2020-10-04 13:23:27 -07:00
|
|
|
if: matrix.os == 'macos-latest'
|
2020-10-03 13:47:10 -07:00
|
|
|
run: |
|
|
|
|
brew install gnu-tar
|
2020-11-19 14:47:04 -08: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
|
|
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2020-02-10 20:07:06 -08:00
|
|
|
- name: Install Main Toolchain
|
2020-01-15 02:16:13 -08:00
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
2020-01-28 02:19:24 -08:00
|
|
|
target: ${{ matrix.target }}
|
2020-01-15 02:16:13 -08:00
|
|
|
profile: minimal
|
|
|
|
components: clippy, rustfmt
|
|
|
|
override: true
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2020-01-15 02:16:13 -08:00
|
|
|
- name: Version
|
|
|
|
run: |
|
|
|
|
rustup --version
|
|
|
|
cargo --version
|
|
|
|
cargo clippy --version
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2020-01-25 19:58:32 -08:00
|
|
|
- name: Build
|
|
|
|
run: cargo build --all --verbose
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2020-01-25 19:58:32 -08:00
|
|
|
- name: Test
|
|
|
|
run: cargo test --all --verbose
|
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:30:24 -08:00
|
|
|
- name: Lint
|
2020-08-05 19:20:11 -07:00
|
|
|
if: matrix.os != 'windows-2016'
|
2020-01-15 02:30:24 -08:00
|
|
|
run: cargo run lint
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2020-02-10 20:07:06 -08:00
|
|
|
- name: Install Rustfmt Toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: nightly
|
|
|
|
target: ${{ matrix.target }}
|
|
|
|
profile: minimal
|
|
|
|
components: rustfmt
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2020-01-15 02:16:13 -08:00
|
|
|
- name: Format
|
2020-02-10 20:07:06 -08:00
|
|
|
run: cargo +nightly fmt --all -- --check
|
2020-03-30 23:39:30 -07:00
|
|
|
|
2020-01-15 02:16:13 -08:00
|
|
|
- name: Completion Scripts
|
2020-08-05 19:20:11 -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
|
|
|
|
2020-01-28 02:19:24 -08:00
|
|
|
- name: Package
|
|
|
|
id: package
|
2020-06-27 16:38:56 -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
|
|
|
|
2020-01-28 02:19:24 -08:00
|
|
|
- name: Publish
|
|
|
|
uses: softprops/action-gh-release@v1
|
2020-06-27 16:38:56 -07:00
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
2020-01-28 02:19:24 -08:00
|
|
|
with:
|
|
|
|
draft: false
|
|
|
|
files: ${{ steps.package.outputs.archive }}
|
2020-07-01 23:42:39 -07:00
|
|
|
prerelease: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
|
2020-01-28 02:19:24 -08:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|