Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Fix eslint cache (#66066)

Fraser561d578043cb
diff --git a/.github/workflows/cache-generator.yml b/.github/workflows/cache-generator.yml
index ffe16b6f86e..bddf8302f6a 100644
--- a/.github/workflows/cache-generator.yml
+++ b/.github/workflows/cache-generator.yml
@@ -51,14 +51,19 @@ jobs:
eslint-cache-key: ${{ steps.get-cache-keys.outputs.eslint-cache-key }}
cypress-cache-key: ${{ steps.get-cache-keys.outputs.cypress-cache-key }}
- generate-m2-cache:
+ generate-caches:
runs-on: ubuntu-22.04
- timeout-minutes: 15
+ timeout-minutes: 30
needs: get-cache-keys
env:
M2_CACHE_KEY: ${{ needs.get-cache-keys.outputs.m2-cache-key }}
+ NODE_CACHE_KEY: ${{ needs.get-cache-keys.outputs.node-cache-key }}
+ CYPRESS_CACHE_KEY: ${{ needs.get-cache-keys.outputs.cypress-cache-key }}
+ ESLINT_CACHE_KEY: ${{ needs.get-cache-keys.outputs.eslint-cache-key }}
steps:
- uses: actions/checkout@v4
+
+ # Backend preparation and cache
- name: Prepare backend
uses: ./.github/actions/prepare-backend
@@ -75,16 +80,7 @@ jobs:
~/.gitlibs
key: ${{ env.M2_CACHE_KEY }}
- generate-frontend-caches:
- runs-on: ubuntu-22.04
- timeout-minutes: 15
- needs: get-cache-keys
- env:
- NODE_CACHE_KEY: ${{ needs.get-cache-keys.outputs.node-cache-key }}
- ESLINT_CACHE_KEY: ${{ needs.get-cache-keys.outputs.eslint-cache-key }}
- CYPRESS_CACHE_KEY: ${{ needs.get-cache-keys.outputs.cypress-cache-key }}
- steps:
- - uses: actions/checkout@v4
+ # Frontend preparation and caches
# `prepare-frontend` action (1) prepares Node.js and (2) fetches the node_modules cache if it exists.
# It then (3) runs `yarn install --frozen-lockfile --prefer-offline` which ensures the local cache is fully populated.
# IMPORTANT: Caching node_modules after patches are already applied will break any PR that attempts to either:
@@ -111,6 +107,11 @@ jobs:
yarn cypress verify
shell: bash
+ # Run Prettier to populate its cache (stored in node_modules/.cache/prettier)
+ # so it gets saved as part of the node_modules cache below
+ - name: Run Prettier to populate cache
+ run: yarn lint-prettier-pure
+
- name: Update node_modules cache
uses: ./.github/actions/update-cache
with:
@@ -119,14 +120,21 @@ jobs:
node_modules
key: ${{ env.NODE_CACHE_KEY }}
- - name: Update eslint cache
- uses: ./.github/actions/update-cache
- with:
- path: ${{ github.workspace}}/.eslintcache
- key: ${{ env.ESLINT_CACHE_KEY }}
-
- name: Update Cypress cache
uses: ./.github/actions/update-cache
with:
path: ~/.cache/Cypress
key: ${{ env.CYPRESS_CACHE_KEY }}
+
+ # ESLint cache (requires both backend and frontend)
+ - name: Compile CLJS
+ run: yarn build-pure:cljs
+
+ - name: Run ESLint to populate cache
+ run: yarn lint-eslint-pure
+
+ - name: Update eslint cache
+ uses: ./.github/actions/update-cache
+ with:
+ path: ${{ github.workspace}}/.eslintcache
+ key: ${{ env.ESLINT_CACHE_KEY }}
diff --git a/package.json b/package.json
index 899b1018e42..4dabb4c5862 100644
--- a/package.json
+++ b/package.json
@@ -452,13 +452,13 @@
"lint-eslint": "yarn build:cljs && yarn lint-eslint-pure",
"lint-eslint-pure": "eslint --cache --cache-strategy content --ext .js,.jsx,.ts,.tsx --rulesdir frontend/lint/eslint-rules --max-warnings 0 --report-unused-disable-directives enterprise/frontend frontend e2e",
"lint-prettier": "yarn && yarn lint-prettier-pure",
- "lint-prettier-pure": "prettier --check '{frontend,enterprise/frontend,e2e}/**/*.{js,jsx,ts,tsx,css}'",
+ "lint-prettier-pure": "prettier --check --cache '{frontend,enterprise/frontend,e2e}/**/*.{js,jsx,ts,tsx,css}'",
"lint-yaml": "yamllint **/*.{yaml,yml} --ignore=node_modules/**/*.{yaml,yml}",
"postinstall": "if [ -z \"$CI\" ]; then yarn-deduplicate --scopes @babel && yarn patch-package; fi",
"precommit": "lint-staged --shell",
"preinstall": "echo $npm_execpath | grep -q yarn || echo '\\033[0;33mSorry, npm is not supported. Please use Yarn (https://yarnpkg.com/).\\033[0m'",
"prepare": "husky install",
- "prettier": "prettier --write '{frontend,enterprise/frontend,e2e}/**/*.{js,jsx,ts,tsx,css}'",
+ "prettier": "prettier --write --cache '{frontend,enterprise/frontend,e2e}/**/*.{js,jsx,ts,tsx,css}'",
"remove-webpack-cache": "rm -rf ./node_modules/.cache",
"serve-resources": "http-server resources/frontend_client -p 3100 -c-1",
"storybook": "yarn build:cljs && storybook dev -p 6006",