Actions: Various CI improvements

- Test against MSRV
- Parallel linting
- Compile benchmarks on nightly
This commit is contained in:
Jack Grigg 2019-10-08 15:32:26 +13:00
parent b872e9fc49
commit 80d339848f
No known key found for this signature in database
GPG Key ID: 9E8255172BBF9898
1 changed files with 62 additions and 32 deletions

View File

@ -3,45 +3,60 @@ name: Rust
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.37.0
override: true
# Ensure all code has been formatted with rustfmt
- run: rustup component add rustfmt
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check --color always
test: test:
name: Test on ${{ matrix.os }} name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, windows-latest] os: [ubuntu-latest, windows-latest, macOS-latest]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Check formatting - uses: actions-rs/toolchain@v1
run: cargo fmt --all -- --check with:
- name: Build toolchain: 1.37.0
run: cargo build --verbose --release --all override: true
- name: Run tests - name: cargo fetch
run: cargo test --verbose --release --all uses: actions-rs/cargo@v1
- name: Run slow tests with:
run: cargo test --verbose --release --all -- --ignored command: fetch
- name: Build tests
macOS: uses: actions-rs/cargo@v1
name: Test on macOS-latest with:
runs-on: macOS-latest command: build
args: --verbose --release --all --tests
steps: - name: Run tests
- name: Install Rust uses: actions-rs/cargo@v1
run: curl https://sh.rustup.rs -sSf | sh -s -- -y with:
- name: Install rustfmt command: test
run: $HOME/.cargo/bin/rustup component add rustfmt args: --verbose --release --all
- uses: actions/checkout@v1 - name: Run slow tests
- name: Check formatting uses: actions-rs/cargo@v1
run: $HOME/.cargo/bin/cargo fmt --all -- --check with:
- name: Build command: test
run: $HOME/.cargo/bin/cargo build --verbose --release --all args: --verbose --release --all -- --ignored
- name: Run tests
run: $HOME/.cargo/bin/cargo test --verbose --release --all
- name: Run slow tests
run: $HOME/.cargo/bin/cargo test --verbose --release --all -- --ignored
doc-links: doc-links:
name: Check intra-doc links name: Nightly lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -50,7 +65,22 @@ jobs:
with: with:
toolchain: nightly toolchain: nightly
override: true override: true
- uses: actions-rs/cargo@v1 - name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
# Ensure intra-documentation links all resolve correctly
# Requires #![deny(intra_doc_link_resolution_failure)] in crates.
- name: Check intra-doc links
uses: actions-rs/cargo@v1
with: with:
command: doc command: doc
args: --document-private-items args: --all --document-private-items
# Build benchmarks to prevent bitrot
- name: Build benchmarks
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --all --benches