diff --git a/.github/actions/invalidate_master_cache/action.yml b/.github/actions/invalidate_master_cache/action.yml new file mode 100644 index 0000000000..6317bdcac8 --- /dev/null +++ b/.github/actions/invalidate_master_cache/action.yml @@ -0,0 +1,10 @@ +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 + key: v1-deps-{{ checksum "package-lock.json" }} diff --git a/.github/actions/npm_install_from_cache/action.yml b/.github/actions/npm_install_from_cache/action.yml new file mode 100644 index 0000000000..3b9b508728 --- /dev/null +++ b/.github/actions/npm_install_from_cache/action.yml @@ -0,0 +1,15 @@ +name: npm_install_from_cache +description: Install npm packages from cache +runs: + using: composite + steps: + - name: Cache dependencies + id: cache-node-modules + uses: actions/cache/restore@v3 + with: + key: v1-deps-{{ checksum "package-lock.json" }} + path: node_modules + - name: Install npm dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' + run: npm install + shell: bash diff --git a/.github/actions/setup_node/action.yml b/.github/actions/setup_node/action.yml new file mode 100644 index 0000000000..ca2791ec43 --- /dev/null +++ b/.github/actions/setup_node/action.yml @@ -0,0 +1,9 @@ +name: Setup Node +description: Setup Node.js environment +runs: + using: composite + steps: + - name: Use Node.js 18.x + uses: actions/setup-node@v3 + with: + node-version: 18.x diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml deleted file mode 100644 index 480b09e1b0..0000000000 --- a/.github/workflows/ci-cd.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: test-workflow -on: - pull_request: - branches: - - main - -jobs: - sample-job: - runs-on: ubuntu-latest - steps: - - uses: actions/hello-world-javascript-action@main - with: - who-to-greet: 'Deriv Team' \ No newline at end of file diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000000..504bf2fe5e --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,25 @@ +name: SmartTrader Test Workflow + +on: pull_request + +jobs: + build_and_test: + name: Build and Test + runs-on: ubuntu-latest + steps: + # checkout the repository content to github runner + - name: Checkout + uses: actions/checkout@v4 + # setup nodejs environment + - name: Setup Node.js environment + uses: ./.github/actions/setup_node + # cache the dependencies to speed up the build and then install dependencies + - name: Cache dependencies + uses: ./.github/actions/npm_install_from_cache + # build the react app + - name: Build + run: npm run build + # run tests + - name: Run tests + run: npm run test + # deploy the react app to github pages diff --git a/src/components/common/loading/__test__/loading.test.tsx b/src/components/common/loading/__test__/loading.test.tsx new file mode 100644 index 0000000000..8a076d170a --- /dev/null +++ b/src/components/common/loading/__test__/loading.test.tsx @@ -0,0 +1,11 @@ +// Test for passing the github actions +// TODO should update this test later +import { describe, expect, test } from "vitest"; +import { render, screen } from "@testing-library/react"; +import Loading from ".."; + +describe("Loading component", () => + test("should show loading text", () => { + render(); + expect(screen.getByText("loading")).toBeInTheDocument(); + })); diff --git a/src/utils/cookies.ts b/src/utils/cookies.ts index a9d7f03b24..4924025289 100644 --- a/src/utils/cookies.ts +++ b/src/utils/cookies.ts @@ -1,7 +1,15 @@ +<<<<<<< HEAD export const getCookiesObject = cookies => {}; +======= +export const getCookiesObject = () => {}; +>>>>>>> main -export const getDataObjFromCookies = (cookies, fields) => {}; +export const getDataObjFromCookies = () => {}; +<<<<<<< HEAD export const getDataLink = data => {}; +======= +export const getDataLink = () => {}; +>>>>>>> main export const getCookiesFields = () => [];