Giter Site home page Giter Site logo

foundry-toolchain's Introduction

foundry-toolchain Action

This GitHub Action installs Foundry, the blazing fast, portable and modular toolkit for Ethereum application development.

Example workflow

on: [push]

name: test

jobs:
  check:
    name: Foundry project
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: recursive

      - name: Install Foundry
        uses: foundry-rs/foundry-toolchain@v1

      - name: Run tests
        run: forge test -vvv

      - name: Run snapshot
        run: forge snapshot

Inputs

Name Required Default Description Type
cache No true Whether to cache RPC responses or not. bool
version No nightly Version to install, e.g. nightly or 1.0.0. Note: Foundry only has nightly builds for the time being. string

RPC Caching

By default, this action matches Forge's behavior and caches all RPC responses in the ~/.foundry/cache/rpc directory. This is done to speed up the tests and avoid hitting the rate limit of your RPC provider.

The logic of the caching is as follows:

  • Always load the latest valid cache, and always create a new one with the updated cache.
  • When there are no changes to the fork tests, the cache does not change but the key does, since the key is based on the commit hash.
  • When the fork tests are changed, both the cache and the key are updated.

If you would like to disable the caching (e.g. because you want to implement your own caching mechanism), you can set the cache input to false, like this:

- name: Install Foundry
  uses: foundry-rs/foundry-toolchain@v1
  with:
    cache: false

Deleting Caches

You can delete caches via the GitHub Actions user interface. Just go to your repo's "Actions" page:

https://github.com/<OWNER>/<REPO>/actions/caches

Then, locate the "Management" section, and click on "Caches". You will see a list of all of your current caches, which you can delete by clicking on the trash icon.

For more detail on how to delete caches, read GitHub's docs on managing caches.

Fuzzing

Note that if you are fuzzing in your fork tests, the RPC cache strategy above will not work unless you set a fuzz seed. You might also want to reduce your number of RPC calls by using Multicall.

Summaries

You can add the output of Forge and Cast commands to GitHub step summaries. The summaries support GitHub flavored Markdown.

For example, to add the output of forge snapshot to a summary, you would change the snapshot step to:

- name: Run snapshot
  run: NO_COLOR=1 forge snapshot >> $GITHUB_STEP_SUMMARY

See the official GitHub docs for more information.

Building

When opening a PR, you must build the action exactly following the below steps for CI to pass:

$ npm ci
$ npm run build

You have to use Node.js 16.x.

foundry-toolchain's People

Contributors

onbjerg avatar paulrberg avatar gakonst avatar pcaversaccio avatar danipopes avatar codesandwich avatar tarrencev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.