Skip to content

Commit 7a22353

Browse files
Merge branch 'main' into feature/sdk/add-callbackk-machanism
2 parents 69b350d + a88a12f commit 7a22353

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+12659
-7060
lines changed

.drone.yml

Lines changed: 0 additions & 1282 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: check-conventional-commits
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
check-conventional-commits:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- name: Check Commit Conventions
11+
uses: webiny/[email protected]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: check-conventional-commit-pr-title
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- reopened
9+
10+
jobs:
11+
lint-pr-title:
12+
permissions:
13+
pull-requests: read
14+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]

.github/workflows/dapp-ci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: web3mail-dapp-ci
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'dapp/**'
7+
8+
concurrency:
9+
group: ${{ github.ref }}-dapp-ci
10+
cancel-in-progress: true
11+
12+
env:
13+
WORKING_DIRECTORY: ./dapp
14+
15+
jobs:
16+
check-code:
17+
runs-on: ubuntu-latest
18+
defaults:
19+
run:
20+
working-directory: ${{ env.WORKING_DIRECTORY }}
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- uses: actions/setup-node@v4
25+
with:
26+
node-version: '20.19.0'
27+
cache: 'npm'
28+
cache-dependency-path: dapp/package-lock.json
29+
30+
- name: Install Dependencies
31+
run: npm ci
32+
33+
- name: Lint
34+
run: npm run lint
35+
36+
- name: Check format (prettier)
37+
run: npm run check-format
38+
39+
test:
40+
runs-on: ubuntu-latest
41+
strategy:
42+
matrix:
43+
environment: ['bellecour-dev', 'arbitrum-sepolia-dev']
44+
environment: ${{ matrix.environment }}
45+
defaults:
46+
run:
47+
working-directory: ${{ env.WORKING_DIRECTORY }}
48+
env:
49+
MJ_APIKEY_PUBLIC: ${{ secrets.MAILJET_APIKEY_PUBLIC }}
50+
MJ_APIKEY_PRIVATE: ${{ secrets.MAILJET_APIKEY_PRIVATE }}
51+
MJ_SENDER: ${{ secrets.MAILJET_SENDER }}
52+
MAILGUN_APIKEY: ${{ secrets.MAILGUN_APIKEY }}
53+
WEB3MAIL_WHITELISTED_APPS: ${{ vars.WEB3MAIL_WHITELISTED_APPS }}
54+
POCO_SUBGRAPH_URL: ${{ vars.POCO_SUBGRAPH_URL }}
55+
steps:
56+
- uses: actions/checkout@v4
57+
58+
- uses: actions/setup-node@v4
59+
with:
60+
node-version: '20.19.0'
61+
cache: 'npm'
62+
cache-dependency-path: dapp/package-lock.json
63+
64+
- name: Install Dependencies
65+
run: npm ci
66+
67+
- name: Test with coverage
68+
run: npm run ctest

.github/workflows/dapp-deploy.yml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: deploy-dapp
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
environment:
7+
description: 'Deployment environment'
8+
required: true
9+
type: choice
10+
options:
11+
# dev environments
12+
- bellecour-dev
13+
- arbitrum-sepolia-dev
14+
# prod environments (requires a tag starting with dapp-v)
15+
- bellecour-prod
16+
- arbitrum-sepolia-prod
17+
- arbitrum-mainnet-prod
18+
19+
jobs:
20+
extract-tag:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
clean_tag: ${{ steps.tag.outputs.clean_tag }}
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
# if input environment ends with -prod
28+
# ref should be a tag beginning with dapp-v if not exit error
29+
# use unique clean-tag: <tag>-<timestamp>
30+
# else
31+
# use rolling clean-tag: dev
32+
- name: Check and extract tag
33+
id: tag
34+
run: |
35+
if [[ "${{ github.event.inputs.environment }}" == *-prod ]]; then
36+
if [[ "${GITHUB_REF}" != refs/tags/dapp-v* ]]; then
37+
echo "Error: The ref must be a tag starting with 'dapp-v' for production deployments."
38+
exit 1
39+
fi
40+
TAG=${GITHUB_REF#refs/tags/dapp-v}-$(date +%s)
41+
echo "clean_tag=${TAG}" | tee -a $GITHUB_OUTPUT
42+
else
43+
echo "clean_tag=dev" | tee -a $GITHUB_OUTPUT
44+
fi
45+
46+
docker-publish:
47+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
48+
needs: [extract-tag]
49+
with:
50+
image-name: 'iexechub/web3mail-dapp'
51+
registry: 'docker.io'
52+
dockerfile: 'dapp/Dockerfile'
53+
context: 'dapp'
54+
security-scan: true
55+
security-report: 'sarif'
56+
hadolint: true
57+
push: true
58+
image-tag: ${{ needs.extract-tag.outputs.clean_tag }}
59+
secrets:
60+
username: ${{ secrets.DOCKERHUB_USERNAME }}
61+
password: ${{ secrets.DOCKERHUB_PAT }}
62+
63+
sconify:
64+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
65+
needs: [docker-publish, extract-tag]
66+
with:
67+
image-name: 'iexechub/web3mail-dapp'
68+
image-tag: ${{ needs.extract-tag.outputs.clean_tag }}
69+
sconify-debug: false
70+
sconify-prod: true
71+
docker-registry: docker.io
72+
sconify-version: '5.9.0-v15'
73+
binary: /usr/local/bin/node
74+
command: node
75+
host-path: |
76+
/etc/hosts
77+
/etc/resolv.conf
78+
binary-fs: true
79+
fs-dir: /app
80+
heap: 7G
81+
dlopen: 1
82+
mprotect: 1
83+
secrets:
84+
docker-username: ${{ secrets.DOCKERHUB_USERNAME }}
85+
docker-password: ${{ secrets.DOCKERHUB_PAT }}
86+
scontain-username: ${{ secrets.SCONTAIN_REGISTRY_USERNAME }}
87+
scontain-password: ${{ secrets.SCONTAIN_REGISTRY_PAT }}
88+
scone-signing-key: ${{ secrets.SCONIFY_SIGNING_PRIVATE_KEY }}
89+
90+
deploy-dapp:
91+
needs: [extract-tag, sconify]
92+
runs-on: ubuntu-latest
93+
environment: ${{ inputs.environment }}
94+
steps:
95+
- name: Checkout code
96+
uses: actions/checkout@v4
97+
98+
- name: Setup Node.js
99+
uses: actions/setup-node@v4
100+
with:
101+
node-version: '20.19.0'
102+
cache: 'npm'
103+
104+
- name: Install dependencies
105+
run: |
106+
npm ci
107+
cd node_modules/whitelist-smart-contract
108+
npm install --save-dev ts-node
109+
cd ../../deployment-dapp
110+
npm ci
111+
112+
- name: Deploy dapp contract
113+
env:
114+
WALLET_PRIVATE_KEY: ${{ secrets.WEB3MAIL_APP_OWNER_PRIVATEKEY }}
115+
DOCKER_IMAGE_TAG: ${{ needs.sconify.outputs.prod-image-tag }}
116+
CHECKSUM: ${{ needs.sconify.outputs.prod-checksum }}
117+
FINGERPRINT: ${{ needs.sconify.outputs.prod-mrenclave }}
118+
RPC_URL: ${{ secrets.RPC_URL }}
119+
run: |
120+
cd deployment-dapp
121+
npm run deploy-dapp
122+
123+
- name: Push dapp secret
124+
env:
125+
WALLET_PRIVATE_KEY: ${{ secrets.WEB3MAIL_APP_OWNER_PRIVATEKEY }}
126+
MJ_APIKEY_PUBLIC: ${{ secrets.MAILJET_APIKEY_PUBLIC }}
127+
MJ_APIKEY_PRIVATE: ${{ secrets.MAILJET_APIKEY_PRIVATE }}
128+
MJ_SENDER: ${{ secrets.MAILJET_SENDER }}
129+
MAILGUN_APIKEY: ${{ secrets.MAILGUN_APIKEY }}
130+
WEB3MAIL_WHITELISTED_APPS: ${{ vars.WEB3MAIL_WHITELISTED_APPS }}
131+
POCO_SUBGRAPH_URL: ${{ vars.POCO_SUBGRAPH_URL }}
132+
RPC_URL: ${{ secrets.RPC_URL }}
133+
run: |
134+
cd deployment-dapp
135+
npm run push-dapp-secret
136+
137+
- name: Publish free sell order
138+
env:
139+
WALLET_PRIVATE_KEY: ${{ secrets.WEB3MAIL_APP_OWNER_PRIVATEKEY }}
140+
PRICE: ${{ vars.SELL_ORDER_PRICE }}
141+
VOLUME: ${{ vars.SELL_ORDER_VOLUME }}
142+
RPC_URL: ${{ secrets.RPC_URL }}
143+
run: |
144+
cd deployment-dapp
145+
npm run publish-sell-order
146+
147+
- name: Add resource to whitelist
148+
env:
149+
CONTRACT_ADDRESS: ${{ vars.WEB3MAIL_WHITELIST_CONTRACT_ADDRESS }}
150+
PRIVATE_KEY: ${{ secrets.WEB3MAIL_APP_OWNER_PRIVATEKEY }}
151+
RPC_URL: ${{ secrets.RPC_URL }}
152+
run: |
153+
cd node_modules/whitelist-smart-contract
154+
export ADDRESS_TO_ADD=$(cat ../../deployment-dapp/.app-address)
155+
npm run addResourceToWhitelist -- --network ${{ vars.WHITELIST_NETWORK_NAME }}
156+
157+
- name: Configure ENS
158+
if: ${{ vars.DAPP_ENS_NAME }}
159+
env:
160+
WALLET_PRIVATE_KEY: ${{ secrets.WEB3MAIL_APP_OWNER_PRIVATEKEY }}
161+
DAPP_ENS_NAME: ${{ vars.DAPP_ENS_NAME }}
162+
run: |
163+
cd deployment-dapp
164+
npm run configure-ens
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: deployment-dapp-ci
2+
on:
3+
pull_request:
4+
branches:
5+
- '*'
6+
paths:
7+
- 'deployment-dapp/**'
8+
9+
concurrency:
10+
group: ${{ github.ref }}-deployment-dapp-ci
11+
cancel-in-progress: true
12+
13+
jobs:
14+
check-code:
15+
runs-on: ubuntu-latest
16+
defaults:
17+
run:
18+
working-directory: ./deployment-dapp
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: '20.19.0'
25+
cache: 'npm'
26+
cache-dependency-path: deployment-dapp/package-lock.json
27+
28+
- name: Install Dependencies
29+
run: npm ci
30+
31+
- name: Lint
32+
run: npm run lint
33+
34+
- name: Check formatting
35+
run: npm run check-format
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
permissions:
7+
contents: write
8+
issues: write
9+
pull-requests: write
10+
11+
name: release-please
12+
13+
jobs:
14+
release-please:
15+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
16+
secrets: inherit

.github/workflows/reusable-npm.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: reusable-npm-publish
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
dry-run:
7+
description: 'Run in dry-run mode (the package will not be published)'
8+
default: false
9+
type: boolean
10+
version:
11+
description: 'Version to publish (leave empty to use package.json version)'
12+
default: ''
13+
type: string
14+
tag:
15+
description: 'npm publish tag (e.g., latest, nightly)'
16+
default: ''
17+
type: string
18+
secrets:
19+
npm-token:
20+
description: 'NPM auth token (required unless `dry-run: true`)'
21+
required: false
22+
23+
jobs:
24+
npm-publish:
25+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
26+
with:
27+
install-command: npm ci
28+
build-command: npm run build
29+
dry-run: ${{ inputs.dry-run }}
30+
tag: ${{ inputs.tag }}
31+
version: ${{ inputs.version }}
32+
environment: ${{ (inputs.dry-run && '') || inputs.tag }}
33+
provenance: ${{ !inputs.dry-run }}
34+
secrets:
35+
npm-token: ${{ secrets.npm-token }}

0 commit comments

Comments
 (0)