Skip to content

Commit b899aa3

Browse files
committed
Add automatic PR checks
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
1 parent 77d3926 commit b899aa3

File tree

5 files changed

+62
-1
lines changed

5 files changed

+62
-1
lines changed

.github/dependabot.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "monthly"

.github/workflows/pr-checks.yaml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: PR checks
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- $default-branch
8+
pull_request:
9+
10+
jobs:
11+
clippy:
12+
name: cargo clippy
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: actions-rust-lang/setup-rust-toolchain@v1
18+
with:
19+
components: clippy
20+
- run: cargo clippy --all-features --all-targets
21+
22+
fmt:
23+
name: cargo fmt
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- uses: actions/checkout@v3
28+
- uses: actions-rust-lang/setup-rust-toolchain@v1
29+
with:
30+
components: rustfmt
31+
- uses: actions-rust-lang/rustfmt@v1
32+
33+
msrv:
34+
name: cargo msrv
35+
runs-on: ubuntu-latest
36+
37+
steps:
38+
- uses: actions/checkout@v3
39+
- uses: actions-rust-lang/setup-rust-toolchain@v1
40+
- uses: taiki-e/install-action@v2
41+
with:
42+
tool: cargo-msrv
43+
- run: cargo msrv verify
44+
45+
test:
46+
name: cargo test
47+
runs-on: ubuntu-latest
48+
49+
steps:
50+
- uses: actions/checkout@v3
51+
- uses: actions-rust-lang/setup-rust-toolchain@v1
52+
- run: cargo build --tests
53+
- run: cargo test

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/target
22
Cargo.lock
3+
/rust-toolchain

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ version = "3.0.0"
1010
authors = ["Alexis Sellier <[email protected]>"]
1111
edition = "2021"
1212
license = "MIT"
13+
rust-version = "1.56"
1314

1415
[dependencies]
1516
libc = "0.2.134"

rust-toolchain

-1
This file was deleted.

0 commit comments

Comments
 (0)