Skip to content

Commit

Permalink
Upgrade build-and-test CI workflow
Browse files Browse the repository at this point in the history
Copied from nftnl-rs.
Also checks minimal versions now.
Also checks that docs build cleanly
  • Loading branch information
faern committed Aug 22, 2024
1 parent 24aaf73 commit 5b796cb
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 37 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
name: Build and test
on:
pull_request:
paths:
- .github/workflows/build-and-test.yml
- '**/*.rs'
- Cargo.toml
- Cargo.lock
workflow_dispatch:

permissions: {}

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: --deny warnings

jobs:
build-and-test:
strategy:
matrix:
# Keep MSRV in sync with rust-version in Cargo.toml
rust: [stable, beta, nightly, 1.64.0]
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #v1.0.7
with:
toolchain: ${{ matrix.rust }}
profile: minimal
default: true

- name: Build
run: cargo build --all-targets --locked

- name: Test
run: cargo test --locked

# Make sure documentation builds without warnings (broken links etc)
- name: Generate documentation
if: matrix.rust == 'stable'
run: RUSTDOCFLAGS="--deny warnings" cargo doc

# Make sure the library builds with all dependencies downgraded to their
# oldest versions allowed by the semver spec. This ensures we have not
# under-specified any dependency
minimal-versions:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- name: Install stable Rust
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #v1.0.7
with:
toolchain: stable
profile: minimal

- name: Install nightly Rust
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #v1.0.7
with:
toolchain: nightly
profile: minimal

- name: Downgrade dependencies to minimal versions
run: cargo +nightly update -Z minimal-versions

- name: Compile with minimal versions
run: cargo +stable build --all-targets --locked
37 changes: 0 additions & 37 deletions .github/workflows/ci.yml

This file was deleted.

0 comments on commit 5b796cb

Please sign in to comment.