Skip to content

Commit

Permalink
ci(workflows): add slither and rpc fork testing
Browse files Browse the repository at this point in the history
  • Loading branch information
sambacha committed Aug 9, 2024
1 parent 39d54af commit 677fa8d
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 83 deletions.
93 changes: 89 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
name: test

on: push
on:
push:
paths:
- "**.sol"
- "**.toml"
- "**.json"
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
# On-demand
workflow_dispatch: {}


env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]

name: Foundry project
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -32,3 +42,78 @@ jobs:
run: |
forge test -vvv
id: test

- name: Run Forge snapshot
run: forge snapshot
id: snapshot

- name: Run Forge coverage
run: forge coverage --report lcov
id: coverage

- name: Run Gas report
run: forge test --gas-report --isolate
id: gas-report

- name: Run Forge Snapshot Diff
run: forge snapshot --diff
id: snapshot_diff

- name: Run Slither
uses: crytic/[email protected]
id: slither
with:
slither-args: --compile-force-framework foundry --exclude-dependencies --checklist
sarif: results.sarif
fail-on: none

- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: ${{ steps.slither.outputs.sarif }}

fork:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]

name: Foundry project
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: false

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

- name: Run Forge build
run: |
forge --version
forge install
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vvv --rpc-url phalcon
id: test

- name: Run Forge snapshot
run: forge snapshot --rpc-url phalcon
id: snapshot

- name: Run Forge coverage
run: forge coverage --report lcov --rpc-url phalcon
id: coverage

- name: Run Gas report
run: forge test --gas-report --isolate --rpc-url phalcon
id: gas-report

- name: Run Forge Snapshot Diff
run: forge snapshot --diff --rpc-url phalcon
id: snapshot_diff
9 changes: 9 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"trailofbits.sarif-explorer",
"usernamehw.errorlens",
"alefragnani.separators",
"nomicfoundation.hardhat-solidity",
"tintinweb.solidity-visual-auditor"
]
}
6 changes: 5 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,8 @@ optimizerSteps = 'jmul[jul] VcTOcul jmul'
[bind_json]
out = "utils/JsonBindings.sol"
include = []
exclude = []
exclude = []


[rpc_endpoints]
phalcon = "https://rpc.phalcon.blocksec.com/rpc_d03456ef902047418a8bb566ef81c095"
1 change: 1 addition & 0 deletions slither.db.json

Large diffs are not rendered by default.

78 changes: 0 additions & 78 deletions test/FoldCaptiveStakingTest.t.sol

This file was deleted.

0 comments on commit 677fa8d

Please sign in to comment.