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

Commit

Permalink
Merge pull request #7 from niloofar-deriv/niloo/862ke0juf/setup-ci
Browse files Browse the repository at this point in the history
Niloofar / Setup Github actions
  • Loading branch information
ali-hosseini-deriv authored Oct 6, 2023
2 parents 3bf9ea9 + 1d89c2a commit b9f09bb
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 16 deletions.
10 changes: 10 additions & 0 deletions .github/actions/invalidate_master_cache/action.yml
Original file line number Diff line number Diff line change
@@ -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" }}
15 changes: 15 additions & 0 deletions .github/actions/npm_install_from_cache/action.yml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions .github/actions/setup_node/action.yml
Original file line number Diff line number Diff line change
@@ -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
13 changes: 0 additions & 13 deletions .github/workflows/ci-cd.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions src/components/common/loading/__test__/loading.test.tsx
Original file line number Diff line number Diff line change
@@ -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(<Loading />);
expect(screen.getByText("loading")).toBeInTheDocument();
}));
6 changes: 3 additions & 3 deletions src/utils/cookies.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const getCookiesObject = (cookies) => {};
export const getCookiesObject = () => {};

export const getDataObjFromCookies = (cookies, fields) => {};
export const getDataObjFromCookies = () => {};

export const getDataLink = (data) => {};
export const getDataLink = () => {};

export const getCookiesFields = () => [];

0 comments on commit b9f09bb

Please sign in to comment.