Skip to content

Commit 347fac6

Browse files
authored
fix: lint errors & CI (#246)
* fix: lint errors * ci: fix code coverage * build: install toolchain if and only if not installed * ci: don't ignore our coverage files! * ci: use the code-coverage logic we use in the FVM * ci: update actions
1 parent f7a979a commit 347fac6

File tree

6 files changed

+33
-36
lines changed

6 files changed

+33
-36
lines changed

.github/actions-rs/grcov.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/codecov.yml

Whitespace-only changes.

.github/workflows/check-pr.yml

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v2
18+
uses: actions/checkout@v4
1919

2020
- name: Build
2121
run: make check-build
@@ -24,31 +24,27 @@ jobs:
2424
runs-on: ubuntu-latest
2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@v2
27+
uses: actions/checkout@v4
2828

2929
- name: Test Actors
3030
run: make test-actors
3131
code-coverage:
32-
if: github.event.pull_request.draft == false
32+
if: github.event.pull_request.draft == false
3333
runs-on: ubuntu-latest
3434
steps:
35-
- name: Checkout
36-
uses: actions/checkout@v2
37-
38-
- name: Test Libraries
39-
run: make test-coverage
40-
env:
41-
CARGO_INCREMENTAL: '0'
42-
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Coverflow-checks=off'
43-
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Coverflow-checks=off'
44-
RUSTC_BOOTSTRAP: '1'
45-
46-
- name: Generate Coverage Report
47-
id: coverage
48-
uses: actions-rs/grcov@v0.1
49-
50-
- name: Upload to Coveralls
51-
uses: coverallsapp/github-action@master
52-
with:
53-
github-token: ${{ secrets.GITHUB_TOKEN }}
54-
path-to-lcov: ${{ steps.coverage.outputs.report }}
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
- name: Installing Cargo llvm-cov
38+
uses: taiki-e/install-action@5651179950649c44da31d346537e20c0534f0f25
39+
with:
40+
tool: cargo-llvm-cov@0.4.5
41+
- name: Running tests with coverage
42+
run: make ci-test-coverage
43+
- name: Upload coverage to Codecov
44+
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574
45+
with:
46+
files: ci-coverage.info
47+
token: ${{ secrets.CODECOV_TOKEN }}
48+
# Codecov is flaky and will randomly fail. We'd rather not have random failures on master.
49+
fail_ci_if_error: false
50+
verbose: true

Makefile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,23 @@ test: install-toolchain
2828
# tests excluding actors so we can generate coverage reports during CI build
2929
# WASM targets such as actors do not support this so are excluded
3030
test-coverage: install-toolchain
31+
CARGO_INCREMENTAL=0 \
32+
RUSTFLAGS='-Cinstrument-coverage -C codegen-units=1 -C llvm-args=--inline-threshold=0 -C overflow-checks=off' \
33+
LLVM_PROFILE_FILE='target/coverage/raw/cargo-test-%p-%m.profraw' \
3134
cargo test --workspace $(WASM_EXCLUSION)
35+
grcov . --binary-path ./target/debug/deps/ -s . -t html --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/html
36+
37+
# Just run the tests we want coverage of (for CI)
38+
ci-test-coverage: install-toolchain
39+
rustup component add llvm-tools-preview
40+
cargo llvm-cov --lcov --output-path ci-coverage.info --workspace $(WASM_EXCLUSION)
3241

3342
# separate actor testing stage to run from CI without coverage support
3443
test-actors: install-toolchain
3544
cargo test --package greeter --package helix_integration_tests
3645

3746
install-toolchain:
38-
rustup update
39-
rustup component add rustfmt
40-
rustup component add clippy
41-
rustup target add wasm32-unknown-unknown
47+
rustup show active-toolchain || rustup toolchain install
4248

4349
clean:
4450
cargo clean
@@ -47,7 +53,4 @@ clean:
4753

4854
# generate local coverage report in html format using grcov
4955
# install it with `cargo install grcov`
50-
# TODO: fix the output path for LLVM_PROFILE_FILE
51-
local-coverage:
52-
CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='target/coverage/raw/cargo-test-%p-%m.profraw' cargo test --workspace $(WASM_EXCLUSION)
53-
grcov . --binary-path ./target/debug/deps/ -s . -t html --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/html
56+
local-coverage: test-coveuage

frc46_token/src/token/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ where
135135
}
136136
}
137137

138-
impl<'st, S, BS> Token<'st, S, BS>
138+
impl<S, BS> Token<'_, S, BS>
139139
where
140140
S: Syscalls,
141141
BS: Blockstore,
@@ -633,7 +633,7 @@ where
633633
}
634634
}
635635

636-
impl<'st, S, BS> Token<'st, S, BS>
636+
impl<S, BS> Token<'_, S, BS>
637637
where
638638
S: Syscalls,
639639
BS: Blockstore,

frc53_nft/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ where
111111
}
112112
}
113113

114-
impl<'st, S, BS> NFT<'st, S, BS>
114+
impl<S, BS> NFT<'_, S, BS>
115115
where
116116
S: Syscalls,
117117
BS: Blockstore,

0 commit comments

Comments
 (0)