-
Notifications
You must be signed in to change notification settings - Fork 1
Migrate to GitHub actions #31
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c4e2bf5
feat: add GitHub Actions workflow for npm package publishing
SeddikBellamine da9883d
ci: update test utilities and scripts for GitHub Actions compatibility
SeddikBellamine 830115d
ci: add conventional commits validation workflow
SeddikBellamine 18782b4
feat: add release-please workflow for automated releases
SeddikBellamine ab4d9f8
fix: export TEST_CHAIN from test-utils for test compatibility
SeddikBellamine 989afda
fix: convert BigNumberish to string for NRLCAmount compatibility
SeddikBellamine 8b6734c
fix: update test:e2e script to run only e2e tests and fix test-utils …
SeddikBellamine 9d02253
feat: add dapp CI workflow for dapp folder changes
SeddikBellamine 24b08f5
refactor: remove sdk-default and dapp-default pipelines from drone.yml
SeddikBellamine cad1c39
feat: add deployment-dapp CI workflow and remove dapp-deployment-defa…
SeddikBellamine f9dd6c6
feat: add GitHub Actions workflow for web3telegram dapp deployment
SeddikBellamine 6f95cce
ci: remove beta version from npm publish workflow
SeddikBellamine 3bdaeb5
ci: simplify dapp CI workflow by removing redundant build job and pat…
SeddikBellamine 39fb6bc
ci: fix indentation in dapp deployment workflow
SeddikBellamine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| name: Conventional Commits | ||
|
|
||
| on: [pull_request] | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Conventional Commits | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: webiny/[email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| name: web3telegram DApp - CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - '*' | ||
| paths: | ||
| - 'dapp/**' | ||
|
|
||
| concurrency: | ||
| group: ${{ github.ref }}-dapp-ci | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| check-code: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: ./dapp | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 14 | ||
| cache: 'npm' | ||
| cache-dependency-path: dapp/package-lock.json | ||
|
|
||
| - name: Install Dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Lint | ||
| run: npm run lint | ||
|
|
||
| - name: Check formatting | ||
| run: npm run check-format | ||
|
|
||
| test: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: ./dapp | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 14 | ||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,163 @@ | ||
| name: Deploy DApp Contract | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| environment: | ||
| description: 'Deployment environment' | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - dapp-dev | ||
| - dapp-prod | ||
| image-tag: | ||
| description: 'Tag for the dapp image to sconify' | ||
| required: true | ||
| type: string | ||
| default: 'latest' | ||
| sconify-version: | ||
| description: 'Version of the sconify image to use' | ||
| type: string | ||
| default: '5.7.6-v15' | ||
|
|
||
| env: | ||
| DEPLOY_ENVIRONMENT: ${{ inputs.environment }} | ||
|
|
||
| jobs: | ||
| sconify: | ||
| uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected] | ||
| with: | ||
| image-name: product/web3telegram-dapp | ||
| image-tag: ${{ inputs.image-tag }} | ||
| sconify-debug: false | ||
| sconify-prod: true | ||
| docker-registry: docker.io | ||
| sconify-version: ${{ inputs.sconify-version }} | ||
| 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 | ||
| docker-username: ${{ vars.DOCKERHUB_USERNAME }} | ||
| scontain-username: ${{ secrets.SCONTAIN_REGISTRY_USERNAME }} | ||
| secrets: | ||
| docker-password: ${{ secrets.DOCKERHUB_PAT }} | ||
| scontain-password: ${{ secrets.SCONTAIN_REGISTRY_PAT }} | ||
| scone-signing-key: ${{ secrets.SCONIFY_SIGNING_PRIVATE_KEY }} | ||
|
|
||
| display-sconify-results: | ||
| runs-on: ubuntu-latest | ||
| needs: sconify | ||
| steps: | ||
| - name: Display Sconify Results | ||
| run: | | ||
| echo "## Sconify Results" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| echo "### Production Image" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **Image**: ${{ needs.sconify.outputs.prod-image }}" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **Checksum**: ${{ needs.sconify.outputs.prod-checksum }}" >> $GITHUB_STEP_SUMMARY | ||
| echo "- **MrEnclave**: ${{ needs.sconify.outputs.prod-mrenclave }}" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| echo "### Summary" >> $GITHUB_STEP_SUMMARY | ||
| echo "Sconification completed successfully!" >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| deploy-dapp: | ||
| runs-on: ubuntu-latest | ||
| needs: sconify | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18.19' | ||
SeddikBellamine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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: Create scone fingerprint file | ||
| run: | | ||
| MRENCLAVE="${{ needs.sconify.outputs.prod-mrenclave }}" | ||
| echo "$MRENCLAVE" > deployment-dapp/.scone-fingerprint | ||
|
|
||
| - name: Deploy dapp contract | ||
| env: | ||
| DEPLOY_ENVIRONMENT: ${{ inputs.environment }} | ||
| WALLET_PRIVATE_KEY_DEV: ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_DEV_PRIVATEKEY }} | ||
| WALLET_PRIVATE_KEY_PROD: ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_PROD_PRIVATEKEY }} | ||
| DOCKER_IMAGE_CHECKSUM_DEV: ${{ needs.sconify.outputs.prod-checksum }} | ||
SeddikBellamine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| DOCKER_IMAGE_CHECKSUM_PROD: ${{ needs.sconify.outputs.prod-checksum }} | ||
| run: | | ||
| cd deployment-dapp | ||
| npm run deploy-dapp | ||
|
|
||
| - name: Push dapp secret | ||
| env: | ||
| DEPLOY_ENVIRONMENT: ${{ inputs.environment }} | ||
| WALLET_PRIVATE_KEY_DEV: ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_DEV_PRIVATEKEY }} | ||
| WALLET_PRIVATE_KEY_PROD: ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_PROD_PRIVATEKEY }} | ||
| TELEGRAM_BOT_TOKEN_DEV: ${{ secrets.TELEGRAM_BOT_TOKEN_DEV }} | ||
| TELEGRAM_BOT_TOKEN_PROD: ${{ secrets.TELEGRAM_BOT_TOKEN_PROD }} | ||
| run: | | ||
| cd deployment-dapp | ||
| npm run push-dapp-secret | ||
|
|
||
| - name: Publish free sell order | ||
| env: | ||
| DEPLOY_ENVIRONMENT: ${{ inputs.environment }} | ||
| WALLET_PRIVATE_KEY_DEV: ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_DEV_PRIVATEKEY }} | ||
| WALLET_PRIVATE_KEY_PROD: ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_PROD_PRIVATEKEY }} | ||
| PRICE: '0' | ||
| VOLUME: '1000000000' | ||
| run: | | ||
| cd deployment-dapp | ||
| npm run publish-sell-order | ||
|
|
||
| - name: Add resource to whitelist (dev) | ||
| if: inputs.environment == 'dapp-dev' | ||
| env: | ||
| WALLET_PRIVATE_KEY: ${{ secrets.DEPLOYER_DEV_PRIVATEKEY }} | ||
| CONTRACT_ADDRESS: ${{ secrets.WEB3TELEGRAM_WHITELIST_DEV_ADDRESS }} | ||
| run: | | ||
| cd node_modules/whitelist-smart-contract | ||
| export ADDRESS_TO_ADD=$(cat ../../deployment-dapp/.app-address) && npm run addResourceToWhitelist | ||
|
|
||
| - name: Add resource to whitelist (prod) | ||
| if: inputs.environment == 'dapp-prod' | ||
| env: | ||
| WALLET_PRIVATE_KEY: ${{ secrets.DEPLOYER_PROD_PRIVATEKEY }} | ||
| CONTRACT_ADDRESS: ${{ secrets.WEB3TELEGRAM_WHITELIST_PROD_ADDRESS }} | ||
| run: | | ||
| cd node_modules/whitelist-smart-contract | ||
| export ADDRESS_TO_ADD=$(cat ../../deployment-dapp/.app-address) && npm run addResourceToWhitelist | ||
|
|
||
| - name: Configure ENS | ||
| env: | ||
| DEPLOY_ENVIRONMENT: ${{ inputs.environment }} | ||
| WALLET_PRIVATE_KEY_DEV: ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_DEV_PRIVATEKEY }} | ||
| WALLET_PRIVATE_KEY_PROD: ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_PROD_PRIVATEKEY }} | ||
| run: | | ||
| cd deployment-dapp | ||
| npm run configure-ens | ||
|
|
||
| - name: Upload deployment artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: deployment-artifacts | ||
| path: | | ||
| deployment-dapp/.app-address | ||
| deployment-dapp/.scone-fingerprint | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| name: web3telegram Deployment DApp - CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - '*' | ||
| paths: | ||
| - 'deployment-dapp/**' | ||
| - 'deployment-dapp/package.json' | ||
| - 'deployment-dapp/package-lock.json' | ||
| - 'deployment-dapp/.eslintrc.json' | ||
| - 'deployment-dapp/.prettierrc' | ||
|
|
||
| concurrency: | ||
| group: ${{ github.ref }}-deployment-dapp-ci | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| check-code: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: ./deployment-dapp | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 18 | ||
| cache: 'npm' | ||
| cache-dependency-path: deployment-dapp/package-lock.json | ||
|
|
||
| - name: Install Dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Lint | ||
| run: npm run lint | ||
|
|
||
| - name: Check formatting | ||
| run: npm run check-format |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| name: Publish Package NPM - web3telegram | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: 'NPM tag to publish (latest or nightly)' | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - latest | ||
| - nightly | ||
| default: nightly | ||
|
|
||
| jobs: | ||
| set-publish-version: | ||
| # Run only on main branch | ||
| if: github.ref == 'refs/heads/main' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| - name: Set publish version | ||
| id: set-publish-version | ||
| if: github.event.inputs.tag == 'nightly' | ||
| run: | | ||
| if [ "${{ github.event.inputs.tag }}" == "nightly" ]; then | ||
| CURRENT_VERSION=$(npm pkg get version | tr -d '"') | ||
| NIGHTLY_VERSION="${CURRENT_VERSION}-nightly-${GITHUB_SHA::7}" | ||
| echo "VERSION=${NIGHTLY_VERSION}" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "VERSION=$(npm pkg get version | tr -d '"')" >> $GITHUB_OUTPUT | ||
| fi | ||
SeddikBellamine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| outputs: | ||
| VERSION: ${{ steps.set-publish-version.outputs.VERSION }} | ||
|
|
||
| publish-npm: | ||
| # Run only on main branch | ||
| if: github.ref == 'refs/heads/main' | ||
| uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected] | ||
| needs: set-publish-version | ||
| with: | ||
| scope: '@iexec/web3telegram' | ||
| registry: 'https://registry.npmjs.org' | ||
| node-version: '18' | ||
| environment: ${{ github.event.inputs.target }} | ||
| tag: ${{ github.event.inputs.tag }} | ||
| version: ${{ needs.set-publish-version.outputs.VERSION }} | ||
| install-command: | | ||
| npm ci | ||
| secrets: | ||
| npm-token: ${{ secrets.NPM_TOKEN }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| permissions: | ||
| contents: write | ||
| issues: write | ||
| pull-requests: write | ||
|
|
||
| name: release-please | ||
|
|
||
| jobs: | ||
| release-please: | ||
| uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected] | ||
| secrets: inherit |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.