Skip to content

Commit 58e83e9

Browse files
committed
Merge branch 'unit-tests' into integration-tests
2 parents 568ae0e + 1d7d36f commit 58e83e9

File tree

3 files changed

+134
-1
lines changed

3 files changed

+134
-1
lines changed

.github/workflows/check.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: check
2+
# This workflow runs whenever a PR is opened or updated, or a commit is pushed
3+
# to main. It runs several checks:
4+
# - fmt: checks that the code is formatted according to `rustfmt`.
5+
# - clippy: checks that the code does not contain any `clippy` warnings.
6+
# - doc: checks that the code can be documented without errors.
7+
# - typos: checks for typos across the repo.
8+
permissions:
9+
contents: read
10+
# This configuration allows maintainers of this repo to create a branch and
11+
# pull request based on the new branch. Restricting the push trigger to the
12+
# main branch ensures that the PR only gets built once.
13+
on:
14+
push:
15+
branches: [main, v*]
16+
pull_request:
17+
# If new code is pushed to a PR branch, then cancel in progress workflows for
18+
# that PR. Ensures that we don't waste CI time, and returns results quicker.
19+
# https://github.com/jonhoo/rust-ci-conf/pull/5
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
22+
cancel-in-progress: true
23+
env:
24+
CARGO_TERM_COLOR: always
25+
26+
jobs:
27+
cargo-build:
28+
name: Cargo Build
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- name: Fetch Repository
33+
uses: actions/checkout@v5
34+
35+
- name: Install stable toolchain
36+
uses: actions-rust-lang/setup-rust-toolchain@v1
37+
38+
- name: cargo build
39+
run: cargo b --locked --all-targets --all-features
40+
41+
cargo-fmt:
42+
name: Cargo fmt
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- name: Fetch Repository
47+
uses: actions/checkout@v5
48+
49+
- name: Install stable toolchain
50+
uses: actions-rust-lang/setup-rust-toolchain@v1
51+
with:
52+
components: rustfmt
53+
toolchain: nightly
54+
55+
- name: Rustfmt Check
56+
run: cargo fmt --all --check
57+
58+
cargo-clippy:
59+
name: Cargo clippy
60+
runs-on: ubuntu-latest
61+
62+
steps:
63+
- name: Fetch Repository
64+
uses: actions/checkout@v5
65+
66+
- name: Install stable toolchain
67+
uses: actions-rust-lang/setup-rust-toolchain@v1
68+
with:
69+
components: clippy
70+
71+
- name: Clippy Check
72+
uses: giraffate/clippy-action@v1
73+
with:
74+
reporter: "github-pr-check"
75+
github_token: ${{ secrets.GITHUB_TOKEN }}
76+
clippy_flags: --all-targets --all-features -- -D warnings -D clippy::pedantic
77+
78+
typos-cli:
79+
name: typos
80+
runs-on: ubuntu-latest
81+
82+
steps:
83+
- name: Fetch Repository
84+
uses: actions/checkout@v5
85+
86+
- name: Check spelling of files in the workspace
87+
uses: crate-ci/typos@v1

.github/workflows/test.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: tests
2+
3+
on:
4+
pull_request:
5+
merge_group:
6+
push:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
cargo-next-test:
18+
name: Cargo test
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Fetch Repository
23+
uses: actions/checkout@v5
24+
25+
- name: Install stable toolchain
26+
uses: actions-rust-lang/setup-rust-toolchain@v1
27+
28+
- name: Cache cargo-nextest binary
29+
id: cache-cargo-nextest
30+
uses: actions/cache@v4
31+
with:
32+
path: ~/.cargo/bin/cargo-nextest
33+
key: ${{ runner.os }}-cargo-nextest-${{ hashFiles('**/Cargo.lock') }}
34+
35+
- name: Install cargo-nextest
36+
if: steps.cache-cargo-nextest.outputs.cache-hit != 'true'
37+
uses: taiki-e/install-action@v2
38+
with:
39+
tool: cargo-nextest
40+
41+
- name: Cargo test
42+
run: cargo nextest run --locked --all-targets --all-features --no-tests=pass
43+
44+
# https://github.com/rust-lang/cargo/issues/6669
45+
- name: Run doc tests
46+
run: cargo test --locked --doc

examples/historical_scanning/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async fn main() -> anyhow::Result<()> {
6262
callback: Arc::new(CounterCallback),
6363
};
6464

65-
counter_contract.increase().send().await?;
65+
let _ = counter_contract.increase().send().await?.get_receipt().await?;
6666

6767
let mut scanner = ScannerBuilder::new(anvil.ws_endpoint_url())
6868
.add_event_filter(increase_filter)

0 commit comments

Comments
 (0)