Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
446 changes: 0 additions & 446 deletions .drone.yml

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions .github/workflows/conventional-commits.yml
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]
59 changes: 59 additions & 0 deletions .github/workflows/dapp-ci.yml
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
163 changes: 163 additions & 0 deletions .github/workflows/dapp-deploy.yml
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'
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 }}
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
40 changes: 40 additions & 0 deletions .github/workflows/deployment-dapp-ci.yml
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
54 changes: 54 additions & 0 deletions .github/workflows/publish-npm-sdk.yml
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
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 }}
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
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
Loading
Loading