Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
chore: merge with latest master
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitK-deriv committed Sep 13, 2023
2 parents d2bb168 + 662954d commit d2b64a2
Show file tree
Hide file tree
Showing 942 changed files with 38,035 additions and 14,400 deletions.
35 changes: 20 additions & 15 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,21 @@
# - This configuration works in conjunction with the protected branch settings that require all changes to be made via pull requests with at least one approval.
# - This approval can come from an appropriate codeowner, or any repo collaborator (person with write access) if the PR is authored by a codeowner.
# - Each codeowners team must have write access to the repo, otherwise their reviews won't count.
#
# In the case of emergency, the repo administrators can bypass this requirement.



# ================================================
# GitHub username registry
# (just to make this file easier to understand)
# (Just to make this file easier to understand)
# ================================================

# habib-deriv
# prince-deriv
# yashim-deriv
# mohsen-deriv
# mitra-deriv
# fasihali-deriv

######################################################################################################
#
Expand All @@ -57,24 +59,13 @@
# (in case no pattern matches a path in a PR - this should be treated as a bug and result in adding the path to CODEOWNERS)
# ==============================================================

* @habib-deriv @prince-deriv @mohsen-deriv @mohammad-hashemi-deriv @mitra-deriv @fasihali-deriv @nikitk-deriv



# ==============================================================
# deriv-com/translations
# ==============================================================

/src/translations/* @habib-deriv @prince-deriv
/crowdin/* @habib-deriv @prince-deriv
/scripts/* @habib-deriv @prince-deriv
* @habib-deriv @prince-deriv @mohsen-deriv @mitra-deriv @fasihali-deriv


# ==============================================================
# deriv-com/config
# ==============================================================

/* @habib-deriv @yashim-deriv @prince-deriv
/.github/**/* @habib-deriv @yashim-deriv @prince-deriv
/.husky/* @habib-deriv @yashim-deriv @prince-deriv

Expand All @@ -86,6 +77,7 @@
/src/common/**/* @habib-deriv @yashim-deriv @prince-deriv
/src/components/**/* @habib-deriv @yashim-deriv @prince-deriv
/src/themes/**/* @habib-deriv @yashim-deriv @prince-deriv
/src/features/**/* @habib-deriv @prince-deriv @mitra-deriv @fasihali-deriv


# ==============================================================
Expand All @@ -103,4 +95,17 @@
# deriv-com/pages
# ==============================================================

/src/pages/**/* @habib-deriv @yashim-deriv @prince-deriv
/src/pages/**/* @habib-deriv @yashim-deriv @prince-deriv @fasihali-deriv @mitra-deriv

# ==============================================================
# deriv-com/translations
# ==============================================================

/src/pages/**/* @habib-deriv @yashim-deriv @prince-deriv @mitra-deriv

# ==============================================================
# deriv-com/storybooks.d.ts
# ==============================================================

/storybooks.d.ts
@prince-deriv @habib-deriv
5 changes: 4 additions & 1 deletion .github/workflows/beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ env:
GATSBY_CPU_COUNT: 2
GATSBY_ENV: production
NODE_OPTIONS: "--max_old_space_size=7168"
DATADOG_APPLICATION_ID: ${{ secrets.DATADOG_APPLICATION_ID }}
DATADOG_CLIENT_TOKEN: ${{ secrets.DATADOG_CLIENT_TOKEN }}
GATSBY_MAP_API_KEY: ${{ secrets.GATSBY_MAP_API_KEY }}

jobs:
release-beta:
Expand All @@ -28,7 +31,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18.x"
node-version: "16.x"
cache: "npm"

- run: npm ci
Expand Down
112 changes: 112 additions & 0 deletions .github/workflows/build-to-cloudflare-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Build to Cloudflare Pages

permissions:
actions: write
checks: write
contents: write
deployments: write
pull-requests: write
statuses: write

on:
pull_request:
types: [opened, synchronize]

env:
NODE_OPTIONS: '--max-old-space-size=8192'

concurrency:
group: cloudflare-pages-build-${{ github.head_ref }}
cancel-in-progress: true

jobs:
build_to_cloudflare_pages:
runs-on: Ubuntu-latest
steps:
- name: Checkout to repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup node
uses: actions/setup-node@v2

- name: Generate build status comment
id: build_status_comment
uses: actions/github-script@v3
with:
script: |
const preview_url = "https://" + "${{ github.head_ref }}" + ".deriv-com.pages.dev"
const comment = [
'## Cloudflare Pages Preview link',
'| Name | Result |',
'| :--- | :------ |',
`| **Build status** | In progress ⏳ |`,
`| **Preview URL** | [Visit Preview](${preview_url}) |`,
''
].join('\n')
core.setOutput("comment", comment);
- name: Update build status comment
uses: marocchino/sticky-pull-request-comment@v2
with:
only_update: true
header: Cloudflare Pages Preview Comment
number: ${{github.event.issue.number}}
message: ${{steps.build_status_comment.outputs.comment}}

- name: Get build output from master cache
uses: actions/cache/restore@v3
with:
key: master-cache-public
restore-keys: |
master-cache-public-replica
path: |
.cache
public
- name: Get cached dependencies
id: cache-npm
uses: actions/cache/restore@v3
with:
path: node_modules
key: npm-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
run: npm ci

- name: Build project
id: build-project
run: npm run build

- name: Publish to Cloudflare Pages
uses: cloudflare/[email protected]

with:
apiToken: ${{ secrets.CLOUDFLARE_TEST_LINKS_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_TEST_LINKS_ACCOUNT_ID }}
command: pages publish public --project-name=deriv-com --branch=${GITHUB_REF_NAME}
echo "preview_url=$(pages info --project-name=deriv-com --branch=${GITHUB_REF_NAME} --format preview_url)" >> $GITHUB_OUTPUT

- name: Retrieve Cloudflare Pages Preview URL
id: cloudflare_pages_preview_url
uses: actions/github-script@v3
with:
script: |
const preview_url = "${{ steps.publish-to-pages.outputs.preview_url }}"
const comment = [
'| Name | Result |',
'| :--- | :------ |',
`| **Build status** | Completed ✅ |`,
`| **Preview URL** | [Visit Preview](${preview_url}) |`,
''
].join('\n')
core.setOutput("comment", comment);
- name: Post Cloudflare Pages Preview comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: Cloudflare Pages Preview Comment
number: ${{github.event.issue.number}}
message: ${{steps.cloudflare_pages_preview_url.outputs.comment}}
111 changes: 111 additions & 0 deletions .github/workflows/corewebvitals.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Core Web Vitals Audit

permissions:
actions: write
checks: write
contents: write
deployments: write
pull-requests: write
statuses: write

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
core_web_vitals_audit:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 14

- name: Install dependencies
run: npm ci

- name: Run Core Web Vitals Audit
run: npm run audit

- name: Install Datadog CI
run: npm install -g @datadog/datadog-ci

- name: Sync results with Datadog
run: |
datadog-ci synthetics upload --config datadog-ci.json
datadog-ci synthetics results --config datadog-ci.json > results.json
env:
DATADOG_API_KEY: ${{ secrets.GATSBY_DATADOG_CLIENT_TOKEN }}
DATADOG_APP_KEY: ${{ secrets.GATSBY_DATADOG_APPLICATION_ID }}

- name: Post audit comment
uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
header: Core Web Vitals Audit
message: |
### Core Web Vitals Results
- Largest Contentful Paint: ${{ steps.results.outputs.lcp }}
- First Input Delay: ${{ steps.results.outputs.fid }}
- Cumulative Layout Shift: ${{ steps.results.outputs.cls }}
- name: Slack Notification 📣
uses: 8398a7/action-slack@v3
if: ${{ failure() }}
with:
status: custom
fields: workflow,job,commit,repo
custom_payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "plain_text",
"emoji": true,
"text": "It appears that this pull request has not met the required Core Web Vitals score."
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*User: <${{ github.event.pull_request.user.url }}|${{ github.event.pull_request.user.login }}>*\n*Link:* ${{ github.event.pull_request.html_url }}\n*Title:* ${{ github.event.pull_request.title }}\n*Status:* ${{ github.event.pull_request.state }}"
},
"accessory": {
"type": "image",
"image_url": "${{ github.event.pull_request.user.avatar_url }}",
"alt_text": "${{ github.event.pull_request.user.login }}"
}
},
{
"type": "divider"
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://api.slack.com/img/blocks/bkb_template_images/notificationsWarningIcon.png",
"alt_text": "notifications warning icon"
},
{
"type": "mrkdwn",
"text": "*<!subteam^S04RV6RFCTW> please check the PR*"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
2 changes: 1 addition & 1 deletion .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
${{ steps.format_lighthouse_score.outputs.comment }}
- name: Slack Notification 📣
uses: 8398a7/action-slack@v3
if: ${{ steps.format_lighthouse_score.outputs.performance < 60 }}
if: ${{ steps.format_lighthouse_score.outputs.performance < 0 }}
with:
status: custom
fields: workflow,job,commit,repo
Expand Down
27 changes: 1 addition & 26 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:
NODE_OPTIONS: "--max_old_space_size=7168"
DATADOG_APPLICATION_ID: ${{ secrets.DATADOG_APPLICATION_ID }}
DATADOG_CLIENT_TOKEN: ${{ secrets.DATADOG_CLIENT_TOKEN }}
GATSBY_MAP_API_KEY: ${{ secrets.GATSBY_MAP_API_KEY }}

jobs:
release-production:
Expand Down Expand Up @@ -47,32 +48,6 @@ jobs:
# For using same tag for staging and production we need to uncomment these two below lines:
# with:
# tagRegex: "production(.*)"
- name: Building docker image 🐳
run: docker build -t ${{ secrets.DOCKHUB_ORGANISATION }}/deriv-com:latest -t ${{ secrets.DOCKHUB_ORGANISATION }}/deriv-com:$GIT_TAG_NAME .

- name: Verify nginx image
run: |
set -e
docker run --rm ${{ secrets.DOCKHUB_ORGANISATION }}/deriv-com:$GIT_TAG_NAME nginx -t
echo "docker image validated successfully"
- name: Pushing Image to docker hub 🐳
run: |
echo ${{ secrets.DOCKERHUB_PASSWORD }}| docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
docker push ${{ secrets.DOCKHUB_ORGANISATION }}/deriv-com:latest
docker push ${{ secrets.DOCKHUB_ORGANISATION }}/deriv-com:$GIT_TAG_NAME
- name: Deploy 🚀
run: |
export NAMESPACE="deriv-com-production"
export SERVICEACCOUNT_TOKEN=${{ secrets.SERVICEACCOUNT_TOKEN }}
export DOCKERHUB_ORGANISATION=${{ secrets.DOCKERHUB_ORGANISATION }}
export KUBE_SERVER=${{ secrets.KUBE_SERVER }}
export CA=${{ secrets.CA }}
git clone https://github.com/binary-com/devops-ci-scripts
cd devops-ci-scripts/k8s-build_tools
echo ${{ secrets.CA_CRT}} | base64 --decode > ca.crt
./release.sh deriv-com $GIT_TAG_NAME

- name: Deploy to Cloudflare ☁️
uses: cloudflare/[email protected]
Expand Down
Loading

0 comments on commit d2b64a2

Please sign in to comment.