From 3c57fd6a4ed687a9ea2cc1da11f86892a08b1e2f Mon Sep 17 00:00:00 2001 From: Arunava Basu Date: Mon, 1 Aug 2022 17:47:11 +0530 Subject: [PATCH 1/8] CACHE SETUP COMPLETED CACHE SETUP : IN PROGRESS CACHE SETUP : IN PROGRESS CACHE SETUP : IN PROGRESS CACHE SETUP : IN PROGRESS --- .github/workflows/ci.yml | 54 +++++++++++++++++++++++++++++++++ .github/workflows/lint&type.yml | 32 ------------------- 2 files changed, 54 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/lint&type.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..fd40b10e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,54 @@ +# linting check of radis-app +name: ๐ŸŒฑ CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + name: ๐Ÿงช Test + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + - name: Set up Node.js + uses: actions/setup-node@v1 + with: + node-version: 14 + - name: Cache the dependencies + uses: c-hive/gha-yarn-cache@v2 + - name: Install Node.js dependencies + run: yarn install --frozen-lockfile + - name: Linting check + run: cd frontend && yarn lint + - name: Type check + run: cd frontend && yarn type-check + build: + name: ๐Ÿ“ฆ Build and Upload Artifact + runs-on: ubuntu-latest + if : ${{ success() }} + needs: [test] + steps : + - name: Check out Git repository + uses: actions/checkout@v2 + - name: Set up Node.js + uses: actions/setup-node@v1 + with: + node-version: 14 + - name: Cache the dependencies + uses: c-hive/gha-yarn-cache@v2 + - name: Install Node.js dependencies + run: yarn install --frozen-lockfile + - name: Build + run: yarn build + - name: Artifact upload + uses: actions/upload-artifact@v3 + with: + name: Radis App + path: ./frontend/build diff --git a/.github/workflows/lint&type.yml b/.github/workflows/lint&type.yml deleted file mode 100644 index 916c834a..00000000 --- a/.github/workflows/lint&type.yml +++ /dev/null @@ -1,32 +0,0 @@ - -# linting check of radis-app -name: Linting Check for Radis-App - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - run-linters: - name: Run linters - runs-on: ubuntu-latest - - steps: - - name: Check out Git repository - uses: actions/checkout@v2 - - name: Set up Node.js - uses: actions/setup-node@v1 - with: - node-version: 14 - - - name: Install Node.js dependencies - run: yarn install --frozen-lockfile - - - name: Run linters - run: cd frontend && yarn lint - - name: type check - run: cd frontend && yarn type-check \ No newline at end of file From 65218d66dd5cd5365f168814bfeb7156320f2d2d Mon Sep 17 00:00:00 2001 From: Arunava Basu Date: Mon, 1 Aug 2022 19:46:33 +0530 Subject: [PATCH 2/8] CORRECT THE TEST SCRIPT add the ` window.URL.createObjectURL = function() {};` in setupTest.ts --- .github/workflows/ci.yml | 2 ++ frontend/src/App.test.tsx | 11 +++++------ frontend/src/setupTests.ts | 4 ++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd40b10e..4ea3ee3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,8 @@ jobs: run: cd frontend && yarn lint - name: Type check run: cd frontend && yarn type-check + - name: Run tests + run: cd frontend && yarn test build: name: ๐Ÿ“ฆ Build and Upload Artifact runs-on: ubuntu-latest diff --git a/frontend/src/App.test.tsx b/frontend/src/App.test.tsx index 275e25b0..08c5608e 100644 --- a/frontend/src/App.test.tsx +++ b/frontend/src/App.test.tsx @@ -1,9 +1,8 @@ -import { render, screen } from "@testing-library/react"; +/* eslint-disable @typescript-eslint/no-empty-function */ +/* eslint-disable react/react-in-jsx-scope */ +import { render } from "@testing-library/react"; import App from "./App"; - -test("renders learn react link", () => { - // eslint-disable-next-line react/react-in-jsx-scope +//@ts-ignore +test("renders the page", () => { render(); - const linkElement = screen.getByText(/learn react/i); - expect(linkElement).toBeInTheDocument(); }); diff --git a/frontend/src/setupTests.ts b/frontend/src/setupTests.ts index 1dd407a6..1440e330 100644 --- a/frontend/src/setupTests.ts +++ b/frontend/src/setupTests.ts @@ -3,3 +3,7 @@ // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom import "@testing-library/jest-dom"; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +//@ts-ignore +// eslint-disable-next-line @typescript-eslint/no-empty-function +window.URL.createObjectURL = function () {}; From 50ff6e82af7348bd473a5a8d9cf0caa6798c3e90 Mon Sep 17 00:00:00 2001 From: Arunava Basu Date: Mon, 1 Aug 2022 19:53:06 +0530 Subject: [PATCH 3/8] USE NATIVE WAY TO DO CACHEING Referance : https://github.com/actions/setup-node#caching-global-packages-data --- .github/workflows/ci.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ea3ee3f..0b1614f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,11 +18,10 @@ jobs: - name: Check out Git repository uses: actions/checkout@v2 - name: Set up Node.js - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: - node-version: 14 - - name: Cache the dependencies - uses: c-hive/gha-yarn-cache@v2 + node-version: 16 + cache: 'yarn' - name: Install Node.js dependencies run: yarn install --frozen-lockfile - name: Linting check @@ -38,13 +37,12 @@ jobs: needs: [test] steps : - name: Check out Git repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Node.js uses: actions/setup-node@v1 with: - node-version: 14 - - name: Cache the dependencies - uses: c-hive/gha-yarn-cache@v2 + node-version: 16 + cache: 'yarn' - name: Install Node.js dependencies run: yarn install --frozen-lockfile - name: Build From 8f86f89dbb66d00968f41d55139c1005ff45880e Mon Sep 17 00:00:00 2001 From: Arunava Basu Date: Mon, 1 Aug 2022 20:51:42 +0530 Subject: [PATCH 4/8] REMOVE BUILD STEP REMOVE BUILD STEP --- .github/workflows/ci.yml | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b1614f0..b93b8eb1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,25 +30,3 @@ jobs: run: cd frontend && yarn type-check - name: Run tests run: cd frontend && yarn test - build: - name: ๐Ÿ“ฆ Build and Upload Artifact - runs-on: ubuntu-latest - if : ${{ success() }} - needs: [test] - steps : - - name: Check out Git repository - uses: actions/checkout@v3 - - name: Set up Node.js - uses: actions/setup-node@v1 - with: - node-version: 16 - cache: 'yarn' - - name: Install Node.js dependencies - run: yarn install --frozen-lockfile - - name: Build - run: yarn build - - name: Artifact upload - uses: actions/upload-artifact@v3 - with: - name: Radis App - path: ./frontend/build From f6d0c60e1078db8b577f43927d763570f0026e37 Mon Sep 17 00:00:00 2001 From: Arunava Basu Date: Tue, 2 Aug 2022 00:43:41 +0530 Subject: [PATCH 5/8] UPDATE THE `CD.YML NODE VERSION` --- .github/workflows/{main.yml => cd.yml} | 2 +- frontend/src/App.test.tsx | 1 - frontend/src/components/CalcSpectrum.tsx | 4 +++- 3 files changed, 4 insertions(+), 3 deletions(-) rename .github/workflows/{main.yml => cd.yml} (96%) diff --git a/.github/workflows/main.yml b/.github/workflows/cd.yml similarity index 96% rename from .github/workflows/main.yml rename to .github/workflows/cd.yml index 18f918ac..0cf60d7e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/cd.yml @@ -26,7 +26,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v2 with: - node-version: "14" + node-version: "16" cache: "yarn" - name: Install Node.js dependencies diff --git a/frontend/src/App.test.tsx b/frontend/src/App.test.tsx index 08c5608e..ecba1ca7 100644 --- a/frontend/src/App.test.tsx +++ b/frontend/src/App.test.tsx @@ -2,7 +2,6 @@ /* eslint-disable react/react-in-jsx-scope */ import { render } from "@testing-library/react"; import App from "./App"; -//@ts-ignore test("renders the page", () => { render(); }); diff --git a/frontend/src/components/CalcSpectrum.tsx b/frontend/src/components/CalcSpectrum.tsx index e213b94a..cafd6745 100644 --- a/frontend/src/components/CalcSpectrum.tsx +++ b/frontend/src/components/CalcSpectrum.tsx @@ -160,7 +160,9 @@ export const CalcSpectrum: React.FC = () => { }; const databaseWatch = watch("database"); const modeWatch = watch("mode"); - + // @ts-ignore + const slit_watch = watch("use_simulate_slit"); + console.log(slit_watch); React.useEffect(() => { if (databaseWatch === "geisa") { setUseGesia(true); From 706f99f46727cac6475584b934bd4da533a528b9 Mon Sep 17 00:00:00 2001 From: Arunava Basu Date: Tue, 2 Aug 2022 00:55:14 +0530 Subject: [PATCH 6/8] @ts-ignore removed --- frontend/src/components/CalcSpectrum.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/frontend/src/components/CalcSpectrum.tsx b/frontend/src/components/CalcSpectrum.tsx index cafd6745..87a0622c 100644 --- a/frontend/src/components/CalcSpectrum.tsx +++ b/frontend/src/components/CalcSpectrum.tsx @@ -160,9 +160,6 @@ export const CalcSpectrum: React.FC = () => { }; const databaseWatch = watch("database"); const modeWatch = watch("mode"); - // @ts-ignore - const slit_watch = watch("use_simulate_slit"); - console.log(slit_watch); React.useEffect(() => { if (databaseWatch === "geisa") { setUseGesia(true); From 1239e29ae3b92bf80be582f7aa40d382616d254e Mon Sep 17 00:00:00 2001 From: Arunava Basu Date: Tue, 2 Aug 2022 01:32:31 +0530 Subject: [PATCH 7/8] @eslint -->>`no-empty` function removed --- frontend/src/setupTests.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/setupTests.ts b/frontend/src/setupTests.ts index 1440e330..7ccd3a13 100644 --- a/frontend/src/setupTests.ts +++ b/frontend/src/setupTests.ts @@ -5,5 +5,4 @@ import "@testing-library/jest-dom"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore -// eslint-disable-next-line @typescript-eslint/no-empty-function -window.URL.createObjectURL = function () {}; +window.URL.createObjectURL = () => ""; From e97f22fdfc29dd5146e82741792e54882b0dfbb6 Mon Sep 17 00:00:00 2001 From: Arunava Basu Date: Tue, 2 Aug 2022 18:06:33 +0530 Subject: [PATCH 8/8] remove ts-ignore && eslint ignore --- frontend/src/setupTests.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/frontend/src/setupTests.ts b/frontend/src/setupTests.ts index 7ccd3a13..f2b6e138 100644 --- a/frontend/src/setupTests.ts +++ b/frontend/src/setupTests.ts @@ -3,6 +3,4 @@ // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom import "@testing-library/jest-dom"; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -//@ts-ignore window.URL.createObjectURL = () => "";