Skip to content

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

Merged
merged 11 commits into from
Mar 12, 2025

Conversation

devin-ai-integration[bot]
Copy link
Contributor

This PR adds cargo fmt and cargo clippy steps from .pre-commit-config.yaml to the relevant CI workflows. It also adds if: success() || failure() conditions to ensure that formatting, clippy, and unit tests all run on every workflow trigger, regardless of whether previous steps fail.

Link to Devin run: https://app.devin.ai/sessions/bece3c7eabb04acf9317107609d52113

Co-Authored-By: Jayant Krishnamurthy <jayant@dourolabs.xyz>
@devin-ai-integration devin-ai-integration bot requested a review from a team as a code owner March 12, 2025 13:49
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add "(aside)" to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link

vercel bot commented Mar 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 12, 2025 6:23pm
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 12, 2025 6:23pm
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 12, 2025 6:23pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
component-library ⬜️ Ignored (Inspect) Visit Preview Mar 12, 2025 6:23pm
entropy-debugger ⬜️ Ignored (Inspect) Visit Preview Mar 12, 2025 6:23pm
insights ⬜️ Ignored (Inspect) Visit Preview Mar 12, 2025 6:23pm

Co-Authored-By: Jayant Krishnamurthy <jayant@dourolabs.xyz>
@@ -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
Copy link
Contributor

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.


- name: Check Formatting
run: ./aptos move fmt
if: success() || failure()
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just remove the condition? Seems redundant...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(aside) for posterity: this condition is false when the workflow is cancelled

@@ -3,6 +3,7 @@ name: Test CosmWasm Contract
on:
pull_request:
paths:
- .github/workflows/ci-cosmwasm-contract.yml
Copy link
Contributor

Choose a reason for hiding this comment

The 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

Copy link
Collaborator

Choose a reason for hiding this comment

The 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...

Copy link
Contributor

Choose a reason for hiding this comment

The 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

- apps/fortuna/**
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/fortuna
Copy link
Contributor

Choose a reason for hiding this comment

The 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?)

@@ -11,6 +11,7 @@ module pyth::governance_action {
value: u8,
}

#[lint::skip(unnecessary_numerical_extreme_comparison)]
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

…itions

Co-Authored-By: Jayant Krishnamurthy <jayant@dourolabs.xyz>
Copy link
Collaborator

@cprussin cprussin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand why we have all the success() || failure() conditions, is there any case where that would turn up false? Seems redundant, no?

I also think this could be majorly simplified using some of Github Actions' code organization features like reusable workflows and custom actions. There's a lot of duplication here which will make it a big pain to go back and update things in the future, especially if things need to shift in subtle ways between packages.

@jayantk jayantk merged commit 2699171 into main Mar 12, 2025
17 checks passed
@jayantk jayantk deleted the devin/1741787270-add-linting-to-ci branch March 12, 2025 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants