Skip to content

Commit

Permalink
Merge branch 'binary-com:master' into f-draggable-items
Browse files Browse the repository at this point in the history
  • Loading branch information
akmal-deriv committed Aug 19, 2024
2 parents 99a6b38 + d1325b6 commit c6bfab0
Show file tree
Hide file tree
Showing 763 changed files with 18,197 additions and 10,827 deletions.
77 changes: 0 additions & 77 deletions .github/actions/build_and_push_docker_image/action.yml

This file was deleted.

23 changes: 19 additions & 4 deletions .github/workflows/build_docker_image.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Build Docker image and push to dockerhub
on:
workflow_run:
workflows: ["Deriv App Staging Workflow"]
types: [completed]
workflow_dispatch:
inputs:
docker_image_tag_name:
Expand All @@ -11,7 +14,7 @@ jobs:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
env:
tag_name: ${{ github.event.inputs.docker_image_tag_name }}
tag_name: ${{ github.event.inputs.docker_image_tag_name || github.ref_name }}
permissions:
packages: write
contents: read
Expand All @@ -22,6 +25,12 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v4

- name: Convert branch name to lowercase
id: branch_name
run: |
branch_name="$tag_name"
echo "image_name=${branch_name,,}" >> "$GITHUB_OUTPUT"
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
Expand Down Expand Up @@ -54,10 +63,16 @@ jobs:
TRUSTPILOT_API_KEY: ${{ secrets.TRUSTPILOT_API_KEY }}

- name: Run Build Docker
run: docker build -t ${{ secrets.WEB_ACCESS_DOCKERHUB_USERNAME }}/$tag_name . --platform=linux/amd64
env:
IMAGE_NAME: ${{ steps.branch_name.outputs.image_name }}
run: docker build -t ${{ secrets.WEB_ACCESS_DOCKERHUB_USERNAME }}/$IMAGE_NAME . --platform=linux/amd64

- name: Run Tag Docker
run: docker tag ${{ secrets.WEB_ACCESS_DOCKERHUB_USERNAME }}/$tag_name ${{ secrets.WEB_ACCESS_DOCKERHUB_USERNAME }}/$tag_name
env:
IMAGE_NAME: ${{ steps.branch_name.outputs.image_name }}
run: docker tag ${{ secrets.WEB_ACCESS_DOCKERHUB_USERNAME }}/$IMAGE_NAME ${{ secrets.WEB_ACCESS_DOCKERHUB_USERNAME }}/$IMAGE_NAME

- name: Run Push Docker
run: docker push ${{ secrets.WEB_ACCESS_DOCKERHUB_USERNAME }}/$tag_name
env:
IMAGE_NAME: ${{ steps.branch_name.outputs.image_name }}
run: docker push ${{ secrets.WEB_ACCESS_DOCKERHUB_USERNAME }}/$IMAGE_NAME
2 changes: 1 addition & 1 deletion .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Coveralls
jobs:
build:
name: Reporter
runs-on: Runner_8cores_Deriv-app
runs-on: Runner_16cores_Deriv-app
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/integration-tests.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/release_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,24 +103,6 @@ jobs:
with:
name: build
path: packages/core/dist
- name: Build Docker image and push to Docker hub and K8S
id: build_and_push_docker_image
uses: "./.github/actions/build_and_push_docker_image"
with:
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }}
K8S_NAMESPACE: ${{ secrets.K8S_NAMESPACE }}
KUBE_SERVER: ${{ secrets.KUBE_SERVER }}
SERVICEACCOUNT_TOKEN: ${{ secrets.SERVICEACCOUNT_TOKEN }}
CA_CRT: ${{ secrets.CA_CRT }}
APP_VERSION: latest
- name: Send Slack Notification on Docker Publish and Kubernetes Deployment Failure
if: ${{ steps.build_and_push_docker_image.outcome != 'success' }}
uses: "deriv-com/shared-actions/.github/actions/send_slack_notification@master"
with:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MESSAGE: "${{ env.RELEASE_TYPE }} Docker Publish and Kubernetes Deployment for app.deriv.com with version ${{ needs.build_test_and_publish.outputs.RELEASE_VERSION }} has Failed"
- name: Upload to vercel
id: vercel-upload
uses: 'deriv-com/shared-actions/.github/actions/vercel_DR_publish@master'
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ packages/appstore/lib/
packages/appstore/.out
packages/wallets/src/translations/messages.json
.env
nx-cloud.env
.env.*
*.env
test-results/
playwright-report/
playwright/.cache/
.nx
packages/*/stats.json
packages/*/report.json
packages/*/analyzed.html
packages/*/treemap.html
packages/*/treemap.html
33 changes: 15 additions & 18 deletions __mocks__/translation.mock.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
import React from 'react';

const replaceValue = (text, values) => {
return text.replace(/{{(\w+)}}/g, (match, key) => {
// If the value is an empty string, return an empty fragment to render nothing
if (values[key] === '') {
return '';
}
return values[key] || match;
});
};

const Localize = ({ i18n_default_text, components = [], values = {} }) => {
// Split text into parts, extracting placeholders for components and values
// Split text into parts, extracting placeholders for components
const parts = i18n_default_text.split(/(<\d+>.*?<\/\d+>|{{\w+}})/g);

const replaceValues = text => {
return text.replace(/{{(\w+)}}/g, (match, key) => values[key] || match);
};

return (
<>
{parts.map((part, index) => {
// Replace component placeholders with actual components
// Handle component placeholders
const componentMatch = part.match(/<(\d+)>(.*?)<\/\1>/);

if (componentMatch) {
const componentIndex = parseInt(componentMatch[1]);

// Replace values wrapped in components with actual values
const content = replaceValues(componentMatch[2]);
const content = replaceValue(componentMatch[2], values);
const Component = components[componentIndex];
return Component ? React.cloneElement(Component, { key: index, children: content }) : content;
}

// Replace value placeholders with actual values
const valueMatch = part.match(/{{(\w+)}}/);
if (valueMatch) {
const valueKey = valueMatch[1];
return values[valueKey] || part;
}
return part;
// Replace placeholders with actual values
return replaceValue(part, values);
})}
</>
);
Expand Down
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
"dependencies": {
"@binary-com/binary-document-uploader": "^2.4.8",
"@deriv-com/analytics": "1.11.0",
"@deriv-com/translations": "1.3.4",
"@deriv-com/translations": "1.3.5",
"@deriv-com/utils": "^0.0.25",
"@deriv-com/ui": "1.29.9",
"@deriv-com/ui": "1.29.10",
"@deriv/api": "^1.0.0",
"@deriv-com/quill-ui": "1.13.23",
"@deriv-com/quill-ui": "1.13.42",
"@deriv/components": "^1.0.0",
"@deriv/hooks": "^1.0.0",
"@deriv/integration": "1.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/account/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Routes from './Containers/routes';
import ResetTradingPassword from './Containers/reset-trading-password';
import { NetworkStatusToastErrorPopup } from './Containers/toast-popup';
import NetworkStatusToastPopup from './Components/network-status-toast-popup/network-status-toast-popup';
import { APIProvider } from '@deriv/api';
import { StoreProvider } from '@deriv/stores';
import { TCoreStores } from '@deriv/stores/types';
Expand All @@ -21,14 +21,14 @@ const App = ({ passthrough }: TAppProps) => {

return (
<StoreProvider store={root_store}>
<NetworkStatusToastErrorPopup />
<APIProvider>
<POIProvider>
{Notifications && <Notifications />}
<Routes />
<ResetTradingPassword />
</POIProvider>
</APIProvider>
<NetworkStatusToastPopup />
</StoreProvider>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('<AccountLimitsOverlay/>', () => {
it('should go to help-centre page if the Help Centre link on the text is clicked', () => {
render(<Component />);

expect(screen.getByText('Help Centre').hasAttribute('href'));
expect(screen.getByText(/Help Centre/).hasAttribute('href'));
});
it('should show Done Button', () => {
render(<Component />);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import React from 'react';
import { screen, render } from '@testing-library/react';
import { formatMoney } from '@deriv/shared';
import AccountLimitsTurnoverLimitRow from '../account-limits-turnover-limit-row';
import AccountLimitsContext from '../account-limits-context';
import { FormatUtils } from '@deriv-com/utils';

jest.mock('@deriv/shared', () => ({
...jest.requireActual('@deriv/shared'),
formatMoney: jest.fn(),
jest.mock('@deriv-com/utils', () => ({
...jest.requireActual('@deriv-com/utils'),
FormatUtils: {
formatMoney: jest.fn(),
},
}));
const AccountLimitsTurnoverLimitRowComponent = (props: React.ComponentProps<typeof AccountLimitsTurnoverLimitRow>) => (
<AccountLimitsContext.Provider value={{ currency: 'AUD', overlay_ref: document.createElement('div') }}>
Expand Down Expand Up @@ -47,6 +49,6 @@ describe('<AccountLimitsTurnoverLimitRow/>', () => {
container: document.body.appendChild(document.createElement('tbody')),
});

expect(formatMoney).toHaveBeenCalledWith('AUD', 100000, true);
expect(FormatUtils.formatMoney).toHaveBeenCalledWith(100000, { currency: 'AUD' });
});
});
Loading

0 comments on commit c6bfab0

Please sign in to comment.