Skip to content

Commit ae2fe8c

Browse files
authored
Chore: Add CI workflow (#11)
* chore: add CI workflow * remove API_KEY from CI * add bepolia branch
1 parent 9b137c8 commit ae2fe8c

File tree

4 files changed

+149
-0
lines changed

4 files changed

+149
-0
lines changed

.github/workflows/ci.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- devel
9+
- bepolia
10+
11+
jobs:
12+
ci:
13+
runs-on:
14+
labels: berachain-devnet-gha-runner
15+
strategy:
16+
matrix:
17+
include:
18+
- job_name: lint
19+
command: bun run lint
20+
summary: "## Lint result"
21+
- job_name: build
22+
command: forge build
23+
summary: "## Build result"
24+
- job_name: coverage
25+
command: forge coverage --fuzz-runs 256 --report lcov --report-file ./test-forge-cover.txt
26+
summary: "## Coverage result"
27+
name: ${{ matrix.job_name }}
28+
steps:
29+
- name: Check out the repo
30+
uses: actions/checkout@v4
31+
with:
32+
submodules: recursive
33+
34+
- name: Install Foundry
35+
uses: foundry-rs/foundry-toolchain@v1
36+
37+
- name: Install Bun
38+
uses: oven-sh/setup-bun@v1
39+
40+
- name: Install the Node.js dependencies
41+
run: bun install
42+
43+
- name: Execute Job Command
44+
run: ${{ matrix.command }}
45+
46+
- name: Add Job Summary
47+
run: |
48+
echo ${{ matrix.summary }} >> $GITHUB_STEP_SUMMARY
49+
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
50+
51+
- if: ${{ matrix.job_name == 'coverage' }}
52+
name: Upload coverage reports to Codecov
53+
uses: codecov/codecov-action@v2
54+
with:
55+
token: ${{ secrets.CODECOV_TOKEN }}
56+
files: ./test-forge-cover.txt

.github/workflows/slither.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Slither Analysis
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
analyze:
8+
runs-on: ubuntu-latest
9+
steps:
10+
# Add Docker Hub authentication with rate limiting configuration
11+
- name: Login to Docker Hub
12+
uses: docker/login-action@v2
13+
with:
14+
username: ${{ secrets.DOCKERHUB_USER }}
15+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
16+
registry: docker.io
17+
18+
- uses: actions/checkout@v4
19+
20+
- uses: crytic/[email protected]
21+
with:
22+
fail-on: none
23+
24+
- name: Slither Summary
25+
run: |
26+
echo "## Slither result" >> $GITHUB_STEP_SUMMARY
27+
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY

.github/workflows/tests-merge.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Tests-Merge
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- devel
8+
- bepolia
9+
10+
jobs:
11+
test:
12+
runs-on:
13+
labels: berachain-devnet-gha-runner
14+
timeout-minutes: 30
15+
steps:
16+
- name: Check out the repo
17+
uses: actions/checkout@v4
18+
with:
19+
submodules: recursive
20+
21+
- name: Install Foundry
22+
uses: foundry-rs/foundry-toolchain@v1
23+
24+
- name: Install Bun
25+
uses: oven-sh/setup-bun@v1
26+
27+
- name: Install the Node.js dependencies
28+
run: bun install
29+
30+
- name: Generate a fuzz seed that changes weekly to avoid burning through RPC allowance
31+
run: echo "FOUNDRY_FUZZ_SEED=$(echo $(($EPOCHSECONDS - $EPOCHSECONDS % 604800)))" >> $GITHUB_ENV
32+
33+
- name: Run tests
34+
run: forge test
35+
env:
36+
FOUNDRY_PROFILE: ci

.github/workflows/tests-pr.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Tests-PR
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
test:
8+
runs-on:
9+
labels: berachain-devnet-gha-runner
10+
timeout-minutes: 30
11+
steps:
12+
- name: Check out the repo
13+
uses: actions/checkout@v4
14+
with:
15+
submodules: recursive
16+
17+
- name: Install Foundry
18+
uses: foundry-rs/foundry-toolchain@v1
19+
20+
- name: Install Bun
21+
uses: oven-sh/setup-bun@v1
22+
23+
- name: Install the Node.js dependencies
24+
run: bun install
25+
26+
- name: Generate a fuzz seed that changes weekly to avoid burning through RPC allowance
27+
run: echo "FOUNDRY_FUZZ_SEED=$(echo $(($EPOCHSECONDS - $EPOCHSECONDS % 604800)))" >> $GITHUB_ENV
28+
29+
- name: Run tests
30+
run: forge test

0 commit comments

Comments
 (0)