Skip to content

Commit

Permalink
ci(global): DOMA-7698 migrate some jobs to global CI
Browse files Browse the repository at this point in the history
  • Loading branch information
SavelevMatthew committed Nov 19, 2023
1 parent 9f06add commit e7bb0a3
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 157 deletions.
66 changes: 0 additions & 66 deletions .github/workflows/nodejs.apps.build.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/nodejs.condo.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,46 @@ jobs:
provenance: false
cache-from: type=registry,ref=swr.ru-moscow-1.hc.sbercloud.ru/condo/condo-tests-image:buildcache
cache-to: type=registry,ref=swr.ru-moscow-1.hc.sbercloud.ru/condo/condo-tests-image:buildcache,mode=max,image-manifest=true

lint:
name: Lint source code
runs-on: ubuntu-latest
steps:
- name: Checkout code with submodules
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
ssh-key: ${{ secrets.SSH_DOCK_SERVER_PRIVATE_KEY }}
- name: Prepare Node environment
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install root dependencies
run: |
yarn workspaces focus root
- name: Check code-style rules
run: |
yarn lint:code
# TODO(DOMA-7753): Think about migrating this check to Typescript, like in dev-portal and documents.
# Reason: TS check is no cost + you can fix it before you commit it + lint out the box in build-time + have keys autocompletion!!
- name: Check translations rules
run: |
yarn lint:translations
- name: Check common file patterns
run: |
bash ./bin/lint-common-patterns.sh
# TODO(DOMA-7754): Figure out how to extract schema without starting KS-app (30sec for start per app is slow) and lint all apps

security:
name: Semgrep vulnerabilities check
runs-on: ubuntu-latest
container:
image: returntocorp/semgrep
# Skip any PR created by dependabot to avoid permission issues
if: (github.actor != 'dependabot[bot]')
steps:
# Fetch project source with GitHub Actions Checkout.
- uses: actions/checkout@v3
- run: ./bin/run-semgrep.sh -a
26 changes: 0 additions & 26 deletions .github/workflows/nodejs.condo.code.analysis.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/nodejs.lint.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn workspace @app/condo lint-i18n-translations
yarn lint-translations
3 changes: 1 addition & 2 deletions apps/condo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"createservice": "node ./../../bin/createservice",
"createschema": "node ./../../bin/createschema",
"lint-schema": "NODE_ENV=test node ./../../bin/lint-schema.js",
"lint-i18n-translations": "node ./../../bin/lint-i18n-translations.js"
"lint-translations": "node ./../../bin/lint-i18n-translations.js"
},
"dependencies": {
"@2gis/mapgl": "1.28.0",
Expand Down Expand Up @@ -190,7 +190,6 @@
"cross-env": "^7.0.3",
"css-loader": "1.0.1",
"cypress": "12.17.3",
"eslint-plugin-cypress": "^2.12.1",
"extracted-loader": "^1.0.7",
"form-data": "^4.0.0",
"identity-obj-proxy": "^3.0.0",
Expand Down
17 changes: 1 addition & 16 deletions bin/lint-i18n-translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,14 @@
To use it as a pre-commit hook, add following entry into `script` section of repository's `package.json`:
```json
"lint-i18n-translations": "node ./../../bin/lint-i18n-translations.js",
```
In `.husky/pre-commit` add a launch command, like following, supposing, that your repo
is named `your_repo` and located in `apps` folder:
```
yarn workspace @app/your_repo lint-i18n-translations
"lint-translations": "node ./../../bin/lint-i18n-translations.js",
```
Update pre-commit hooks, for example, when husky is in `prepare` script, run
```shell
npm run prepare
```
### As part of CI/CD workflow
Add following command to appropriate workflow configuration file:
```
yarn workspace @app/condo lint-i18n-translations
```
*/
const fs = require('fs')
const path = require('path')
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"build:packages": "turbo run build --filter='./packages/*'",
"build:apps": "turbo run build --filter='./apps/*' --concurrency=100%",
"build": "turbo run build",
"lint": "yarn run eslint . --ext .js,.jsx,.ts,.tsx",
"lint:code": "yarn run eslint . --ext .js,.jsx,.ts,.tsx",
"lint:translations": "turbo run lint-translations",
"createapp": "node ./bin/createapp",
"prepare": "husky install"
},
Expand All @@ -34,6 +35,7 @@
"babel-eslint": "^10.1.0",
"commander": "^9.4.0",
"eslint": "^7.13.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^24.1.0",
"eslint-plugin-react": "^7.21.5",
Expand Down
4 changes: 4 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**", "build/**"]
},
"lint-translations":{
"cache": false,
"outputs": []
}
}
}
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,6 @@ __metadata:
encoding: ^0.1.0
ensure-error: ^3.0.1
esdk-obs-nodejs: 3.21.6
eslint-plugin-cypress: ^2.12.1
eventemitter3: ^4.0.7
express: ^4.17.1
extracted-loader: ^1.0.7
Expand Down Expand Up @@ -43200,6 +43199,7 @@ __metadata:
commander: ^9.4.0
commitlint-plugin-function-rules: ^1.3.2
eslint: ^7.13.0
eslint-plugin-cypress: ^2.12.1
eslint-plugin-import: ^2.27.5
eslint-plugin-jest: ^24.1.0
eslint-plugin-react: ^7.21.5
Expand Down

0 comments on commit e7bb0a3

Please sign in to comment.