Skip to content

Commit

Permalink
Merge pull request #67 from ronin-chain/script/add-more-postchecks
Browse files Browse the repository at this point in the history
script: add more postchecks
  • Loading branch information
TuDo1403 authored Aug 26, 2024
2 parents 4a68d51 + 49cf228 commit aeb52c4
Show file tree
Hide file tree
Showing 122 changed files with 2,653 additions and 3,588 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/post-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Post Check

on:
push:
branches:
- mainnet
- testnet
- "feature/*"
- "features/*"
- "feat/*"
- "feats/*"
pull_request:
branches:
- mainnet
- testnet
- "feature/*"
- "features/*"
- "feat/*"
- "feats/*"
- "release/*"

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest

env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

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

- name: Update package with soldeer
run: forge soldeer update

- name: Recursively update dependencies
run: |
chmod +x ./update-deps.sh
./update-deps.sh
id: update-deps

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

- name: Run PostCheck CI
run: |
./run.sh PostCheckCI -f ronin-mainnet -vvvv
id: postcheck
69 changes: 69 additions & 0 deletions .github/workflows/slither-analyze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Slither Analyze

on:
push:
branches:
- mainnet
- testnet
- "feature/*"
- "features/*"
- "feat/*"
- "feats/*"
pull_request:
branches:
- mainnet
- testnet
- "feature/*"
- "features/*"
- "feat/*"
- "feats/*"
- "release/*"

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest

env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

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

- name: Update package with soldeer
run: forge soldeer update

- name: Recursively update dependencies
run: |
chmod +x ./update-deps.sh
./update-deps.sh
id: update-deps

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

- name: Install Slither for security analysis
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
python3 -m pip install slither-analyzer
- name: Run Slither analysis
run: |
slither . --exclude-low --exclude-medium --exclude-informational --exclude-dependencies --filter-paths "dependencies/|mocks/" --exclude-optimization
id: slither
30 changes: 17 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
name: test
name: Unit Test

on:
push:
branches:
- mainnet
- testnet
- 'feature/*'
- 'features/*'
- 'feat/*'
- 'feats/*'
- "feature/*"
- "features/*"
- "feat/*"
- "feats/*"
pull_request:
branches:
- mainnet
- testnet
- 'feature/*'
- 'features/*'
- 'feat/*'
- 'feats/*'
- 'release/*'
- "feature/*"
- "features/*"
- "feat/*"
- "feats/*"
- "release/*"

env:
FOUNDRY_PROFILE: ci
Expand All @@ -29,15 +29,18 @@ jobs:

name: Foundry project
runs-on: ubuntu-latest

env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

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

- name: Update package with soldeer
run: forge soldeer update
Expand All @@ -46,6 +49,7 @@ jobs:
run: |
chmod +x ./update-deps.sh
./update-deps.sh
id: update-deps

- name: Run Forge build
run: |
Expand All @@ -56,4 +60,4 @@ jobs:
- name: Run Forge tests
run: |
forge test -vvv
id: test
id: test
7 changes: 0 additions & 7 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
[submodule "lib/prb-test"]
branch = release-v0
path = lib/prb-test
url = https://github.com/PaulRBerg/prb-test
[submodule "lib/prb-math"]
path = lib/prb-math
url = https://github.com/PaulRBerg/prb-math
branch = release-v4
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/openzeppelin/openzeppelin-contracts
11 changes: 9 additions & 2 deletions .husky/generate-layout.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
#!/bin/sh

rm -rf logs/storage/*

dirOutputs=$(ls out | grep '^[^.]*\.sol$') # assuming the out dir is at 'out'

while IFS= read -r contractDir; do
innerdirOutputs=$(ls out/$contractDir)
innerDirOutputs=$(ls out/$contractDir)

# Skip if folder ends with .s.sol
if [[ $contractDir == *".s.sol" ]]; then
continue
fi

while IFS= read -r jsonFile; do
fileIn=out/$contractDir/$jsonFile
fileOut=logs/storage/$contractDir:${jsonFile%.json}.log
node .husky/storage-logger.js $fileIn $fileOut &
done <<< "$innerdirOutputs"
done <<< "$innerDirOutputs"
done <<< "$dirOutputs"

# Wait for all background jobs to finish
Expand Down
4 changes: 2 additions & 2 deletions .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ stashed=true
if [[ $output == *"No local changes to save"* ]]; then
stashed=false
fi
forge build --skip test script --sizes 2>&1 | sed -n '/Contract/,$p' > logs/contract-code-sizes.log
forge build --skip test --skip script --sizes 2>&1 | sed -n '/Contract/,$p' >logs/contract-code-sizes.log
.husky/generate-layout.sh

git add logs
Expand All @@ -21,5 +21,5 @@ if [ "$line_count" -gt 1 ]; then
fi

if $stashed; then
git stash pop
git stash pop
fi
Loading

0 comments on commit aeb52c4

Please sign in to comment.