From 5f8b5acd539f95c606028728fb23e773277f0839 Mon Sep 17 00:00:00 2001 From: VeraKutyavina Date: Sat, 27 May 2023 15:52:01 +0300 Subject: [PATCH 1/3] add action --- .github/workflows/main.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..1a98bc9 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,18 @@ +name: Check the source code +on: + pull_request: + branches: + - main + push: + branches: + - main +jobs: + test: + name: Check the source code + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install packages + run: yarn + - name: Lint + run: yarn test From 9d11352dd5dec09da8ce48fed6fc081582419731 Mon Sep 17 00:00:00 2001 From: VeraKutyavina Date: Sat, 27 May 2023 16:02:27 +0300 Subject: [PATCH 2/3] add special commands --- .github/workflows/main.yml | 6 ++++-- package.json | 2 ++ src/setupTests.js | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1a98bc9..eb70a62 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,11 +8,13 @@ on: - main jobs: test: - name: Check the source code + name: Unit tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install packages run: yarn + - name: Test + run: yarn ci:jest - name: Lint - run: yarn test + run: yarn ci:lint-js diff --git a/package.json b/package.json index f809e08..cff636e 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,8 @@ "start": "react-scripts start", "build": "react-scripts build", "test": "jest --watch", + "ci:jest": "jest --ci", + "ci:lint-js": "eslint --ext .js,.jsx ./", "eject": "react-scripts eject", "lint": "eslint './**/*.{js,jsx}' --fix", "prepare": "husky install" diff --git a/src/setupTests.js b/src/setupTests.js index 1dd407a..ddaca98 100644 --- a/src/setupTests.js +++ b/src/setupTests.js @@ -2,4 +2,5 @@ // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom +// eslint-disable-next-line import/no-extraneous-dependencies import "@testing-library/jest-dom"; From 2877f642b47a0d09b60117a37f01105b8210bfbe Mon Sep 17 00:00:00 2001 From: VeraKutyavina Date: Sat, 27 May 2023 16:04:11 +0300 Subject: [PATCH 3/3] fix yaml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eb70a62..91d40a0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,4 +17,4 @@ jobs: - name: Test run: yarn ci:jest - name: Lint - run: yarn ci:lint-js + run: yarn ci:lint-js