Skip to content

Commit 189017e

Browse files
committed
Unify CI workflows to share common steps
1 parent be35fde commit 189017e

File tree

5 files changed

+104
-84
lines changed

5 files changed

+104
-84
lines changed

.github/workflows/analyze.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
setup:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout code
10+
uses: actions/checkout@v4
11+
12+
- name: Install Foundry
13+
uses: foundry-rs/foundry-toolchain@v1
14+
with:
15+
cache-key: foundry-${{ runner.os }}-${{ github.sha }}
16+
cache-restore-keys: |
17+
foundry-${{ runner.os }}-
18+
19+
- name: Check Foundry version
20+
run: forge --version
21+
22+
- name: Install dependencies
23+
run: forge install
24+
25+
- name: Cache build artifacts
26+
uses: actions/cache@v3
27+
with:
28+
path: |
29+
cache
30+
out
31+
key: ${{ runner.os }}-build-${{ hashFiles('**/foundry.toml') }}-${{ hashFiles('**/remappings.txt') }}-${{ hashFiles('**/Cargo.lock') }}
32+
restore-keys: |
33+
${{ runner.os }}-build-
34+
35+
lint:
36+
needs: setup
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v4
41+
42+
- name: Install Foundry
43+
uses: foundry-rs/foundry-toolchain@v1
44+
with:
45+
cache-key: foundry-${{ runner.os }}-${{ github.sha }}
46+
cache-restore-keys: |
47+
foundry-${{ runner.os }}-
48+
49+
- name: Check formatting
50+
run: forge fmt --check
51+
52+
slither:
53+
needs: setup
54+
runs-on: ubuntu-latest
55+
steps:
56+
- name: Checkout code
57+
uses: actions/checkout@v4
58+
59+
- name: Install Foundry
60+
uses: foundry-rs/foundry-toolchain@v1
61+
with:
62+
cache-key: foundry-${{ runner.os }}-${{ github.sha }}
63+
cache-restore-keys: |
64+
foundry-${{ runner.os }}-
65+
66+
- name: Install dependencies
67+
run: forge install
68+
69+
- name: Install Slither
70+
run: pip install slither-analyzer==0.10.0
71+
72+
- name: Run Slither
73+
run: slither .
74+
75+
test:
76+
needs: setup
77+
runs-on: ubuntu-latest
78+
steps:
79+
- name: Checkout code
80+
uses: actions/checkout@v4
81+
82+
- name: Install Foundry
83+
uses: foundry-rs/foundry-toolchain@v1
84+
with:
85+
cache-key: foundry-${{ runner.os }}-${{ github.sha }}
86+
cache-restore-keys: |
87+
foundry-${{ runner.os }}-
88+
89+
- name: Install dependencies
90+
run: forge install
91+
92+
- name: Restore build cache
93+
uses: actions/cache@v3
94+
with:
95+
path: |
96+
cache
97+
out
98+
key: ${{ runner.os }}-build-${{ hashFiles('**/foundry.toml') }}-${{ hashFiles('**/remappings.txt') }}-${{ hashFiles('**/Cargo.lock') }}
99+
100+
- name: Check contract sizes
101+
run: forge build --sizes
102+
103+
- name: Check gas snapshots
104+
run: forge snapshot --check

.github/workflows/lint.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)