Skip to content

Commit

Permalink
Add automatic PR checks
Browse files Browse the repository at this point in the history
This adds automatic checks for each PR:

  * `cargo clippy`
  * `cargo fmt` (checks that `cargo fmt` is a no-op)
  * [`cargo msrv`] (verifies that minimum supported Rust version is what
    is set as `rust-version` in Cargo.toml)
  * `cargo test`

This also sets GitHub’s dependabot to check for updates to the GitHub
actions used monthly.

Currently, the crate works on any version of Rust from 1.56 on up. This
sets `rust-version` in Cargo.toml so that any change to the minimum
supported Rust version (MSRV) will be noticed.

Finally, this removes the rust-toolchain file and adds it to .gitignore.
This allows the crate to be developed on any version of Rust ≥1.56.

Fixes: cloudhead#17 — Set up continious integration

[`cargo msrv`]: https://github.com/foresterre/cargo-msrv
  • Loading branch information
danielparks committed Jul 9, 2023
1 parent 77d3926 commit b899aa3
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
53 changes: 53 additions & 0 deletions .github/workflows/pr-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: PR checks

on:
workflow_dispatch:
push:
branches:
- $default-branch
pull_request:

jobs:
clippy:
name: cargo clippy
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
- run: cargo clippy --all-features --all-targets

fmt:
name: cargo fmt
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- uses: actions-rust-lang/rustfmt@v1

msrv:
name: cargo msrv
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: taiki-e/install-action@v2
with:
tool: cargo-msrv
- run: cargo msrv verify

test:
name: cargo test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo build --tests
- run: cargo test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
Cargo.lock
/rust-toolchain
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ version = "3.0.0"
authors = ["Alexis Sellier <[email protected]>"]
edition = "2021"
license = "MIT"
rust-version = "1.56"

[dependencies]
libc = "0.2.134"
1 change: 0 additions & 1 deletion rust-toolchain

This file was deleted.

0 comments on commit b899aa3

Please sign in to comment.