name: Test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
rust-version:
- '1.48.0'
- 'stable'
- 'nightly'
os:
- ubuntu-latest
- macOS-latest
- windows-latest
name: Test on ${{ matrix.os }} (Rust ${{ matrix.rust-version }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust-version }}
override: true
components: rustfmt, clippy
- name: Enable coverage on nightly
if: startsWith(matrix.rust-version, 'nightly') && startsWith(matrix.os, 'ubuntu')
run: |
echo 'CARGO_INCREMENTAL=0' >> $GITHUB_ENV
echo 'RUSTFLAGS=-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort' >> $GITHUB_ENV
echo 'RUSTDOCFLAGS=-Cpanic=abort' >> $GITHUB_ENV
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
- name: Clippy linter
uses: actions-rs/cargo@v1
with:
command: clippy
- name: Coverage report
uses: actions-rs/grcov@v0.1
if: startsWith(matrix.rust-version, 'nightly') && startsWith(matrix.os, 'ubuntu')
- uses: codecov/codecov-action@v1