Skip to content

Commit 1a6e533

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

File tree

2 files changed

+100
-126
lines changed

2 files changed

+100
-126
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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+
33+
- name: Install Foundry
34+
uses: foundry-rs/foundry-toolchain@v1
35+
with:
36+
version: stable
37+
cache: true
38+
39+
- name: Compile
40+
working-directory: packages/sharing-smart-contract
41+
run: npm run compile
42+
43+
- name: Check Format
44+
working-directory: packages/sharing-smart-contract
45+
run: npm run check-format
46+
47+
- name: Lint
48+
working-directory: packages/sharing-smart-contract
49+
run: npm run lint
50+
51+
- name: UML Diagrams
52+
working-directory: packages/sharing-smart-contract
53+
run: npm run uml
54+
55+
- name: Static Analyzer
56+
uses: crytic/[email protected]
57+
id: slither
58+
with:
59+
sarif: result.sarif
60+
fail-on: none
61+
target: 'packages/sharing-smart-contract/'
62+
63+
- name: Start Anvil
64+
run: |
65+
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 &
66+
67+
- name: Wait for Anvil to start
68+
run: |
69+
timeout=30
70+
interval=1
71+
echo "Waiting for Anvil to start..."
72+
for ((i=0; i<timeout; i++)); do
73+
if nc -z localhost 8545; then
74+
echo "Anvil is operational."
75+
exit 0
76+
fi
77+
echo "Attempt $((i+1)) of $timeout: Anvil is not ready, waiting ${interval}s..."
78+
sleep $interval
79+
done
80+
echo "Error: Anvil did not start within the timeout period."
81+
exit 1
82+
83+
- name: Hardhat Tests
84+
uses: ambersun1234/hardhat-test-action@v1
85+
with:
86+
network: 'local-bellecour-fork'
87+
rpc_url: 'http://127.0.0.1:8545'
88+
89+
- name: Upgrade Test
90+
working-directory: packages/sharing-smart-contract
91+
run: npm run upgrade-local-fork -- --network local-bellecour-fork
92+
93+
- name: Forge Tests
94+
working-directory: packages/sharing-smart-contract
95+
run: forge test --no-match-test "invariant" -vvvv
96+
97+
- name: Upload SARIF file
98+
uses: github/codeql-action/upload-sarif@v3
99+
with:
100+
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)