Skip to content

Commit d790497

Browse files
committed
ci: init refactor
1 parent ea39dea commit d790497

File tree

13 files changed

+312
-313
lines changed

13 files changed

+312
-313
lines changed

.github/workflows/contracts.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: Build and deploy contracts
22

33
on:
4-
push:
5-
branches: [ main, develop ]
64
pull_request:
5+
branches:
6+
- '*'
77

88
jobs:
99
detect-changes:
@@ -18,23 +18,25 @@ jobs:
1818
- name: Checkout code
1919
uses: actions/checkout@v4
2020
with:
21-
# Adjust fetch-depth as needed
2221
fetch-depth: 0
2322

2423
- name: Detect package changes
2524
id: changed-files
2625
uses: tj-actions/changed-files@v45
2726
with:
2827
files_yaml: |
28+
dataprotector-deserializer:
29+
- 'packages/dataprotector-deserializer/**'
30+
protected-data-delivery-dapp:
31+
- 'packages/protected-data-delivery-dapp/**'
2932
sdk:
3033
- 'packages/sdk/**'
31-
smart_contract:
34+
sharing-smart-contract:
35+
- 'packages/smart-contract/**'
36+
smart-contract:
3237
- 'packages/smart-contract/**'
3338
subgraph:
3439
- 'packages/subgraph/**'
35-
dapp:
36-
- 'packages/protected-data-delivery-dapp/**'
37-
# Enable matrix output for use in subsequent jobs
3840
matrix: true
3941

4042
build-and-test:
@@ -44,8 +46,6 @@ jobs:
4446
strategy:
4547
matrix:
4648
package: [ sdk, smart_contract, subgraph, dapp ]
47-
# Run this job only if changes were detected in the respective package
48-
if: ${{ fromJson(needs.detect-changes.outputs[matrix.package]).any_changed == 'true' }}
4949
steps:
5050
- name: Checkout code
5151
uses: actions/checkout@v4
File renamed without changes.

.github/workflows/dapp-publish.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Test Docker Image
2+
3+
on:
4+
push:
5+
tags:
6+
- 'protected-data-delivery-dapp-v*'
7+
8+
jobs:
9+
build-test:
10+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/docker-build.yml@fix/docker/types
11+
with:
12+
image-name: 'protected-data-delivery-dapp'
13+
image-tag: ${{ github.sha }}
14+
push: false
15+
dockerfile: 'packages/protected-data-delivery-dapp/Dockerfile'

.github/workflows/dapp-test.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Test Docker Image
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '*' # Trigger on any pull request
7+
paths:
8+
- 'packages/protected-data-delivery-dapp/**' # Trigger only when changes are made to the dapp
9+
10+
jobs:
11+
build-test:
12+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/docker-build.yml@fix/docker/types
13+
with:
14+
image-name: 'protected-data-delivery-dapp'
15+
image-tag: ${{ github.sha }}
16+
push: false
17+
dockerfile: 'packages/protected-data-delivery-dapp/Dockerfile'
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Publish dataprotector-deserializer on npm
2+
3+
on:
4+
push:
5+
tags:
6+
- "dataprotector-deserializer-v*"
7+
8+
jobs:
9+
build-test:
10+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/publish-npm.yml@feat/publish-npm/init-publish-npm
11+
with:
12+
scope: ''
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: dataprotector-deserializer-default
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '*'
7+
paths:
8+
- 'packages/dataprotector-deserializer/**'
9+
10+
jobs:
11+
build_test_dependency:
12+
name: Build test dependency dataprotector-sdk
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v3
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 18
21+
- name: Build et tests de dataprotector-sdk
22+
working-directory: packages/sdk
23+
run: |
24+
npm ci
25+
npm run codegen
26+
npm run build
27+
28+
install:
29+
name: Install
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v3
34+
- name: Setup Node.js
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: 18
38+
- name: Installation et préparation des tests
39+
working-directory: packages/dataprotector-deserializer
40+
run: |
41+
node -v
42+
npm -v
43+
npm ci
44+
npm run test:prepare
45+
46+
format:
47+
name: Format
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Checkout repository
51+
uses: actions/checkout@v3
52+
- name: Setup Node.js
53+
uses: actions/setup-node@v4
54+
with:
55+
node-version: 18
56+
- name: Vérification du format
57+
working-directory: packages/dataprotector-deserializer
58+
run: npm run check-format
59+
60+
lint:
61+
name: Lint
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: Checkout repository
65+
uses: actions/checkout@v3
66+
- name: Setup Node.js
67+
uses: actions/setup-node@v4
68+
with:
69+
node-version: 18
70+
- name: Exécution du lint
71+
working-directory: packages/dataprotector-deserializer
72+
run: npm run lint
73+
74+
check_types:
75+
name: Check types
76+
runs-on: ubuntu-latest
77+
steps:
78+
- name: Checkout repository
79+
uses: actions/checkout@v3
80+
- name: Setup Node.js
81+
uses: actions/setup-node@v4
82+
with:
83+
node-version: 18
84+
- name: Vérification des types
85+
working-directory: packages/dataprotector-deserializer
86+
run: npm run check-types
87+
88+
test:
89+
name: Test
90+
runs-on: ubuntu-latest
91+
steps:
92+
- name: Checkout repository
93+
uses: actions/checkout@v3
94+
- name: Setup Node.js
95+
uses: actions/setup-node@v4
96+
with:
97+
node-version: 18
98+
- name: Exécution des tests
99+
working-directory: packages/dataprotector-deserializer
100+
run: npm run test
101+
102+
build:
103+
name: Build
104+
runs-on: ubuntu-latest
105+
steps:
106+
- name: Checkout repository
107+
uses: actions/checkout@v3
108+
- name: Setup Node.js
109+
uses: actions/setup-node@v4
110+
with:
111+
node-version: 18
112+
- name: Build final
113+
working-directory: packages/dataprotector-deserializer
114+
run: npm run build
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ jobs:
1818
uses: googleapis/release-please-action@v4
1919
with:
2020
token: ${{ secrets.DEPLOY_TOKEN }}
21-
config-file: release-please-config.json
21+
config-file: release-please-config.json
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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/slither-action@v0.4.0
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: 'ci-bellecour-fork'
87+
88+
- name: Upgrade Test
89+
working-directory: packages/sharing-smart-contract
90+
run: npm run upgrade-local-fork -- --network ci-bellecour-fork
91+
92+
- name: Forge Tests
93+
working-directory: packages/sharing-smart-contract
94+
run: forge test --no-match-test "invariant" -vvvv
95+
96+
- name: Upload SARIF file
97+
uses: github/codeql-action/upload-sarif@v3
98+
with:
99+
sarif_file: ${{ steps.slither.outputs.sarif }}

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"packages/dataprotector-deserializer": "0.11.1",
44
"packages/sharing-smart-contract": "v2.0.0",
55
"packages/subgraph": "3.0.0",
6-
"protected-data-delivery-dapp": "1.0.0"
6+
"packages/protected-data-delivery-dapp": "1.0.0"
77
}

0 commit comments

Comments
 (0)