mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-09-10 08:37:24 +08:00
ci: move pretty check to one job, stop the rest of the ci from running when prettier errors (#5670)
* move prettier to a separate job, write fixes * remove from assets * break formatting * fix ci * remove exit * typo * ci * permission * use a different action * Fix prettier * commit author * break formatting * Fix prettier * unnecessary ref, remove comments * commit message * split steps * break fe * break fe src * fix if * fix prettier * remove write * rename job * break fe * revert permission change * fix * rename scripts --------- Co-authored-by: Miodec <Miodec@users.noreply.github.com> Co-authored-by: George The Bot <monkeytypegeorge@gmail.com>
This commit is contained in:
parent
daa930bcd8
commit
6554f0b2a9
2 changed files with 62 additions and 23 deletions
68
.github/workflows/monkey-ci.yml
vendored
68
.github/workflows/monkey-ci.yml
vendored
|
@ -95,9 +95,57 @@ jobs:
|
|||
name: Install dependencies
|
||||
run: npm install --prefer-offline --no-audit
|
||||
|
||||
check-pretty:
|
||||
name: check-pretty
|
||||
needs: [pre-ci, prime-cache]
|
||||
runs-on: ubuntu-latest
|
||||
if: needs.pre-ci.outputs.should-build-be == 'true' || needs.pre-ci.outputs.should-build-fe == 'true' || needs.pre-ci.outputs.should-build-pkg == 'true' || needs.pre-ci.outputs.assets-json == 'true'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Cache node modules
|
||||
id: cache-npm
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install --prefer-offline --no-audit
|
||||
|
||||
- name: Check pretty (backend)
|
||||
id: check-pretty-be
|
||||
if: needs.pre-ci.outputs.should-build-be == 'true'
|
||||
run: npm run pretty-check-be
|
||||
|
||||
- name: Check pretty (frontend)
|
||||
id: check-pretty-fe
|
||||
if: needs.pre-ci.outputs.should-build-fe == 'true'
|
||||
run: npm run pretty-check-fe
|
||||
|
||||
- name: Check pretty (packages)
|
||||
id: check-pretty-pkg
|
||||
if: needs.pre-ci.outputs.should-build-pkg == 'true'
|
||||
run: npm run pretty-check-pkg
|
||||
|
||||
- name: Check pretty (assets)
|
||||
id: check-pretty-assets
|
||||
if: needs.pre-ci.outputs.assets-json == 'true'
|
||||
run: npm run pretty-check-assets
|
||||
|
||||
ci-be:
|
||||
name: ci-be
|
||||
needs: [pre-ci, prime-cache]
|
||||
needs: [pre-ci, prime-cache, check-pretty]
|
||||
runs-on: ubuntu-latest
|
||||
if: needs.pre-ci.outputs.should-build-be == 'true'
|
||||
steps:
|
||||
|
@ -123,9 +171,6 @@ jobs:
|
|||
- name: Install dependencies
|
||||
run: npm install --prefer-offline --no-audit
|
||||
|
||||
- name: Check pretty
|
||||
run: npm run pretty-code-be
|
||||
|
||||
- name: Check lint
|
||||
run: npm run lint-be
|
||||
|
||||
|
@ -137,7 +182,7 @@ jobs:
|
|||
|
||||
ci-fe:
|
||||
name: ci-fe
|
||||
needs: [pre-ci, prime-cache]
|
||||
needs: [pre-ci, prime-cache, check-pretty]
|
||||
runs-on: ubuntu-latest
|
||||
if: needs.pre-ci.outputs.should-build-fe == 'true'
|
||||
steps:
|
||||
|
@ -167,9 +212,6 @@ jobs:
|
|||
- name: Install dependencies
|
||||
run: npm install --prefer-offline --no-audit
|
||||
|
||||
- name: Check pretty
|
||||
run: npm run pretty-code-fe
|
||||
|
||||
- name: Check lint
|
||||
run: npm run lint-fe
|
||||
|
||||
|
@ -181,7 +223,7 @@ jobs:
|
|||
|
||||
ci-assets:
|
||||
name: ci-assets
|
||||
needs: [pre-ci, prime-cache]
|
||||
needs: [pre-ci, prime-cache, check-pretty]
|
||||
runs-on: ubuntu-latest
|
||||
if: needs.pre-ci.outputs.assets-json == 'true'
|
||||
steps:
|
||||
|
@ -221,9 +263,6 @@ jobs:
|
|||
- name: Install dependencies
|
||||
run: npm install --prefer-offline --no-audit
|
||||
|
||||
- name: Check Pretty
|
||||
run: npm run pretty-assets-fe
|
||||
|
||||
- name: Lint JSON
|
||||
run: npm run pr-check-lint-json
|
||||
|
||||
|
@ -241,7 +280,7 @@ jobs:
|
|||
|
||||
ci-pkg:
|
||||
name: ci-pkg
|
||||
needs: [pre-ci, prime-cache]
|
||||
needs: [pre-ci, prime-cache,check-pretty]
|
||||
runs-on: ubuntu-latest
|
||||
if: needs.pre-ci.outputs.should-build-pkg == 'true'
|
||||
steps:
|
||||
|
@ -267,9 +306,6 @@ jobs:
|
|||
- name: Install dependencies
|
||||
run: npm install --prefer-offline --no-audit
|
||||
|
||||
- name: Check pretty
|
||||
run: npm run pretty-code-pkg
|
||||
|
||||
- name: Check lint
|
||||
run: npm run lint-pkg
|
||||
|
||||
|
|
17
package.json
17
package.json
|
@ -29,13 +29,16 @@
|
|||
"release": "release-it -c .release-it.json",
|
||||
"release-fe": "release-it -c .release-it-fe.json",
|
||||
"hotfix": "npm run build-fe && cd frontend && npm run deploy-live && cd .. && sh ./bin/purgeCfCache.sh",
|
||||
"pretty": "prettier --check \"./backend/**/*.{ts,json,js,css,html}\" \"./frontend/**/*.{ts,js,scss}\" \"./packages/**/*.{ts,js,json}\" \"./frontend/static/**/*.{json,html,css}\"",
|
||||
"pretty-code": "prettier --check \"./backend/**/*.{ts,js,json,css,html}\" \"./frontend/**/*.{ts,js}\" \"./packages/**/*.{ts,js,json}\" \"./frontend/src/**/*.scss\" ",
|
||||
"pretty-code-be": "prettier --check \"./backend/**/*.{ts,js,json,css,html}\"",
|
||||
"pretty-code-fe": "prettier --check \"./frontend/**/*.{ts,js}\" \"./frontend/src/**/*.scss\"",
|
||||
"pretty-assets-fe": "prettier --check \"./frontend/static/**/*.json\"",
|
||||
"pretty-code-pkg": "prettier --check \"./packages/**/*.{ts,js}\"",
|
||||
"pretty-fix": "prettier --write \"./backend/**/*.{ts,json,js,css,html}\" \"./frontend/**/*.{ts,js,scss}\" \"./packages/**/*.{ts,js,json}\" \"./frontend/static/**/*.{json,html,css}\"",
|
||||
"pretty-check": "prettier --check .",
|
||||
"pretty-check-be": "prettier --check ./backend",
|
||||
"pretty-check-fe": "prettier --check ./frontend/src",
|
||||
"pretty-check-assets": "prettier --check ./frontend/static",
|
||||
"pretty-check-pkg": "prettier --check ./packages",
|
||||
"pretty-fix": "prettier --write .",
|
||||
"pretty-fix-be": "prettier --write ./backend",
|
||||
"pretty-fix-fe": "prettier --write ./frontend/src",
|
||||
"pretty-fix-assets": "prettier --write ./frontend/static",
|
||||
"pretty-fix-pkg": "prettier --write ./packages",
|
||||
"pr-check-lint-json": "cd frontend && eslint './static/**/*.json'",
|
||||
"pr-check-quote-json": "cd frontend && npx gulp pr-check-quote-json",
|
||||
"pr-check-language-json": "cd frontend && npx gulp pr-check-language-json",
|
||||
|
|
Loading…
Add table
Reference in a new issue