-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Pablo Maldonado <[email protected]>
- Loading branch information
Showing
1 changed file
with
70 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,83 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
name: "Contracts CI" | ||
|
||
env: | ||
FOUNDRY_PROFILE: ci | ||
FOUNDRY_PROFILE: "ci" | ||
|
||
on: [push] | ||
|
||
jobs: | ||
run-ci: | ||
runs-on: ubuntu-latest | ||
lint: | ||
defaults: | ||
run: | ||
working-directory: "./" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: "Check out the repo" | ||
uses: "actions/checkout@v3" | ||
with: | ||
token: ${{ secrets.GH_TOKEN }} | ||
submodules: "recursive" | ||
|
||
- name: "Install Foundry" | ||
uses: "foundry-rs/foundry-toolchain@v1" | ||
|
||
- name: Checkout modules | ||
uses: actions/checkout@v2 | ||
- name: "Lint the contracts" | ||
run: "forge fmt" | ||
|
||
- name: "Add lint summary" | ||
run: | | ||
echo "## Lint result" >> $GITHUB_STEP_SUMMARY | ||
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY | ||
build: | ||
runs-on: "ubuntu-latest" | ||
defaults: | ||
run: | ||
working-directory: "./" | ||
steps: | ||
- name: "Check out the repo" | ||
uses: "actions/checkout@v3" | ||
with: | ||
token: ${{ secrets.GH_TOKEN }} | ||
submodules: recursive | ||
submodules: "recursive" | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
- name: "Install Foundry" | ||
uses: "foundry-rs/foundry-toolchain@v1" | ||
|
||
- name: "Build the contracts and print their size" | ||
run: "forge build --sizes" | ||
|
||
- name: "Add build summary" | ||
run: | | ||
echo "## Build result" >> $GITHUB_STEP_SUMMARY | ||
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY | ||
test: | ||
needs: ["lint", "build"] | ||
defaults: | ||
run: | ||
working-directory: "./" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Check out the repo" | ||
uses: "actions/checkout@v3" | ||
with: | ||
version: nightly | ||
token: ${{ secrets.GH_TOKEN }} | ||
submodules: "recursive" | ||
|
||
- name: "Install Foundry" | ||
uses: "foundry-rs/foundry-toolchain@v1" | ||
|
||
- name: "Show the Foundry config" | ||
run: "forge config" | ||
|
||
- name: Install deps | ||
run: forge install | ||
- name: "Run the tests" | ||
env: | ||
RPC_MAINNET: ${{ secrets.RPC_MAINNET }} | ||
run: "forge test --fork-url $RPC_MAINNET" | ||
|
||
- name: Check gas snapshots | ||
run: forge snapshot --check | ||
- name: "Add test summary" | ||
run: | | ||
echo "## Tests result" >> $GITHUB_STEP_SUMMARY | ||
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY | ||
- name: Run tests | ||
run: forge test |