Skip to content

Commit

Permalink
chore(workflows): forge ci + lint script (#24)
Browse files Browse the repository at this point in the history
* config(workflows): forge ci + lint script

* fix(workflows): foundry ci nightly
  • Loading branch information
jdubpark authored Aug 22, 2024
1 parent 1b50cbc commit a824281
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 25 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/ci-foundry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Run this separately from pre-commit for nice visual coverage.
name: Foundry CI

on:
workflow_call:

jobs:
# Add a timestamp to the build
Timestamp:
uses: storyprotocol/gha-workflows/.github/workflows/reusable-timestamp.yml@main

foundry-test:
strategy:
fail-fast: true
name: Foundry Unit Test
runs-on: ubuntu-latest
needs: [Timestamp]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
package_json_file: contracts/package.json

- name: Run install
uses: borales/actions-yarn@v4
with:
cmd: install # will run `yarn install` command

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

# First, install the dependencies
- run: pnpm install
working-directory: contracts

# Run lint
- name: Check lint
run: pnpm lint-check
working-directory: contracts

# first, build contracts excluding the tests and scripts. Check contract sizes in this step.
- name: Run Contract Size check
run: |
forge --version
forge build --force --sizes --skip test --skip script
working-directory: contracts

# This step requires full build to be run first
- name: Upgrade Safety test
run: |
forge clean && forge build --build-info
working-directory: contracts
# npx @openzeppelin/upgrades-core validate out/build-info

- name: Run Forge tests
run: |
forge test -vvv --gas-limit 800000000000
id: forge-test
working-directory: contracts
2 changes: 1 addition & 1 deletion .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
go-lint:
uses: ./.github/workflows/golangci-lint.yml
sol-tests:
uses: ./.github/workflows/soltest.yml
uses: ./.github/workflows/ci-foundry.yml
23 changes: 0 additions & 23 deletions .github/workflows/soltest.yml

This file was deleted.

2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"test": "pnpm test:gen && forge test",
"lint-full": "prettier --log-level warn --ignore-path .gitignore '{contracts,test}/**/*.sol' --check && solhint '{contracts,test}/**/*.sol'",
"lint-fix": "prettier --log-level warn --ignore-path .gitignore '{contracts,test}/**/*.sol' --write",
"lint-check": "solhint '{contracts,test}/**/*.sol'"
"lint-check": "solhint '{contracts,script,test}/**/*.sol'"
},
"devDependencies": {
"@openzeppelin/merkle-tree": "^1.0.5",
Expand Down

0 comments on commit a824281

Please sign in to comment.