Skip to content

Commit

Permalink
Web build
Browse files Browse the repository at this point in the history
Clean-up

Move workflows

Update path

Remove dep

Move app url

Do no allow to deploy dev to main

Fix typing

Fix typing

pr-labels

Add runs-on

Update field

Ignore transactions

labels as a first step

Remove get label step

Update condition

Update condition

Update condition

remove labels

web build deployment-url

Update cd workflow
  • Loading branch information
KuznetsovNikita committed Nov 21, 2024
1 parent 79ae790 commit c072a65
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 199 deletions.
55 changes: 12 additions & 43 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,49 +90,18 @@ jobs:
rm ${{ github.workspace }}/AuthKey.p8
web-build:
name: web-build
runs-on: macos-13
timeout-minutes: 10

steps:
- name: Checkout to git repository
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}

- name: Enable Corepack
run: |
corepack enable
- name: Run install
uses: borales/actions-yarn@v5
with:
cmd: install

- name: Run build
uses: borales/actions-yarn@v5
env:
VITE_APP_AMPLITUDE: ${{ secrets.REACT_APP_AMPLITUDE_EXTENSION }}
VITE_APP_MEASUREMENT_ID: ${{ secrets.REACT_APP_MEASUREMENT_ID }}
VITE_APP_APTABASE: ${{ secrets.VITE_APP_APTABASE }}
VITE_APP_APTABASE_HOST: https://anonymous-analytics.tonkeeper.com
VITE_APP_LOCALES: en,zh_TW,zh_CN,id,ru,it,es,uk,tr,bg,uz,bn
VITE_APP_TONCONSOLE_HOST: https://pro.tonconsole.com
VITE_APP_TG_BOT_ID: ${{ secrets.REACT_APP_TG_BOT_ID }}
VITE_APP_STONFI_REFERRAL_ADDRESS: ${{ secrets.REACT_APP_STONFI_REFERRAL_ADDRESS }}
with:
cmd: build:web

- name: Publish to Cloudflare Pages
id: deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy apps/web/dist --project-name=tonkeeper-web --branch=main
uses: ./.github/workflows/web-build.yaml
with:
environment: 'main'
secrets: inherit

web-tests:
needs: web-build
uses: ./.github/workflows/web-tests.yaml
with:
base-url: 'https://wallet.tonkeeper.com'
transaction: true
secrets: inherit

extension-build:
name: extension-build
Expand Down
55 changes: 10 additions & 45 deletions .github/workflows/deploy-web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,14 @@ on:

jobs:
web-deploy:
name: web-deploy
runs-on: ubuntu-latest
timeout-minutes: 10
uses: ./.github/workflows/web-build.yaml
with:
environment: ${{ inputs.environment }}
secrets: inherit

steps:
- name: Checkout to git repository
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20.11.1

- name: Enable Corepack
run: |
corepack enable
- name: Run install
uses: borales/actions-yarn@v5
with:
cmd: install

- name: Run build
uses: borales/actions-yarn@v5
env:
VITE_APP_AMPLITUDE: ${{ secrets.REACT_APP_AMPLITUDE_EXTENSION }}
VITE_APP_MEASUREMENT_ID: ${{ secrets.REACT_APP_MEASUREMENT_ID }}
VITE_APP_APTABASE: ${{ secrets.VITE_APP_APTABASE }}
VITE_APP_APTABASE_HOST: https://anonymous-analytics.tonkeeper.com
VITE_APP_LOCALES: en,zh_TW,zh_CN,id,ru,it,es,uk,tr,bg,uz,bn
VITE_APP_TONCONSOLE_HOST: https://pro.tonconsole.com
VITE_APP_TG_BOT_ID: ${{ secrets.REACT_APP_TG_BOT_ID }}
VITE_APP_STONFI_REFERRAL_ADDRESS: ${{ secrets.REACT_APP_STONFI_REFERRAL_ADDRESS }}
with:
cmd: build:web

- name: Publish to Cloudflare Pages
id: deploy
if: contains(github.ref, 'main') || inputs.environment == 'dev'
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command:
pages deploy apps/web/dist --project-name=tonkeeper-web --branch=${{
inputs.environment }}
web-tests:
needs: web-deploy
uses: ./.github/workflows/web-tests.yaml
with:
base-url: ${{ needs.web-deploy.outputs.deployment-url }}
secrets: inherit
54 changes: 12 additions & 42 deletions .github/workflows/playwright.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,15 @@
name: Tonkeeper Playwright
name: Tonkeeper Web Playwright
on:
workflow_dispatch:
inputs:
base-url:
type: string
description: App Url
default: https://wallet.tonkeeper.com
jobs:
playwright-tests:
name: playwright-tests
timeout-minutes: 60
runs-on: ubuntu-latest

steps:
- name: Checkout to git repository
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Enable Corepack
run: |
corepack enable
- name: Run install
uses: borales/actions-yarn@v5
with:
cmd: install

- name: Install Playwright Browsers
working-directory: ./tests/playwright
run: npx playwright install --with-deps chromium

- name: Run Playwright tests
working-directory: ./tests/playwright
env:
BASE_APP_URL: https://wallet.tonkeeper.com
TON_MNEMONIC_24: ${{ secrets.TON_MNEMONIC_24 }}
TON_MNEMONIC_24_2: ${{ secrets.TON_MNEMONIC_24_2 }}
TON_MNEMONIC_24_3: ${{ secrets.TON_MNEMONIC_24_3 }}
TON_MNEMONIC_24_4: ${{ secrets.TON_MNEMONIC_24_4 }}
TON_MNEMONIC_24_5: ${{ secrets.TON_MNEMONIC_24_5 }}
TON_MNEMONIC_ANANAS: ${{ secrets.TON_MNEMONIC_ANANAS }}
TON_MNEMONIC_12: ${{ secrets.TON_MNEMONIC_12 }}
TON_MNEMONIC_12_2: ${{ secrets.TON_MNEMONIC_12_2 }}
FAKE_MNEMONIC: ${{ secrets.FAKE_MNEMONIC }}
run: npx playwright test --project='chromium'
web-tests:
uses: ./.github/workflows/web-tests.yaml
with:
base-url: ${{ inputs.base-url }}
transaction: true
secrets: inherit
70 changes: 6 additions & 64 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,68 +121,10 @@ jobs:
rm ${{ github.workspace }}/AuthKey.p8
web-build:
name: web-build
runs-on: ubuntu-latest
timeout-minutes: 10

outputs:
deployment-url: ${{ steps.deploy.outputs.deployment-url }}
steps:
- name: Checkout to git repository
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}

- name: Enable Corepack
run: |
corepack enable
- name: Run install
uses: borales/actions-yarn@v5
with:
cmd: install

- name: Run build
uses: borales/actions-yarn@v5
env:
VITE_APP_AMPLITUDE: ${{ secrets.REACT_APP_AMPLITUDE_EXTENSION }}
VITE_APP_MEASUREMENT_ID: ${{ secrets.REACT_APP_MEASUREMENT_ID }}
VITE_APP_APTABASE: ${{ secrets.VITE_APP_APTABASE }}
VITE_APP_APTABASE_HOST: https://anonymous-analytics.tonkeeper.com
VITE_APP_LOCALES: en,zh_TW,zh_CN,id,ru,it,es,uk,tr,bg,uz,bn
VITE_APP_TONCONSOLE_HOST: https://pro.tonconsole.com
VITE_APP_TG_BOT_ID: ${{ secrets.REACT_APP_TG_BOT_ID }}
VITE_APP_STONFI_REFERRAL_ADDRESS: ${{ secrets.REACT_APP_STONFI_REFERRAL_ADDRESS }}
with:
cmd: build:web

- name: Publish to Cloudflare Pages
id: deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy apps/web/dist --project-name=tonkeeper-web

- name: Summary
run: |
echo '### Successful WEB deployment 🚀🚀🚀' >> $GITHUB_STEP_SUMMARY
echo 'Well done!' >> $GITHUB_STEP_SUMMARY
echo 'Link to test environment:' >> $GITHUB_STEP_SUMMARY
echo '${{ steps.deploy.outputs.deployment-url }}' >> $GITHUB_STEP_SUMMARY
- name: Comment PR
uses: thollander/actions-comment-pull-request@v3
with:
message: |
### Successful WEB deployment 🚀🚀🚀
Well done!
Link to test environment:
${{ steps.deploy.outputs.deployment-url }}
comment-tag: web_deploy
uses: ./.github/workflows/web-build.yaml
with:
environment: ${{ github.head_ref }}
secrets: inherit

twa-build:
name: twa-build
Expand Down Expand Up @@ -293,9 +235,9 @@ jobs:
path: |
${{ github.workspace }}/apps/extension/dist/firefox
playwright-tests:
web-tests:
needs: web-build
uses: ./.github/workflows/test-web.yaml
uses: ./.github/workflows/web-tests.yaml
with:
base-url: ${{ needs.web-build.outputs.deployment-url }}
secrets: inherit
96 changes: 96 additions & 0 deletions .github/workflows/web-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Tonkeeper Web Build
on:
workflow_call:
inputs:
environment:
required: true
type: string
secrets:
REACT_APP_AMPLITUDE_EXTENSION:
required: true
REACT_APP_MEASUREMENT_ID:
required: true
VITE_APP_APTABASE:
required: true
REACT_APP_TG_BOT_ID:
required: true
REACT_APP_STONFI_REFERRAL_ADDRESS:
required: true
CLOUDFLARE_API_TOKEN:
required: true
CLOUDFLARE_ACCOUNT_ID:
required: true
outputs:
deployment-url:
description: 'The app deployment url'
value: ${{ jobs.web-build.outputs.deployment-url }}
env:
node-version: 20.11.1

jobs:
web-build:
name: web-build
runs-on: ubuntu-latest
timeout-minutes: 10

outputs:
deployment-url: ${{ steps.deploy.outputs.deployment-url }}
steps:
- name: Checkout to git repository
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}

- name: Enable Corepack
run: |
corepack enable
- name: Run install
uses: borales/actions-yarn@v5
with:
cmd: install

- name: Run build
uses: borales/actions-yarn@v5
env:
VITE_APP_AMPLITUDE: ${{ secrets.REACT_APP_AMPLITUDE_EXTENSION }}
VITE_APP_MEASUREMENT_ID: ${{ secrets.REACT_APP_MEASUREMENT_ID }}
VITE_APP_APTABASE: ${{ secrets.VITE_APP_APTABASE }}
VITE_APP_APTABASE_HOST: https://anonymous-analytics.tonkeeper.com
VITE_APP_LOCALES: en,zh_TW,zh_CN,id,ru,it,es,uk,tr,bg,uz,bn
VITE_APP_TONCONSOLE_HOST: https://pro.tonconsole.com
VITE_APP_TG_BOT_ID: ${{ secrets.REACT_APP_TG_BOT_ID }}
VITE_APP_STONFI_REFERRAL_ADDRESS: ${{ secrets.REACT_APP_STONFI_REFERRAL_ADDRESS }}
with:
cmd: build:web

- name: Publish to Cloudflare Pages
id: deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command:
pages deploy apps/web/dist --project-name=tonkeeper-web --branch=${{
inputs.environment }}

- name: Summary
run: |
echo '### Successful WEB deployment 🚀🚀🚀' >> $GITHUB_STEP_SUMMARY
echo 'Well done!' >> $GITHUB_STEP_SUMMARY
echo 'Link to test environment:' >> $GITHUB_STEP_SUMMARY
echo '${{ steps.deploy.outputs.deployment-url }}' >> $GITHUB_STEP_SUMMARY
- name: Comment PR
uses: thollander/actions-comment-pull-request@v3
if: github.event_name == 'pull_request'
with:
message: |
### Successful WEB deployment 🚀🚀🚀
Well done!
Link to test environment:
${{ steps.deploy.outputs.deployment-url }}
comment-tag: web_deploy
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ on:
base-url:
required: true
type: string
default: https://wallet.tonkeeper.com
node-version:
type: string
default: lts/*
transaction:
type: boolean
default: false
Expand All @@ -31,6 +27,9 @@ on:
required: true
FAKE_MNEMONIC:
required: true

env:
node-version: lts/*
jobs:
playwright-tests:
name: playwright-tests
Expand All @@ -44,7 +43,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
node-version: ${{ env.node-version }}

- name: Enable Corepack
run: |
Expand Down
1 change: 1 addition & 0 deletions tests/playwright/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
BASE_APP_URL='https://wallet.tonkeeper.com'
TRANSACTION_TESTS=true
TON_MNEMONIC_24=''
TON_MNEMONIC_24_2=''
TON_MNEMONIC_24_3=''
Expand Down
Loading

0 comments on commit c072a65

Please sign in to comment.