-
Notifications
You must be signed in to change notification settings - Fork 261
Add cargo fmt and cargo clippy to CI workflows #2475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ffd03b5
c5711dd
b56f9c4
0aaf2d3
fd23f9c
218bcec
57042dd
afd202a
ee0ae64
37b0de9
6fb0b9d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
on: | ||
pull_request: | ||
paths: | ||
- .github/workflows/ci-aptos-contract.yml | ||
- target_chains/aptos/contracts/** | ||
push: | ||
branches: | ||
|
@@ -19,10 +20,22 @@ jobs: | |
- uses: actions/checkout@v3 | ||
|
||
- name: Download CLI | ||
run: wget https://github.com/aptos-labs/aptos-core/releases/download/aptos-cli-v3.1.0/aptos-cli-3.1.0-Ubuntu-22.04-x86_64.zip | ||
run: wget https://github.com/aptos-labs/aptos-core/releases/download/aptos-cli-v6.1.1/aptos-cli-6.1.1-Ubuntu-22.04-x86_64.zip | ||
|
||
- name: Unzip CLI | ||
run: unzip aptos-cli-3.1.0-Ubuntu-22.04-x86_64.zip | ||
run: unzip aptos-cli-6.1.1-Ubuntu-22.04-x86_64.zip | ||
|
||
- name: Install movefmt | ||
run: ./aptos update movefmt | ||
|
||
- name: Check Formatting | ||
run: ./aptos move fmt | ||
if: success() || failure() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this if condition runs the job regardless of what happened before, so you get feedback on formatting / lint / tests no matter what. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we just remove the condition? Seems redundant... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (aside) for posterity: this condition is false when the workflow is cancelled |
||
|
||
- name: Lint | ||
run: ./aptos move lint --check-test-code --dev | ||
if: success() || failure() | ||
|
||
- name: Run tests | ||
run: ./aptos move test | ||
if: success() || failure() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ name: Test CosmWasm Contract | |
on: | ||
pull_request: | ||
paths: | ||
- .github/workflows/ci-cosmwasm-contract.yml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought I already added all of these paths, but I guess not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think these need to be here, IIUC Github should automatically run workflows when their definition changes, but I could be wrong... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it doesn't :( . I only added these after the workflows failed to trigger on the first push of this PR |
||
- target_chains/cosmwasm/** | ||
- wormhole_attester/sdk/rust/** | ||
push: | ||
|
@@ -26,7 +27,15 @@ jobs: | |
toolchain: 1.82.0 | ||
components: rustfmt, clippy | ||
override: true | ||
- name: Format check | ||
run: cargo fmt --all -- --check | ||
if: success() || failure() | ||
- name: Clippy check | ||
run: cargo clippy --tests -- --deny warnings | ||
if: success() || failure() | ||
- name: Build | ||
run: cargo build --verbose | ||
if: success() || failure() | ||
- name: Run tests | ||
run: cargo test --verbose | ||
if: success() || failure() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,16 @@ name: Check Fortuna | |
on: | ||
pull_request: | ||
paths: | ||
- .github/workflows/ci-fortuna.yml | ||
- apps/fortuna/** | ||
push: | ||
branches: [main] | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: apps/fortuna | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this working-directory field was missing on a few workflows... not sure how they worked before (perhaps they didnt?) |
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: Swatinem/rust-cache@v2 | ||
|
@@ -19,5 +23,12 @@ jobs: | |
profile: minimal | ||
toolchain: 1.82.0 | ||
override: true | ||
- name: Run executor tests | ||
run: cargo test --manifest-path ./apps/fortuna/Cargo.toml | ||
- name: Format check | ||
run: cargo fmt --all -- --check | ||
if: success() || failure() | ||
- name: Clippy check | ||
run: cargo clippy --tests -- --deny warnings | ||
if: success() || failure() | ||
- name: Run tests | ||
run: cargo test | ||
if: success() || failure() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Check Pythnet SDK | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- .github/workflows/ci-pythnet-sdk.yml | ||
- pythnet/pythnet_sdk/** | ||
push: | ||
branches: [main] | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: pythnet/pythnet_sdk | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
workspaces: "pythnet/pythnet_sdk -> target" | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: 1.82.0 | ||
override: true | ||
- name: Format check | ||
run: cargo fmt --all -- --check | ||
if: success() || failure() | ||
- name: Clippy check | ||
run: cargo clippy --tests -- --deny warnings | ||
if: success() || failure() | ||
- name: Run executor tests | ||
run: cargo test | ||
if: success() || failure() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ module pyth::governance_action { | |
value: u8, | ||
} | ||
|
||
#[lint::skip(unnecessary_numerical_extreme_comparison)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think something changed with Aptos again and there's a new lint error because CONTRACT_UPGRADE=0. The comparison is intentional though, so we want to ignore. |
||
public fun from_u8(value: u8): GovernanceAction { | ||
assert!(CONTRACT_UPGRADE <= value && value <= SET_STALE_PRICE_THRESHOLD, error::invalid_governance_action()); | ||
GovernanceAction { value } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we had different versions in pre-commit and in this workflow.