celo-org / celo-monorepo

Official repository for core projects comprising the Celo platform
https://celo.org
Apache License 2.0
687 stars 362 forks source link

test: refactor foundry test directory into unit, e2e, and integration tests #11023

Closed arthurgousset closed 1 month ago

arthurgousset commented 1 month ago

Description

  1. refactors foundry tests in test-sol/ into 3 distinct directories:

    test-sol/unit/
    test-sol/e2e/
    test-sol/integration/
  2. updates foundry tests on CI to leverage the new directory structure:

    # unit tests
    forge test --match-path "*test-sol/unit/*"
    
    # e2e tests
    forge test --match-path "*test-sol/e2e/*"
    
    # integration tests
    forge test --match-path "*test-sol/integration/*"
  3. moves foundry scripts from migrations_sol to a new scripts/foundry/ directory. We already have a directory for scripts/truffle/ and scripts/bash/, so this makes it easier to find foundry-related bash scripts going forward.

Other changes

  1. splits the migration, integration, and e2e tests on CI into distinct steps.

    1. this saves time on CI since both the e2e and integration tests can use the same devchain. That means only a single step is required to generate the migrations and run a devchain. Previously, each step required generating migrations and running a devchain.
    2. this helps make the workflow more readable, and ensures error logs can be more easily associated with a specific step on CI, rather than a single bash script.
  2. edits to remappings (renames a few, and updates the order in foundry.toml for better readability)

  3. adds repository and directory properties in package.json of @celo/devchain-anvil. This ensures npmjs.org displays hyperlinks to this Github repository.

  4. adds a CONTRIBUTING.md file to migrations_sol. This can be used to add more information regarding the anvil devchain, and migrations going forward.

    image
  5. adds a "How we work" section in the README file of @celo/devchain-anvil. This is helpful for 3rd-party developers that find the package on npmjs.org. The links help developers take action and help improve the anvil devchain.

    image

Tested

Yes, tested on CI and locally. All changes are added to CI workflows going forward.

Related issues

Backwards compatibility

Yes, everything is backwards.

Documentation

No, we'll need to create better documentation for foundry-related workflows.

arthurgousset commented 1 month ago

(for future reference)

Post merge and publishing workflow, I checked that the new URLs and new "How we work" section in the README file of @celo/devchain-anvil. Looks and works as expected:

image