Skip to content

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

Consolidate caches (#66036)

Nemanja Glumac135abb44a55d
diff --git a/.github/actions/get-cache-keys/action.yml b/.github/actions/get-cache-keys/action.yml
index 91975a1bce5..148468fea0d 100644
--- a/.github/actions/get-cache-keys/action.yml
+++ b/.github/actions/get-cache-keys/action.yml
@@ -13,6 +13,9 @@ outputs:
eslint-cache-key:
description: "The cache key for Eslint cache"
value: ${{ steps.keys-factory.outputs.eslint-cache-key }}
+ cypress-cache-key:
+ description: "The cache key for Cypress cache"
+ value: ${{ steps.keys-factory.outputs.cypress-cache-key }}
runs:
using: "composite"
@@ -23,10 +26,12 @@ runs:
M2_CACHE_PREFIX='M2'
NODE_CACHE_PREFIX='node-modules'
ESLINT_CACHE_PREFIX='eslint'
+ CYPRESS_CACHE_PREFIX='cypress'
WEEK_OF_YEAR=$(/bin/date "+%G-%V")
CACHE_SUFFIX="${{ runner.os }}-$WEEK_OF_YEAR"
echo "m2-cache-key=$M2_CACHE_PREFIX-$CACHE_SUFFIX" >> $GITHUB_OUTPUT
echo "node-cache-key=$NODE_CACHE_PREFIX-$CACHE_SUFFIX" >> $GITHUB_OUTPUT
echo "eslint-cache-key=$ESLINT_CACHE_PREFIX-$CACHE_SUFFIX" >> $GITHUB_OUTPUT
+ echo "cypress-cache-key=$CYPRESS_CACHE_PREFIX-$CACHE_SUFFIX" >> $GITHUB_OUTPUT
shell: bash
diff --git a/.github/actions/prepare-cypress/action.yml b/.github/actions/prepare-cypress/action.yml
index a35a679304f..0ce24af4752 100644
--- a/.github/actions/prepare-cypress/action.yml
+++ b/.github/actions/prepare-cypress/action.yml
@@ -22,16 +22,16 @@ runs:
chrome-version: 1097615
id: setup-chrome
- - name: Get current week of year
- id: get-date
- run: |
- echo "week-of-year=$(/bin/date "+%G-%V")" >> $GITHUB_OUTPUT
- shell: bash
+ - name: Get cache keys
+ uses: ./.github/actions/get-cache-keys
+ id: get-cache-keys
+
- name: Get Cypress cache
- uses: actions/cache@v4
+ uses: actions/cache/restore@v4
with:
path: ~/.cache/Cypress
- key: ${{ runner.os }}-Cypress-${{ steps.get-date.outputs.week-of-year }}
+ key: ${{ steps.get-cache-keys.outputs.cypress-cache-key }}
+
- name: Ensure that Cypress executable is ready
run: |
yarn cypress install
diff --git a/.github/workflows/cache-generator.yml b/.github/workflows/cache-generator.yml
index d9f5f30ed84..0aad99233c8 100644
--- a/.github/workflows/cache-generator.yml
+++ b/.github/workflows/cache-generator.yml
@@ -30,8 +30,8 @@ name: Cache Generator
on:
schedule:
- - cron: '0 3 * * 1' # Mondays at 03:00 UTC
- workflow_dispatch: # manually update the cache
+ - cron: "0 3 * * 1" # Mondays at 03:00 UTC
+ workflow_dispatch: # manually update the cache
concurrency:
group: cache-generator
@@ -49,6 +49,7 @@ jobs:
m2-cache-key: ${{ steps.get-cache-keys.outputs.m2-cache-key }}
node-cache-key: ${{ steps.get-cache-keys.outputs.node-cache-key }}
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:
runs-on: ubuntu-22.04
@@ -63,15 +64,20 @@ jobs:
# Add or remove aliases to affect the cache size and its contents.
# Adjust to taste, then redeploy this workflow.
- - name: Pre-resolve dependencies
+ - name: Pre-resolve Clojure dependencies
run: clojure -A:build:dev:ee:ee-dev:drivers:drivers-dev:cljs -P
+ - name: Let Mage install babashka and clojure-tools
+ run: ./bin/mage
+
- name: Update M2 cache
uses: ./.github/actions/update-cache
with:
path: |
~/.m2
~/.gitlibs
+ ~/.deps.clj
+ ${{ github.workspace}}/bin/bb
key: ${{ env.M2_CACHE_KEY }}
generate-frontend-caches:
@@ -81,6 +87,7 @@ jobs:
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
# `prepare-frontend` action (1) prepares Node.js and (2) fetches the node_modules cache if it exists.
@@ -92,7 +99,7 @@ jobs:
- name: Install front-end dependencies
uses: ./.github/actions/prepare-frontend
with:
- apply-patches: 'false'
+ apply-patches: "false"
- name: Get yarn cache directory
id: yarn-cache-dir
@@ -101,6 +108,14 @@ jobs:
echo "Yarn cache directory: $YARN_CACHE_DIR"
echo "dir=$YARN_CACHE_DIR" >> $GITHUB_OUTPUT
+ - name: Ensure that Cypress executable is ready
+ run: |
+ yarn cypress install
+ yarn cypress cache path
+ yarn cypress cache list
+ yarn cypress verify
+ shell: bash
+
- name: Update node_modules cache
uses: ./.github/actions/update-cache
with:
@@ -112,5 +127,11 @@ jobs:
- name: Update eslint cache
uses: ./.github/actions/update-cache
with:
- path: .eslintcache
+ 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 }}
diff --git a/.github/workflows/drivers.yml b/.github/workflows/drivers.yml
index 08cd86036f8..2e02ea75425 100644
--- a/.github/workflows/drivers.yml
+++ b/.github/workflows/drivers.yml
@@ -27,21 +27,17 @@ jobs:
# Fetch the base branch to ensure its history is available for diffing
git fetch --depth=1 origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }}
# Only run this if it's a pull request and the base ref exists
- - name: Get Date
- id: get-date
- shell: bash
- run: |
- echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
- - name: Restore Babashka cache
- uses: actions/cache@v4
+ - name: Get cache keys
+ uses: ./.github/actions/get-cache-keys
+ id: get-cache-keys
+ - name: Restore babashka cache
+ uses: actions/cache/restore@v4
with:
path: |
- ~/.m2
~/.deps.clj
- restore-keys: |
- mage-drivers-
- key: >-
- mage-drivers-${{ steps.get-date.outputs.date }}
+ ${{ github.workspace}}/bin/bb
+ key: ${{ steps.get-cache-keys.outputs.m2-cache-key }}
+
- name: Check if driver tests should run
id: check-branch-and-files-changed
run: |
diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml
index 62d21d93d3f..cb32a082587 100644
--- a/.github/workflows/frontend.yml
+++ b/.github/workflows/frontend.yml
@@ -42,7 +42,7 @@ jobs:
- name: Restore ESLint cache
uses: actions/cache/restore@v4
with:
- path: .eslintcache
+ path: ${{ github.workspace}}/.eslintcache
key: ${{ steps.get-cache-keys.outputs.eslint-cache-key }}
- name: Compile CLJS