From 80d339848f5a9243acbb3b629114ea7a80edf35a Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Tue, 8 Oct 2019 15:32:26 +1300 Subject: [PATCH] Actions: Various CI improvements - Test against MSRV - Parallel linting - Compile benchmarks on nightly --- .github/workflows/rust.yml | 94 +++++++++++++++++++++++++------------- 1 file changed, 62 insertions(+), 32 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index cf55d9a..5f76fb0 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -3,45 +3,60 @@ name: Rust on: [push, pull_request] 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: name: Test on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest, windows-latest, macOS-latest] steps: - - uses: actions/checkout@v1 - - name: Check formatting - run: cargo fmt --all -- --check - - name: Build - run: cargo build --verbose --release --all - - name: Run tests - run: cargo test --verbose --release --all - - name: Run slow tests - run: cargo test --verbose --release --all -- --ignored - - macOS: - name: Test on macOS-latest - runs-on: macOS-latest - - steps: - - name: Install Rust - run: curl https://sh.rustup.rs -sSf | sh -s -- -y - - name: Install rustfmt - run: $HOME/.cargo/bin/rustup component add rustfmt - - uses: actions/checkout@v1 - - name: Check formatting - run: $HOME/.cargo/bin/cargo fmt --all -- --check - - name: Build - run: $HOME/.cargo/bin/cargo build --verbose --release --all - - 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 + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + toolchain: 1.37.0 + override: true + - name: cargo fetch + uses: actions-rs/cargo@v1 + with: + command: fetch + - name: Build tests + uses: actions-rs/cargo@v1 + with: + command: build + args: --verbose --release --all --tests + - name: Run tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --verbose --release --all + - name: Run slow tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --verbose --release --all -- --ignored doc-links: - name: Check intra-doc links + name: Nightly lint runs-on: ubuntu-latest steps: @@ -50,7 +65,22 @@ jobs: with: toolchain: nightly 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: 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