From 6728106ea619944b158325445a845b1d35457e64 Mon Sep 17 00:00:00 2001 From: col3name <mmikushov@instaloper.com> Date: Wed, 12 Jul 2023 02:58:38 +0400 Subject: [PATCH] ops: setup ci.yml for code lint and run test for after pull request --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++++ commitlint.config.js | 3 +++ package.json | 10 +++++++++- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml create mode 100644 commitlint.config.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..b544b6744 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,27 @@ +name: CI + +on: + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: 14 + + - name: Install dependencies + run: npm install + + - name: Run linting and tests + run: | + npm run lint + npm test diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 000000000..0f9a27e42 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,3 @@ +module.exports = { // eslint-disable-line + extends: ['@commitlint/config-conventional'] +} diff --git a/package.json b/package.json index 3745b33cd..2d4053ebb 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,10 @@ "build": "react-scripts build", "eject": "react-scripts eject", "test": "react-scripts test", + "lint": "eslint \"**/*.tsx\" --ignore-pattern node_modules/", "e2e": "playwright test --project=chromium && playwright show-report", - "test-ci": "CI=true npm test -- --reporters=\"default\" --reporters=\"jest-html-reporter\" --reporters=\"jest-teamcity\"" + "test-ci": "CI=true npm test -- --reporters=\"default\" --reporters=\"jest-html-reporter\" --reporters=\"jest-teamcity\"", + "commitmsg": "commitlint --from=HEAD~1" }, "eslintConfig": { "extends": [ @@ -57,8 +59,14 @@ ] }, "devDependencies": { + "@commitlint/cli": "^17.6.6", + "@commitlint/config-conventional": "^17.6.6", "@playwright/test": "^1.28.0", "@types/react-helmet": "^6.1.5", + "@typescript-eslint/eslint-plugin": "^6.0.0", + "@typescript-eslint/parser": "^6.0.0", + "eslint": "^8.44.0", + "eslint-plugin-react": "^7.32.2", "jest-html-reporter": "^3.7.0" } }