-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
67 changed files
with
36,549 additions
and
302 deletions.
There are no files selected for viewing
This file contains 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,61 @@ | ||
name: build | ||
description: Build all packages | ||
inputs: | ||
NODE_ENV: | ||
description: 'Node environment' | ||
required: false | ||
default: 'staging' | ||
DATADOG_CLIENT_TOKEN: | ||
description: 'Datadog client token' | ||
required: false | ||
DATADOG_APPLICATION_ID: | ||
description: 'Datadog application id' | ||
required: false | ||
DATADOG_CLIENT_TOKEN_LOGS: | ||
description: 'Datadog client token for logs' | ||
required: false | ||
DATADOG_SESSION_REPLAY_SAMPLE_RATE: | ||
description: 'Datadog session replay sample rate' | ||
required: false | ||
DATADOG_SESSION_SAMPLE_RATE: | ||
description: 'Datadog session sample rate' | ||
required: false | ||
GD_API_KEY: | ||
description: 'Google drive api key' | ||
required: false | ||
GD_APP_ID: | ||
description: 'Google drive app id' | ||
required: false | ||
GD_CLIENT_ID: | ||
description: 'Google drive client id' | ||
required: false | ||
RUDDERSTACK_STAGING_KEY: | ||
description: 'Rudderstack staging key' | ||
required: false | ||
RUDDERSTACK_PRODUCTION_KEY: | ||
description: 'Rudderstack production key' | ||
required: false | ||
RUDDERSTACK_URL: | ||
description: 'Rudderstack url' | ||
required: false | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Build all packages | ||
env: | ||
NODE_ENV: ${{ inputs.NODE_ENV }} | ||
DATADOG_APPLICATION_ID: ${{ inputs.DATADOG_APPLICATION_ID }} | ||
DATADOG_CLIENT_TOKEN: ${{ inputs.DATADOG_CLIENT_TOKEN }} | ||
DATADOG_CLIENT_TOKEN_LOGS: ${{ inputs.DATADOG_CLIENT_TOKEN_LOGS }} | ||
DATADOG_SESSION_REPLAY_SAMPLE_RATE: ${{ inputs.DATADOG_SESSION_REPLAY_SAMPLE_RATE }} | ||
DATADOG_SESSION_SAMPLE_RATE: ${{ inputs.DATADOG_SESSION_SAMPLE_RATE }} | ||
DATADOG_SESSION_SAMPLE_RATE_LOGS: ${{ inputs.DATADOG_SESSION_SAMPLE_RATE_LOGS }} | ||
GD_API_KEY: ${{ inputs.GD_API_KEY }} | ||
GD_APP_ID: ${{ inputs.GD_APP_ID }} | ||
GD_CLIENT_ID: ${{ inputs.GD_CLIENT_ID }} | ||
RUDDERSTACK_STAGING_KEY: ${{ inputs.RUDDERSTACK_STAGING_KEY }} | ||
RUDDERSTACK_URL: ${{ inputs.RUDDERSTACK_URL }} | ||
|
||
run: npm run build:all | ||
shell: bash |
This file contains 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,32 @@ | ||
name: invalidate_npm_cache | ||
description: Invalidate the Master NPM cache | ||
runs: | ||
using: composite | ||
steps: | ||
|
||
- name: save_cache | ||
uses: actions/cache/save@v3 | ||
with: | ||
path: |- | ||
node_modules | ||
packages/account/node_modules | ||
packages/api/node_modules | ||
packages/appstore/node_modules | ||
packages/bot-skeleton/node_modules | ||
packages/bot-web-ui/node_modules | ||
packages/cashier/node_modules | ||
packages/components/node_modules | ||
packages/core/node_modules | ||
packages/hooks/node_modules | ||
packages/cfd/node_modules | ||
packages/indicators/node_modules | ||
packages/p2p/node_modules | ||
packages/reports/node_modules | ||
packages/shared/node_modules | ||
packages/stores/node_modules | ||
packages/trader/node_modules | ||
packages/translations/node_modules | ||
packages/utils/node_modules | ||
packages/analytics/node_modules | ||
packages/wallets/node_modules | ||
key: ${{ runner.os }}-build-master-cache-${{ hashFiles('./package-lock.json') }} |
This file contains 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,41 @@ | ||
name: npm_install_from_cache | ||
description: Install npm packages from cache | ||
runs: | ||
using: composite | ||
steps: | ||
# - name: Set ownership | ||
# run: | | ||
# # this is to fix GIT not linking owner of the checkout dir | ||
# git config --system --add safe.directory '*' | ||
# shell: bash | ||
- name: Cache node modules | ||
id: cache-nodemodules | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: |- | ||
node_modules | ||
packages/account/node_modules | ||
packages/api/node_modules | ||
packages/appstore/node_modules | ||
packages/bot-skeleton/node_modules | ||
packages/bot-web-ui/node_modules | ||
packages/cashier/node_modules | ||
packages/components/node_modules | ||
packages/core/node_modules | ||
packages/hooks/node_modules | ||
packages/cfd/node_modules | ||
packages/indicators/node_modules | ||
packages/p2p/node_modules | ||
packages/reports/node_modules | ||
packages/shared/node_modules | ||
packages/stores/node_modules | ||
packages/trader/node_modules | ||
packages/translations/node_modules | ||
packages/utils/node_modules | ||
packages/analytics/node_modules | ||
packages/wallets/node_modules | ||
key: ${{ runner.os }}-build-master-cache-${{ hashFiles('./package-lock.json') }} | ||
- name: Install npm packages | ||
if: steps.cache-nodemodules.outputs.cache-hit != 'true' | ||
run: npm run bootstrap | ||
shell: bash |
This file contains 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,26 @@ | ||
name: publish_to_pages_production | ||
description: Publish to cloudflare pages (production) | ||
inputs: | ||
version: | ||
description: 'Version of the app to release' | ||
required: true | ||
CLOUDFLARE_ACCOUNT_ID: | ||
description: 'Cloudflare account id' | ||
required: true | ||
CLOUDFLARE_API_TOKEN: | ||
description: 'Cloudflare token' | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Publish to cloudflare pages (production) | ||
env: | ||
CLOUDFLARE_ACCOUNT_ID: ${{ inputs.CLOUDFLARE_ACCOUNT_ID }} | ||
CLOUDFLARE_API_TOKEN: ${{ inputs.CLOUDFLARE_API_TOKEN }} | ||
version: ${{ inputs.version }} | ||
run: |- | ||
npm i wrangler@3.1.0 | ||
cd packages/core | ||
npx wrangler pages deploy dist/ --project-name=deriv-app-pages --branch=main | ||
echo "New website - http://cf-pages-deriv-app.deriv.com" | ||
shell: bash |
This file contains 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,26 @@ | ||
name: publish_to_pages_staging | ||
description: Publish to cloudflare pages (staging) | ||
inputs: | ||
version: | ||
description: 'Version of the app to release' | ||
required: true | ||
CLOUDFLARE_ACCOUNT_ID: | ||
description: 'Cloudflare account id' | ||
required: true | ||
CLOUDFLARE_API_TOKEN: | ||
description: 'Cloudflare token' | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Publish to cloudflare pages (staging) | ||
env: | ||
CLOUDFLARE_ACCOUNT_ID: ${{ inputs.CLOUDFLARE_ACCOUNT_ID }} | ||
CLOUDFLARE_API_TOKEN: ${{ inputs.CLOUDFLARE_API_TOKEN }} | ||
version: ${{ inputs.version }} | ||
run: |- | ||
npm i wrangler@3.1.0 | ||
cd packages/core | ||
npx wrangler pages deploy dist/ --project-name=deriv-app-pages --branch=staging | ||
echo "New staging website - http://staging.cf-pages-deriv-app.deriv.com" | ||
shell: bash |
This file contains 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,38 @@ | ||
name: send_slack_notifications | ||
description: Send Slack notifications | ||
inputs: | ||
SLACK_WEBHOOK_URL: | ||
description: 'Slack webhook URL' | ||
required: true | ||
status: | ||
description: 'Job status' | ||
required: true | ||
release_type: | ||
description: 'Release type' | ||
required: true | ||
version: | ||
description: 'Version' | ||
required: true | ||
default: 'N/A' | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Send Slack Notification on Success | ||
if: inputs.status == 'success' | ||
run: |- | ||
curl -X POST -H 'Content-type: application/json' \ | ||
--data '{ | ||
"text": "'"${{ inputs.release_type }}"' Release succeeded for app.deriv.com with version *'"${{ inputs.version }}"'*" | ||
}' \ | ||
$SLACK_WEBHOOK_URL | ||
shell: bash | ||
|
||
- name: Send Slack Notification on Failure | ||
if: inputs.status == 'failure' | ||
run: |- | ||
curl -X POST -H 'Content-type: application/json' \ | ||
--data '{ | ||
"text": "'"${{ inputs.release_type }}"' Release failed for app.deriv.com with version *'"${{ inputs.version }}"'*" | ||
}' \ | ||
$SLACK_WEBHOOK_URL | ||
shell: bash |
This file contains 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,9 @@ | ||
name: Setup Node | ||
description: 'Set up Node.js' | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Use Node.js 18.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x |
This file contains 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,15 @@ | ||
name: versioning | ||
description: Versioning | ||
inputs: | ||
version_name: | ||
description: Version name | ||
required: false | ||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/download-artifact@v3.0.1 | ||
with: | ||
path: packages/core/dist | ||
- name: Tag | ||
run: echo "${{ inputs.version_name }}-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" > packages/core/dist/version | ||
shell: bash |
This file contains 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 |
---|---|---|
@@ -1,26 +1,22 @@ | ||
on: ["push", "pull_request"] | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [opened, synchronize, edited] | ||
name: Coveralls | ||
|
||
jobs: | ||
|
||
build: | ||
name: Reporter | ||
runs-on: ubuntu-latest | ||
runs-on: Runner_16cores_Deriv-app | ||
steps: | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js 18.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
|
||
- name: Bootstrap, Build, and make test-coverage | ||
run: | | ||
npm ci | ||
npm run bootstrap | ||
npm run build:all | ||
JEST_MAX_WORKERS=3 npm run test:jest | ||
- uses: actions/checkout@v4 | ||
- uses: './.github/actions/setup_node' | ||
- name: Install dependencies | ||
uses: "./.github/actions/npm_install_from_cache" | ||
- name: Build | ||
uses: "./.github/actions/build" | ||
- name: Test | ||
run: JEST_MAX_WORKERS=75% npm run test:jest -- --collectCoverage | ||
- name: Coveralls | ||
uses: coverallsapp/github-action@v2 |
This file contains 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
This file contains 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
This file contains 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
This file contains 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,71 @@ | ||
name: Deriv App Production Workflow | ||
on: | ||
push: | ||
tags: | ||
- production.* | ||
jobs: | ||
build_test_and_upload_artifact: | ||
name: Build, Test and upload artifacts | ||
environment: Production | ||
runs-on: Runner_16cores_Deriv-app | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: "./.github/actions/setup_node" | ||
- uses: "./.github/actions/npm_install_from_cache" | ||
- uses: "./.github/actions/build" | ||
with: | ||
NODE_ENV: production | ||
DATADOG_APPLICATION_ID: ${{ vars.DATADOG_APPLICATION_ID }} | ||
DATADOG_CLIENT_TOKEN: ${{ vars.DATADOG_CLIENT_TOKEN }} | ||
DATADOG_CLIENT_TOKEN_LOGS: ${{ vars.DATADOG_CLIENT_TOKEN_LOGS }} | ||
DATADOG_SESSION_REPLAY_SAMPLE_RATE: ${{ vars.DATADOG_SESSION_REPLAY_SAMPLE_RATE }} | ||
DATADOG_SESSION_SAMPLE_RATE: ${{ vars.DATADOG_SESSION_SAMPLE_RATE }} | ||
DATADOG_SESSION_SAMPLE_RATE_LOGS: ${{ vars.DATADOG_SESSION_SAMPLE_RATE_LOGS }} | ||
GD_API_KEY: ${{ secrets.GD_API_KEY }} | ||
GD_APP_ID: ${{ secrets.GD_APP_ID }} | ||
GD_CLIENT_ID: ${{ secrets.GD_CLIENT_ID }} | ||
RUDDERSTACK_PRODUCTION_KEY: ${{ vars.RUDDERSTACK_STAGING_KEY }} | ||
RUDDERSTACK_URL: ${{ vars.RUDDERSTACK_URL }} | ||
- name: Run tests | ||
run: npm test | ||
- uses: "./.github/actions/versioning" | ||
with: | ||
version_name: production | ||
- uses: actions/upload-artifact@v3.1.1 | ||
with: | ||
path: packages/core | ||
|
||
publish_cloudflare_production: | ||
name: Publish to cloudflare Pages Production | ||
environment: Common | ||
runs-on: Runner_16cores_Deriv-app | ||
needs: | ||
- build_test_and_upload_artifact | ||
env: | ||
NODE_ENV: production | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: "./.github/actions/setup_node" | ||
- uses: actions/download-artifact@v3.0.1 | ||
with: | ||
path: packages | ||
- uses: "./.github/actions/publish_to_pages_production" | ||
with: | ||
version: $(echo cat packages/core/dist/version | bash) | ||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
send_slack_notification: | ||
name: Send Slack notification | ||
runs-on: Runner_16cores_Deriv-app | ||
environment: Common | ||
if: always() | ||
needs: [build_test_and_upload_artifact, publish_cloudflare_production] | ||
steps: | ||
- uses: technote-space/workflow-conclusion-action@v3 | ||
- uses: "./.github/actions/send_slack_notifications" | ||
with: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
status: ${{ env.WORKFLOW_CONCLUSION }} | ||
release_type: Production | ||
version: $(echo cat packages/core/dist/version | bash) |
Oops, something went wrong.