-
Notifications
You must be signed in to change notification settings - Fork 10
Chore/ci workflows #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chore/ci workflows #193
Changes from all commits
2906edf
19710ab
05d016f
f9e8f26
f06e27a
e9d4cf8
c2ea9ba
27924c6
6655b28
cddddea
69bcd03
2993fe4
0367d29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| name: check-conventional-commits | ||
|
|
||
| on: [pull_request] | ||
|
|
||
| jobs: | ||
| check-conventional-commits: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Check Commit Conventions | ||
| uses: webiny/[email protected] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| name: check-conventional-commit-pr-title | ||
|
|
||
| on: | ||
| pull_request_target: | ||
| types: | ||
| - opened | ||
| - edited | ||
| - reopened | ||
|
|
||
| jobs: | ||
| lint-pr-title: | ||
| permissions: | ||
| pull-requests: read | ||
| uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| name: web3mail-dapp-ci | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'dapp/**' | ||
|
|
||
| concurrency: | ||
| group: ${{ github.ref }}-dapp-ci | ||
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| WORKING_DIRECTORY: ./dapp | ||
|
|
||
| jobs: | ||
| check-code: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: ${{ env.WORKING_DIRECTORY }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20.19.0' | ||
| cache: 'npm' | ||
| cache-dependency-path: dapp/package-lock.json | ||
|
|
||
| - name: Install Dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Lint | ||
| run: npm run lint | ||
|
|
||
| - name: Check format (prettier) | ||
| run: npm run check-format | ||
|
|
||
| test: | ||
| runs-on: ubuntu-latest | ||
| environment: bellecour-dev | ||
| defaults: | ||
| run: | ||
| working-directory: ${{ env.WORKING_DIRECTORY }} | ||
| env: | ||
| MJ_APIKEY_PUBLIC: ${{ secrets.MAILJET_APIKEY_PUBLIC }} | ||
| MJ_APIKEY_PRIVATE: ${{ secrets.MAILJET_APIKEY_PRIVATE }} | ||
| MJ_SENDER: ${{ secrets.MAILJET_SENDER }} | ||
| MAILGUN_APIKEY: ${{ secrets.MAILGUN_APIKEY }} | ||
| WEB3MAIL_WHITELISTED_APPS: ${{ secrets.WEB3MAIL_WHITELISTED_APPS }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20.19.0' | ||
| cache: 'npm' | ||
| cache-dependency-path: dapp/package-lock.json | ||
|
|
||
| - name: Install Dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Test unit | ||
| run: npm run test | ||
|
|
||
| - name: Test with coverage | ||
| run: npm run ctest |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we may want to refactor using enviroments secrets instead of dev/prod in en names https://docs.github.com/en/actions/how-tos/security-for-github-actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-an-environment |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,154 @@ | ||
| name: deploy-dapp | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| environment: | ||
| description: 'Deployment environment' | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - bellecour-dev | ||
| - arbitrum-sepolia-dev | ||
| - arbitrum-mainnet-dev | ||
| price: | ||
| description: 'Sell order price (optionnel)' | ||
| type: string | ||
| required: false | ||
| default: '' | ||
| volume: | ||
| description: 'Sell order volume (optionnel)' | ||
| type: string | ||
| required: false | ||
| default: '' | ||
|
|
||
| jobs: | ||
| extract-tag: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| clean_tag: ${{ steps.tag.outputs.clean_tag }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Extract tag | ||
| id: tag | ||
| run: | | ||
| echo "clean_tag=dev" | tee -a $GITHUB_OUTPUT | ||
|
|
||
| docker-publish: | ||
| uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected] | ||
| needs: [extract-tag] | ||
| with: | ||
| image-name: 'iexechub/web3mail-dapp' | ||
| registry: 'docker.io' | ||
| dockerfile: 'dapp/Dockerfile' | ||
| context: 'dapp' | ||
| security-scan: true | ||
| security-report: 'sarif' | ||
| hadolint: true | ||
| push: true | ||
| image-tag: ${{ needs.extract-tag.outputs.clean_tag }} | ||
| secrets: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_PAT }} | ||
|
|
||
| sconify: | ||
| uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected] | ||
| needs: [docker-publish, extract-tag] | ||
| with: | ||
| image-name: 'iexechub/web3mail-dapp' | ||
| image-tag: ${{ needs.extract-tag.outputs.clean_tag }} | ||
| sconify-debug: false | ||
| sconify-prod: true | ||
| docker-registry: docker.io | ||
| sconify-version: '5.9.0-v15' | ||
| binary: /usr/local/bin/node | ||
| command: node /app/src/app.js | ||
| host-path: | | ||
| /etc/hosts | ||
| /etc/resolv.conf | ||
| binary-fs: true | ||
| fs-dir: /app | ||
| heap: 1G | ||
| dlopen: 1 | ||
| mprotect: 1 | ||
| secrets: | ||
| docker-username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| docker-password: ${{ secrets.DOCKERHUB_PAT }} | ||
| scontain-username: ${{ secrets.SCONTAIN_REGISTRY_USERNAME }} | ||
| scontain-password: ${{ secrets.SCONTAIN_REGISTRY_PAT }} | ||
| scone-signing-key: ${{ secrets.SCONIFY_SIGNING_PRIVATE_KEY }} | ||
|
|
||
| deploy-dapp: | ||
| needs: [extract-tag, sconify] | ||
| runs-on: ubuntu-latest | ||
| environment: ${{ inputs.environment }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20.19.0' | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| npm ci | ||
| cd node_modules/whitelist-smart-contract | ||
| npm install --save-dev ts-node | ||
| cd ../../deployment-dapp | ||
| npm ci | ||
|
|
||
| - name: Deploy dapp contract | ||
| env: | ||
| WALLET_PRIVATE_KEY: ${{ secrets.WEB3MAIL_DAPP_OWNER_PRIVATEKEY }} | ||
| DOCKER_IMAGE_TAG: ${{ needs.sconify.outputs.prod-image-tag }} | ||
| CHECKSUM: ${{ needs.sconify.outputs.prod-checksum }} | ||
| FINGERPRINT: ${{ needs.sconify.outputs.prod-mrenclave }} | ||
| RPC_URL: ${{ secrets.RPC_URL }} | ||
| run: | | ||
| cd deployment-dapp | ||
| npm run deploy-dapp | ||
|
|
||
| - name: Push dapp secret | ||
| env: | ||
| WALLET_PRIVATE_KEY: ${{ secrets.WEB3MAIL_DAPP_OWNER_PRIVATEKEY }} | ||
| MJ_APIKEY_PUBLIC: ${{ secrets.MAILJET_APIKEY_PUBLIC }} | ||
| MJ_APIKEY_PRIVATE: ${{ secrets.MAILJET_APIKEY_PRIVATE }} | ||
| MJ_SENDER: ${{ secrets.MAILJET_SENDER }} | ||
| MAILGUN_APIKEY: ${{ secrets.MAILGUN_APIKEY }} | ||
| WEB3MAIL_WHITELISTED_APPS: ${{ vars.WEB3MAIL_WHITELISTED_APPS }} | ||
| RPC_URL: ${{ secrets.RPC_URL }} | ||
| run: | | ||
| cd deployment-dapp | ||
| npm run push-dapp-secret | ||
|
|
||
| - name: Publish free sell order | ||
| env: | ||
| WALLET_PRIVATE_KEY: ${{ secrets.WEB3MAIL_DAPP_OWNER_PRIVATEKEY }} | ||
| PRICE: ${{ inputs.price || vars.SELL_ORDER_PRICE }} | ||
| VOLUME: ${{ inputs.volume || vars.SELL_ORDER_VOLUME }} | ||
| RPC_URL: ${{ secrets.RPC_URL }} | ||
| run: | | ||
| cd deployment-dapp | ||
| npm run publish-sell-order | ||
|
|
||
| - name: Add resource to whitelist | ||
| env: | ||
| CONTRACT_ADDRESS: ${{ secrets.WEB3MAIL_WHITELIST_CONTRACT_ADDRESS }} | ||
| WALLET_PRIVATE_KEY: ${{ secrets.WEB3MAIL_DAPP_OWNER_PRIVATEKEY }} | ||
| run: | | ||
| cd node_modules/whitelist-smart-contract | ||
| export ADDRESS_TO_ADD=$(cat ../../deployment-dapp/.app-address) && npm run addResourceToWhitelist | ||
|
|
||
| - name: Configure ENS | ||
| if: ${{ vars.DAPP_ENS_NAME }} | ||
| env: | ||
| WALLET_PRIVATE_KEY: ${{ secrets.WEB3MAIL_DAPP_OWNER_PRIVATEKEY }} | ||
| DAPP_ENS_NAME: ${{ vars.DAPP_ENS_NAME }} | ||
| run: | | ||
| cd deployment-dapp | ||
| npm run configure-ens |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| name: dapp-release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'dapp-v*' | ||
|
|
||
| jobs: | ||
| extract-tag: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| clean_tag: ${{ steps.tag.outputs.clean_tag }} | ||
| steps: | ||
| - name: Extract tag | ||
| id: tag | ||
| run: | | ||
| TAG=${GITHUB_REF#refs/tags/dapp-v} | ||
| echo "clean_tag=${TAG}" >> $GITHUB_OUTPUT | ||
|
|
||
| docker-publish: | ||
| uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected] | ||
| with: | ||
| image-name: 'iexechub/web3mail-dapp' | ||
| registry: 'docker.io' | ||
| dockerfile: 'dapp/Dockerfile' | ||
| context: 'dapp' | ||
| security-scan: true | ||
| security-report: 'sarif' | ||
| hadolint: true | ||
| push: true | ||
| image-tag: ${{ needs.extract-tag.outputs.clean_tag }} | ||
| secrets: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_PAT }} | ||
|
|
||
| sconify: | ||
| uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected] | ||
| needs: [docker-publish] | ||
| with: | ||
| image-name: 'iexechub/web3mail-dapp' | ||
| image-tag: ${{ needs.extract-tag.outputs.clean_tag }} | ||
| sconify-debug: false | ||
| sconify-prod: true | ||
| docker-registry: docker.io | ||
| sconify-version: '5.9.0-v15' | ||
| binary: /usr/local/bin/node | ||
| command: node /app/src/app.js | ||
| host-path: | | ||
| /etc/hosts | ||
| /etc/resolv.conf | ||
| binary-fs: true | ||
| fs-dir: /app | ||
| heap: 1G | ||
| dlopen: 1 | ||
| mprotect: 1 | ||
| secrets: | ||
| docker-username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| docker-password: ${{ secrets.DOCKERHUB_PAT }} | ||
| scontain-username: ${{ secrets.SCONTAIN_REGISTRY_USERNAME }} | ||
| scontain-password: ${{ secrets.SCONTAIN_REGISTRY_PAT }} | ||
| scone-signing-key: ${{ secrets.SCONIFY_SIGNING_PRIVATE_KEY }} | ||
|
|
||
| deploy-multi-env-prod: | ||
| strategy: | ||
| matrix: | ||
| # TODO: bellecour-prod already deployed add it back for next release | ||
| environment: [arbitrum-sepolia-prod, arbitrum-mainnet-prod] | ||
| needs: [extract-tag, sconify] | ||
| runs-on: ubuntu-latest | ||
| environment: ${{ matrix.environment }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20.19.0' | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| npm ci | ||
| cd node_modules/whitelist-smart-contract | ||
| npm install --save-dev ts-node | ||
| cd ../../deployment-dapp | ||
| npm ci | ||
|
|
||
| - name: Deploy dapp contract | ||
| env: | ||
| WALLET_PRIVATE_KEY: ${{ secrets.WEB3MAIL_DAPP_OWNER_PRIVATEKEY }} | ||
| DOCKER_IMAGE_TAG: ${{ needs.sconify.outputs.prod-image-tag }} | ||
| CHECKSUM: ${{ needs.sconify.outputs.prod-checksum }} | ||
| FINGERPRINT: ${{ needs.sconify.outputs.prod-mrenclave }} | ||
| RPC_URL: ${{ secrets.RPC_URL }} | ||
| run: | | ||
| cd deployment-dapp | ||
| npm run deploy-dapp | ||
|
|
||
| - name: Push dapp secret | ||
| env: | ||
| WALLET_PRIVATE_KEY: ${{ secrets.WEB3MAIL_DAPP_OWNER_PRIVATEKEY }} | ||
| MJ_APIKEY_PUBLIC: ${{ secrets.MAILJET_APIKEY_PUBLIC }} | ||
| MJ_APIKEY_PRIVATE: ${{ secrets.MAILJET_APIKEY_PRIVATE }} | ||
| MJ_SENDER: ${{ secrets.MAILJET_SENDER }} | ||
| MAILGUN_APIKEY: ${{ secrets.MAILGUN_APIKEY }} | ||
| WEB3MAIL_WHITELISTED_APPS: ${{ vars.WEB3MAIL_WHITELISTED_APPS }} | ||
| run: | | ||
| cd deployment-dapp | ||
| npm run push-dapp-secret | ||
|
|
||
| - name: Publish free sell order | ||
| env: | ||
| WALLET_PRIVATE_KEY: ${{ secrets.WEB3MAIL_DAPP_OWNER_PRIVATEKEY }} | ||
| PRICE: ${{ vars.SELL_ORDER_PRICE }} | ||
| VOLUME: ${{ vars.SELL_ORDER_VOLUME }} | ||
| run: | | ||
| cd deployment-dapp | ||
| npm run publish-sell-order | ||
|
|
||
| - name: Add resource to whitelist | ||
| env: | ||
| CONTRACT_ADDRESS: ${{ secrets.WEB3MAIL_WHITELIST_CONTRACT_ADDRESS }} | ||
| WALLET_PRIVATE_KEY: ${{ secrets.WEB3MAIL_DAPP_OWNER_PRIVATEKEY }} | ||
| run: | | ||
| cd node_modules/whitelist-smart-contract | ||
| export ADDRESS_TO_ADD=$(cat ../../deployment-dapp/.app-address) && npm run addResourceToWhitelist | ||
|
|
||
| - name: Configure ENS | ||
| if: ${{ vars.DAPP_ENS_NAME }} | ||
| env: | ||
| WALLET_PRIVATE_KEY: ${{ secrets.WEB3MAIL_DAPP_OWNER_PRIVATEKEY }} | ||
| DAPP_ENS_NAME: ${{ vars.DAPP_ENS_NAME }} | ||
| run: | | ||
| cd deployment-dapp | ||
| npm run configure-ens |
Uh oh!
There was an error while loading. Please reload this page.