name: CI
on:
schedule:
- cron: '0 0 * * 0'
push:
branches:
- '*'
tags:
- 'v[0-9]+.[0-9]+.[0-9]+**'
pull_request:
jobs:
rustfmt:
name: Rustfmt
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup `stable-x86_64-unknown-linux-gnu`
uses: actions-rs/toolchain@v1
with:
toolchain: stable-x86_64-unknown-linux-gnu
default: true
profile: minimal
components: rustfmt
- name: '`cargo fmt -- --check`'
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
grcov:
name: grcov
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup `nightly-x86_64-unknown-linux-gnu`
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-x86_64-unknown-linux-gnu
profile: minimal
default: true
- name: '`cargo test --no-fail-fast`'
uses: actions-rs/cargo@v1
with:
command: test
args: --no-fail-fast
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
- name: grcov
id: grcov
uses: actions-rs/grcov@v0.1
- name: Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ${{ steps.grcov.outputs.report }}
build:
strategy:
fail-fast: false
matrix:
name:
- stable-x86_64-pc-windows-msvc
- stable-x86_64-apple-darwin
- stable-x86_64-unknown-linux-gnu
- stable-x86_64-unknown-linux-musl
- beta-x86_64-pc-windows-msvc
- beta-x86_64-apple-darwin
- beta-x86_64-unknown-linux-gnu
- beta-x86_64-unknown-linux-musl
include:
- { name: stable-x86_64-pc-windows-msvc , channel: stable, target-triple: x86_64-pc-windows-msvc , host-triple: x86_64-pc-windows-msvc , os: windows-2019 }
- { name: stable-x86_64-apple-darwin , channel: stable, target-triple: x86_64-apple-darwin , host-triple: x86_64-apple-darwin , os: macos-10.15 }
- { name: stable-x86_64-unknown-linux-gnu , channel: stable, target-triple: x86_64-unknown-linux-gnu , host-triple: x86_64-unknown-linux-gnu, os: ubuntu-18.04 }
- { name: stable-x86_64-unknown-linux-musl, channel: stable, target-triple: x86_64-unknown-linux-musl, host-triple: x86_64-unknown-linux-gnu, os: ubuntu-18.04 }
- { name: beta-x86_64-pc-windows-msvc , channel: beta , target-triple: x86_64-pc-windows-msvc , host-triple: x86_64-pc-windows-msvc , os: windows-2019 }
- { name: beta-x86_64-apple-darwin , channel: beta , target-triple: x86_64-apple-darwin , host-triple: x86_64-apple-darwin , os: macos-10.15 }
- { name: beta-x86_64-unknown-linux-gnu , channel: beta , target-triple: x86_64-unknown-linux-gnu , host-triple: x86_64-unknown-linux-gnu, os: ubuntu-18.04 }
- { name: beta-x86_64-unknown-linux-musl , channel: beta , target-triple: x86_64-unknown-linux-musl, host-triple: x86_64-unknown-linux-gnu, os: ubuntu-18.04 }
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: '`sudo apt-get install musl-tools`'
run: sudo apt-get install musl-tools
if: matrix.target-triple == 'x86_64-unknown-linux-musl'
- name: 'Setup `${{ matrix.channel }}-${{ matrix.host-triple }}` (target: `${{ matrix.target-triple }}`)'
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.channel }}-${{ matrix.host-triple }}
target: ${{ matrix.target-triple }}
default: true
profile: minimal
components: clippy
- name: '`cargo clippy --all-targets --target ${{ matrix.target-triple }} -v -- -D warnings`'
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --target ${{ matrix.target-triple }} -v -- -D warnings
if: matrix.channel == 'stable'
- name: '`cargo test --no-fail-fast --target ${{ matrix.target-triple }} -v`'
uses: actions-rs/cargo@v1
with:
command: test
args: --no-fail-fast --target ${{ matrix.target-triple }} -v
- name: '`cargo build --target ${{ matrix.target-triple }} -v`'
uses: actions-rs/cargo@v1
with:
command: build
args: --target ${{ matrix.target-triple }} -v
- name: '`cargo install --path . --debug --target ${{ matrix.target-triple }} -v --locked`'
uses: actions-rs/cargo@v1
with:
command: install
args: --path . --debug --target ${{ matrix.target-triple }} -v --locked
- name: '`cargo install --path . --debug --target ${{ matrix.target-triple }} -v`'
uses: actions-rs/cargo@v1
with:
command: install
args: --path . --debug --target ${{ matrix.target-triple }} -v
upload:
strategy:
fail-fast: false
matrix:
target-triple:
- x86_64-pc-windows-msvc
- x86_64-apple-darwin
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
include:
- { target-triple: x86_64-pc-windows-msvc , host-triple: x86_64-pc-windows-msvc , os: windows-2019 }
- { target-triple: x86_64-apple-darwin , host-triple: x86_64-apple-darwin , os: macos-10.15 }
- { target-triple: x86_64-unknown-linux-gnu , host-triple: x86_64-unknown-linux-gnu, os: ubuntu-18.04 }
- { target-triple: x86_64-unknown-linux-musl, host-triple: x86_64-unknown-linux-gnu, os: ubuntu-18.04 }
name: GitHub Release (${{ matrix.target-triple }})
runs-on: ${{ matrix.os }}
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v2
- name: '`sudo apt-get install musl-tools`'
run: sudo apt-get install musl-tools
if: matrix.target-triple == 'x86_64-unknown-linux-musl'
- name: 'Setup `stable-${{ matrix.host-triple }}` (target: `${{ matrix.target-triple }}`)'
uses: actions-rs/toolchain@v1
with:
toolchain: stable-${{ matrix.host-triple }}
target: ${{ matrix.target-triple }}
default: true
profile: default
- name: '`cargo install --path . --target ${{ matrix.target-triple }} -v --locked`'
uses: actions-rs/cargo@v1
with:
command: install
args: --path . --target ${{ matrix.target-triple }} -v --locked
- name: Create an asset
id: asset
run: |
BIN_TARGET=cargo-member
if ${{ contains(matrix.target-triple, 'pc-windows') }}; then
DOT_EXE=.exe
fi
ASSET_STEM="$BIN_TARGET-${GITHUB_REF#refs/tags/}-${{ matrix.target-triple }}"
git archive -o "./$ASSET_STEM.tar" --prefix "$ASSET_STEM/" HEAD
tar -xf "./$ASSET_STEM.tar"
mv "$HOME/.cargo/bin/$BIN_TARGET$DOT_EXE" "./$ASSET_STEM/"
if ${{ contains(matrix.target-triple, 'pc-windows') }}; then
ASSET="$ASSET_STEM.zip"
7z a "$ASSET" "./$ASSET_STEM"
zipinfo "./$ASSET"
else
ASSET="$ASSET_STEM.tar.gz"
tar -czvf "./$ASSET" "./$ASSET_STEM"
fi
echo "::set-output name=asset::$ASSET"
shell: bash
- name: Upload the asset
uses: actions/upload-artifact@v2
with:
name: assets
path: ${{ steps.asset.outputs.asset }}
release:
name: GitHub Release
runs-on: ubuntu-18.04
needs: [rustfmt, grcov, build, upload]
steps:
- name: Download the assets
uses: actions/download-artifact@v2
with:
name: assets
path: ./assets
- name: GH Release
uses: softprops/action-gh-release@v1
with:
files: ./assets/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}