Skip to content

Commit 75833e5

Browse files
author
vpnlnetwork
authored
Add ci.yml
1 parent fdd3d2b commit 75833e5

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
permissions:
10+
contents: read
11+
security-events: write # for SARIF upload (slither)
12+
13+
jobs:
14+
build-test-lint:
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 30
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '20'
26+
27+
- name: Cache npm
28+
uses: actions/cache@v4
29+
with:
30+
path: ~/.npm
31+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
32+
restore-keys: |
33+
${{ runner.os }}-node-
34+
35+
- name: Install JS deps (if present)
36+
if: hashFiles('**/package.json') != ''
37+
run: npm ci
38+
39+
- name: Lint Solidity with solhint (if config present)
40+
if: hashFiles('.solhint.json') != '' || hashFiles('.solhint.jsonc') != ''
41+
run: npx solhint 'contracts/**/*.sol'
42+
43+
- name: Setup Foundry
44+
uses: foundry-rs/foundry-toolchain@v1
45+
with:
46+
version: nightly
47+
48+
- name: Foundry build
49+
run: forge build --sizes
50+
51+
- name: Foundry tests
52+
run: forge test -vvv
53+
54+
- name: Generate coverage (best-effort)
55+
run: |
56+
forge coverage --report lcov || echo "coverage optional"
57+
58+
- name: Upload coverage artifact
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: lcov.info
62+
path: lcov.info
63+
if-no-files-found: ignore
64+
65+
- name: Static analysis with Slither (advisory)
66+
uses: crytic/slither-action@v0.3.1
67+
continue-on-error: true
68+
with:
69+
target: .
70+
solc-version: 0.8.23
71+
sarif: true
72+
73+
- name: Upload Slither SARIF (advisory)
74+
if: always()
75+
uses: github/codeql-action/upload-sarif@v3
76+
with:
77+
sarif_file: slither.sarif

0 commit comments

Comments
 (0)