Skip to content

Commit 4bc27ca

Browse files
authored
Basic CI / GitHub actions (#6)
* add formatting and clippy CI checks * don't treat clippy warnings as errors during normal branch pushes * add a stricter check for PRs which includes a build This will take longer to run so is only done on PR events. Also treats clippy warnings as errors. * move the cargo commands to a Makefile and use that in the action scripts The Makefile also has basic build and clean targets for convenience during local development * clippy fix
1 parent 88ebb5d commit 4bc27ca

File tree

4 files changed

+51
-1
lines changed

4 files changed

+51
-1
lines changed

.github/workflows/check-pr.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Rust PR check
2+
3+
on:
4+
pull_request:
5+
# Default types for PR are opened, synchronize, reopened. Need
6+
# ready_for_review to catch a PR that is moving from draft to not-draft
7+
types: [opened, synchronize, reopened, ready_for_review]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
check-code:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
19+
- name: Build
20+
run: make check-build
21+
22+
# TODO: run tests

.github/workflows/check-push.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Rust code checks
2+
3+
on: [push]
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
8+
jobs:
9+
check-code:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
15+
- name: Code checks
16+
run: make check

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
build:
2+
cargo build --workspace
3+
4+
check-build: check
5+
cargo build --workspace --all-targets --all-features
6+
7+
check:
8+
cargo fmt --check
9+
cargo clippy --workspace --all-targets --all-features -- -D warnings
10+
11+
clean:
12+
cargo clean

fvm_dispatch/src/hash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ mod tests {
104104
struct FakeHasher {}
105105
impl Hasher for FakeHasher {
106106
fn hash(&self, bytes: &[u8]) -> Vec<u8> {
107-
return bytes.to_vec();
107+
bytes.to_vec()
108108
}
109109
}
110110

0 commit comments

Comments
 (0)