Skip to content

Commit b6fedb9

Browse files
committed
ci(ssc): add workflow for sharing smart contract tests
1 parent 6470405 commit b6fedb9

File tree

2 files changed

+98
-126
lines changed

2 files changed

+98
-126
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: CI Sharing Smart Contract
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '*'
7+
paths:
8+
- 'packages/sharing-smart-contract/**'
9+
10+
concurrency:
11+
group: ${{ github.ref }}-sharing-smart-contract-tests
12+
cancel-in-progress: true
13+
14+
jobs:
15+
build-and-test:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: '18'
25+
26+
- name: Install Dependencies
27+
working-directory: packages/sharing-smart-contract
28+
run: |
29+
node -v
30+
npm -v
31+
npm ci
32+
- name: Install Foundry
33+
uses: foundry-rs/foundry-toolchain@v1
34+
with:
35+
version: stable
36+
cache: true
37+
38+
- name: Compile
39+
working-directory: packages/sharing-smart-contract
40+
run: npm run compile
41+
42+
- name: Check Format
43+
working-directory: packages/sharing-smart-contract
44+
run: npm run check-format
45+
46+
- name: Lint
47+
working-directory: packages/sharing-smart-contract
48+
run: npm run lint
49+
50+
- name: UML Diagrams
51+
working-directory: packages/sharing-smart-contract
52+
run: npm run uml
53+
54+
- name: Static Analyzer
55+
uses: crytic/[email protected]
56+
id: slither
57+
with:
58+
sarif: result.sarif
59+
fail-on: none
60+
target: 'packages/sharing-smart-contract/'
61+
62+
- name: Start Anvil
63+
run: |
64+
anvil --host 0.0.0.0 --port 8545 --hardfork berlin --fork-url https://bellecour.iex.ec --chain-id 134 --gas-limit 6700000 --gas-price 0 &
65+
66+
- name: Wait for Anvil to start
67+
run: |
68+
timeout=30
69+
interval=1
70+
echo "Waiting for Anvil to start..."
71+
for ((i=0; i<timeout; i++)); do
72+
if nc -z localhost 8545; then
73+
echo "Anvil is operational."
74+
exit 0
75+
fi
76+
echo "Attempt $((i+1)) of $timeout: Anvil is not ready, waiting ${interval}s..."
77+
sleep $interval
78+
done
79+
echo "Error: Anvil did not start within the timeout period."
80+
exit 1
81+
82+
- name: Hardhat Tests
83+
uses: ambersun1234/hardhat-test-action@v1
84+
with:
85+
network: 'ci-bellecour-fork'
86+
87+
- name: Upgrade Test
88+
working-directory: packages/sharing-smart-contract
89+
run: npm run upgrade-local-fork -- --network ci-bellecour-fork
90+
91+
- name: Forge Tests
92+
working-directory: packages/sharing-smart-contract
93+
run: forge test --no-match-test "invariant" -vvvv
94+
95+
- name: Upload SARIF file
96+
uses: github/codeql-action/upload-sarif@v3
97+
with:
98+
sarif_file: ${{ steps.slither.outputs.sarif }}

packages/sharing-smart-contract/.drone.yml

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

0 commit comments

Comments
 (0)