2020-02-18 11:53:23 +01:00
|
|
|
name: Build
|
2020-01-05 00:04:20 +01:00
|
|
|
|
2020-03-07 03:39:17 +01:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-03-18 15:45:27 +01:00
|
|
|
tags:
|
2020-04-22 22:32:36 +02:00
|
|
|
- '*'
|
2020-03-07 03:39:17 +01:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-01-05 00:04:20 +01:00
|
|
|
|
2020-09-19 04:57:46 +02:00
|
|
|
env:
|
|
|
|
# Increment to invalidate github actions caches if they become corrupt.
|
|
|
|
# Errors of the form "can't find crate for `snafu_derive` which `snafu` depends on"
|
|
|
|
# can usually be fixed by incrementing this value.
|
2020-10-04 22:16:31 +02:00
|
|
|
CACHE_KEY_PREFIX: 3
|
2020-09-19 04:57:46 +02:00
|
|
|
|
2020-01-05 00:04:20 +01:00
|
|
|
jobs:
|
2020-01-31 13:20:37 +01:00
|
|
|
all:
|
2020-01-31 15:29:01 +01:00
|
|
|
name: All
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-01-05 05:05:24 +01:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os:
|
|
|
|
- macos-latest
|
|
|
|
- ubuntu-latest
|
|
|
|
- windows-latest
|
2020-01-28 11:59:45 +01:00
|
|
|
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
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-01-05 05:05:24 +01:00
|
|
|
runs-on: ${{matrix.os}}
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-03-20 04:19:52 +01:00
|
|
|
env:
|
|
|
|
RUSTFLAGS: "-D warnings"
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-01-05 00:04:20 +01:00
|
|
|
steps:
|
2020-01-31 13:20:37 +01:00
|
|
|
- uses: actions/checkout@v2
|
2020-04-16 13:16:40 +02:00
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-09-19 04:57:46 +02: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 22:16:31 +02:00
|
|
|
if: matrix.os == 'macos-latest'
|
2020-09-19 04:57:46 +02:00
|
|
|
run: |
|
|
|
|
brew install gnu-tar
|
|
|
|
echo "::add-path::/usr/local/opt/gnu-tar/libexec/gnubin"
|
|
|
|
|
2020-03-31 08:46:15 +02:00
|
|
|
- name: Cache cargo registry
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ~/.cargo/registry
|
2020-09-19 04:57:46 +02:00
|
|
|
key: ${{ env.CACHE_KEY_PREFIX }}-${{ runner.os }}-cargo-registry
|
2020-03-31 08:46:15 +02:00
|
|
|
|
|
|
|
- name: Cache cargo index
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ~/.cargo/git
|
2020-09-19 04:57:46 +02:00
|
|
|
key: ${{ env.CACHE_KEY_PREFIX }}-${{ runner.os }}-cargo-index
|
2020-03-31 08:46:15 +02:00
|
|
|
|
|
|
|
- name: Cache cargo build
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: target
|
2020-09-19 04:57:46 +02:00
|
|
|
key: ${{ env.CACHE_KEY_PREFIX }}-${{ runner.os }}-cargo-build-target
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-03-06 07:51:00 +01:00
|
|
|
- name: Install Stable
|
2020-01-05 05:05:24 +01:00
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
2020-01-28 11:59:45 +01:00
|
|
|
target: ${{matrix.target}}
|
2020-01-05 05:05:24 +01:00
|
|
|
profile: minimal
|
2020-01-05 05:24:32 +01:00
|
|
|
components: clippy, rustfmt
|
2020-01-05 05:05:24 +01:00
|
|
|
override: true
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-04-16 13:16:40 +02:00
|
|
|
- name: Info
|
2020-01-05 03:58:42 +01:00
|
|
|
run: |
|
|
|
|
rustup --version
|
|
|
|
cargo --version
|
|
|
|
cargo clippy --version
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-01-05 00:04:20 +01:00
|
|
|
- name: Build
|
2020-03-20 04:19:52 +01:00
|
|
|
run: cargo build --all --verbose
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-01-05 00:04:20 +01:00
|
|
|
- name: Test
|
2020-01-21 06:41:39 +01:00
|
|
|
run: cargo test --all --verbose
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-01-16 08:37:12 +01:00
|
|
|
- name: Clippy
|
2020-01-21 06:41:39 +01:00
|
|
|
run: cargo clippy --all
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-01-16 08:37:12 +01:00
|
|
|
- name: Lint
|
2020-04-16 13:16:40 +02:00
|
|
|
if: matrix.os == 'macos-latest'
|
|
|
|
run: |
|
|
|
|
brew install ripgrep
|
|
|
|
./bin/lint
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-03-06 07:51:00 +01:00
|
|
|
- name: Install Nightly
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: nightly
|
|
|
|
target: ${{matrix.target}}
|
|
|
|
profile: minimal
|
|
|
|
components: rustfmt
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-04-08 07:21:59 +02:00
|
|
|
- name: Check Formatting
|
2020-03-06 07:51:00 +01:00
|
|
|
run: cargo +nightly fmt --all -- --check
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-04-16 13:16:40 +02:00
|
|
|
- name: Check Generated
|
|
|
|
if: matrix.os == 'macos-latest'
|
2020-01-21 06:41:39 +01:00
|
|
|
run: |
|
2020-04-16 13:16:40 +02:00
|
|
|
brew install help2man
|
2020-05-01 06:21:20 +02:00
|
|
|
cargo run --package gen -- --bin target/debug/imdl all
|
2020-04-08 07:21:59 +02:00
|
|
|
git diff --no-ext-diff --exit-code
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-03-20 04:19:52 +01:00
|
|
|
- name: Install `mdbook`
|
|
|
|
uses: peaceiris/actions-mdbook@v1
|
|
|
|
with:
|
2020-09-10 23:13:07 +02:00
|
|
|
mdbook-version: latest
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-03-20 04:19:52 +01:00
|
|
|
- name: Build Book
|
2020-04-21 09:35:44 +02:00
|
|
|
run: |
|
2020-05-01 06:21:20 +02:00
|
|
|
cargo run --package gen -- --bin target/debug/imdl book
|
2020-04-21 09:35:44 +02:00
|
|
|
mdbook build book --dest-dir ../www/book
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-03-20 04:42:38 +01:00
|
|
|
- name: Record Git Revision
|
2020-03-21 23:11:57 +01:00
|
|
|
if: github.ref == 'refs/heads/master' && matrix.os == 'ubuntu-latest'
|
2020-03-20 15:07:32 +01:00
|
|
|
run: git rev-parse --verify HEAD > www/head.txt
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-03-20 04:42:38 +01:00
|
|
|
- name: Deploy Pages
|
2020-03-20 04:19:52 +01:00
|
|
|
uses: peaceiris/actions-gh-pages@v3
|
2020-03-21 23:11:57 +01:00
|
|
|
if: github.ref == 'refs/heads/master' && matrix.os == 'ubuntu-latest'
|
2020-03-20 04:19:52 +01:00
|
|
|
with:
|
2020-03-20 04:42:38 +01:00
|
|
|
github_token: ${{secrets.GITHUB_TOKEN}}
|
2020-03-20 04:19:52 +01:00
|
|
|
publish_branch: gh-pages
|
2020-03-20 04:42:38 +01:00
|
|
|
publish_dir: ./www
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-01-28 11:59:45 +01:00
|
|
|
- name: Package
|
|
|
|
id: package
|
2020-04-22 22:32:36 +02:00
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
2020-01-28 11:59:45 +01:00
|
|
|
shell: bash
|
2020-03-20 04:19:52 +01:00
|
|
|
run: ./bin/package ${{github.ref}} ${{matrix.os}} ${{matrix.target}}
|
2020-03-31 08:46:15 +02:00
|
|
|
|
2020-05-01 06:21:20 +02:00
|
|
|
- name: Publish Release Archive
|
2020-01-28 11:59:45 +01:00
|
|
|
uses: softprops/action-gh-release@v1
|
2020-04-22 22:32:36 +02:00
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
2020-01-28 11:59:45 +01:00
|
|
|
with:
|
|
|
|
draft: false
|
|
|
|
files: ${{steps.package.outputs.archive}}
|
2020-07-02 08:40:06 +02:00
|
|
|
prerelease: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
|
2020-01-28 11:59:45 +01:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|