add PR and publishing CI config #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: | |
- main | |
name: CI | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
env: | |
RUSTFLAGS: -D warnings | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
# By default actions/checkout checks out a merge commit. Check out the PR head instead. | |
# https://github.com/actions/checkout#checkout-pull-request-head-commit-instead-of-merge-commit | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@c5ed9ba6b7e1bb8aff90d43acd2f0af4990fa57c | |
- name: Lint (clippy) | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --all-features --all-targets | |
- name: Lint (rustfmt) | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --check | |
build: | |
name: Build and test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
rust-version: [ stable ] | |
fail-fast: false | |
env: | |
RUSTFLAGS: -D warnings | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust-version }} | |
override: true | |
- name: Build all targets with all features | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --all-targets --all-features | |
- name: Install latest nextest release | |
uses: taiki-e/install-action@nextest | |
- name: Test with latest nextest release | |
uses: actions-rs/cargo@v1 | |
with: | |
command: nextest | |
args: run --all-features |