Compare commits

...

22 Commits

Author SHA1 Message Date
Nemanja Glumac
6f69752273 Refactor cache key echo statements
Simplified cache key echo statements in workflow.
2025-10-24 10:56:17 +02:00
Nemanja Glumac
c2ed91acc6 Update cache-warm-up.yml 2025-10-24 10:54:38 +02:00
Nemanja Glumac
ff8f9cdd62 Remove M2_CACHE_KEY from cache-warm-up workflow
Removed environment variable M2_CACHE_KEY from workflow.
2025-10-24 10:52:48 +02:00
Nemanja Glumac
2af532b4eb Add deterministic cache key generation step
Added a step to generate deterministic cache keys for Maven and Node.js caches.
2025-10-24 10:52:02 +02:00
Nemanja Glumac
1d65212696 test env 2025-10-24 09:30:17 +02:00
Nemanja Glumac
2a9da9a462 Refactor cache warm-up workflow for clarity 2025-10-24 01:50:21 +02:00
Nemanja
930ba39dad test 2025-10-24 01:24:23 +02:00
Nemanja
a3045af71d only if exists 2025-10-24 01:22:18 +02:00
Nemanja
f484822f4a check if exists 2025-10-24 01:18:25 +02:00
Nemanja
d707547b08 trigger ci 2025-10-24 01:08:57 +02:00
Nemanja
00e96fe44a update with large cache 2025-10-24 01:05:04 +02:00
Nemanja
31ea48ad94 small cache 2025-10-24 01:00:34 +02:00
Nemanja
f54eaecd39 fix url 2025-10-24 00:44:02 +02:00
Nemanja
c830ffd7e8 Delete key first? 2025-10-24 00:41:44 +02:00
Nemanja
4b7818b5eb Test cache generator 2025-10-24 00:15:09 +02:00
Nemanja
ff4b37c231 Restore from a previous key 2025-10-23 22:44:57 +02:00
Nemanja
760caf92ab Only write from ee uberjar 2025-10-23 22:17:56 +02:00
Nemanja
8039d7a5ec Allow only the uberjar workflow to save cache 2025-10-23 21:57:46 +02:00
Nemanja
a6764cd608 Unify caches between prepare-frontend and prepare-backend 2025-10-23 21:57:46 +02:00
Nemanja
5e9da1ef85 Remove superfluous m2_cache_key_suffix 2025-10-23 21:57:46 +02:00
Nemanja
c831380d6b Remove unnecessary m2_cache_key inputs 2025-10-23 21:57:46 +02:00
Nemanja
adfb313007 Tweak the prepare-backend composite action
This commit unifies the m2 cache under ONE key.
2025-10-23 21:57:46 +02:00
36 changed files with 91 additions and 96 deletions

View File

@@ -17,8 +17,6 @@ runs:
- name: Prepare backend environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: cross-branch-migrations
- name: Run backend on base branch
run: |

View File

@@ -9,10 +9,10 @@ inputs:
clojure-version:
required: true
default: '1.12.0.1488'
m2-cache-key:
description: 'Key to cache M2 packages from Maven Central'
required: true
default: 'm2'
can-update-cache:
description: 'Whether a job that calls this action is allowed to update the m2 cache.'
required: false
default: false
runs:
using: "composite"
@@ -28,16 +28,22 @@ runs:
run: |
curl -O https://download.clojure.org/install/linux-install-${{ inputs.clojure-version }}.sh &&
sudo bash ./linux-install-${{ inputs.clojure-version }}.sh
- name: Fetch CI config
shell: bash
run: |
curl -o ci-test-config.json https://raw.githubusercontent.com/metabase/metabase/refs/heads/master/ci-test-config.json
- name: Get current week of year
id: get-date
run: |
echo "week-of-year=$(/bin/date "+%G-%V")" >> $GITHUB_OUTPUT
shell: bash
- name: Get M2 cache
uses: actions/cache@v4
uses: actions/cache/restore@v4
with:
path: |
~/.m2
~/.gitlibs
key: ${{ runner.os }}-${{ inputs.m2-cache-key }}-${{ hashFiles('**/deps.edn') }}
restore-keys: |
${{ runner.os }}-${{ inputs.m2-cache-key }}-
key: ${{ runner.os }}-m2-${{ steps.get-date.outputs.week-of-year }}
restore-keys: ${{ runner.os }}-m2-

View File

@@ -12,11 +12,20 @@ runs:
node-version: ${{ inputs.node-version }} # this overrides, if present
node-version-file: ".nvmrc"
# Note that this is the same caching logic from the `prepare-backend` action.
# Keep these caches in sync.
- name: Get current week of year
id: get-date
run: |
echo "week-of-year=$(/bin/date "+%G-%V")" >> $GITHUB_OUTPUT
shell: bash
- name: Get M2 cache
uses: actions/cache@v4
uses: actions/cache/restore@v4
with:
path: ~/.m2
key: ${{ runner.os }}-cljs-${{ hashFiles('**/shadow-cljs.edn') }}
path: |
~/.m2
~/.gitlibs
key: ${{ runner.os }}-m2-${{ steps.get-date.outputs.week-of-year }}
- name: Get node_modules cache
uses: actions/cache@v4

View File

@@ -7,8 +7,6 @@ runs:
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Compile CLJS
run: yarn build-pure:cljs

View File

@@ -15,8 +15,6 @@ runs:
steps:
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: driver
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
if: ${{ inputs.build-static-viz == 'true' }}

View File

@@ -15,8 +15,6 @@ jobs:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cloverage"
- name: Build static viz frontend
run: yarn build-static-viz
env:

View File

@@ -21,8 +21,6 @@ jobs:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'kondo'
- name: Run clj-kondo
run: ./bin/mage kondo
@@ -35,8 +33,6 @@ jobs:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "eastwood"
- run: clojure -X:dev:ee:ee-dev:drivers:drivers-dev:test:eastwood
name: Run Eastwood linter
@@ -112,7 +108,6 @@ jobs:
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: be-tests
java-version: "${{ matrix.java-version }}"
# Depending on which files changed, we might either have to build static-viz
# from scratch or download the previously built artifact
@@ -180,8 +175,6 @@ jobs:
- uses: actions/checkout@v4
- name: Prepare backend
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: be-check
# TODO -- we should probably also check WITHOUT ee -- do a check with only OSS namespaces on the classpath
- name: Check namespaces
run: clojure -M:ee:drivers:check
@@ -195,8 +188,6 @@ jobs:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'cljfmt'
- name: Run cljfmt
run: ./bin/mage cljfmt-all --force-check

View File

@@ -16,8 +16,6 @@ jobs:
- name: Prepare back-end environment
timeout-minutes: 5
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'build-scripts'
- name: Run build and release script tests
run: clojure -X:dev:drivers:build:build-dev:build-test:ci

63
.github/workflows/cache-warm-up.yml vendored Normal file
View File

@@ -0,0 +1,63 @@
name: Cache Generator
on:
push: # temp
schedule:
- cron: '0 3 * * 1' # Mondays at 03:00 UTC
workflow_dispatch: # manually update the cache
jobs:
warm-m2-cache:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Get current week of year
run: |
WEEK_OF_YEAR=$(/bin/date "+%G-%V")
echo "m2-cache-key=m2-${{ runner.os }}-$WEEK_OF_YEAR" >> $GITHUB_ENV
shell: bash
- name: Get a deterministic cache key
run: |
M2_CACHE_PREFIX='M2'
NODE_CACHE_PREFIX='node-modules'
WEEK_OF_YEAR=$(/bin/date "+%G-%V")
CACHE_SUFFIX="${{ runner.os }}-$WEEK_OF_YEAR"
echo "$M2_CACHE_PREFIX-$CACHE_SUFFIX"
echo "$NODE_CACHE_PREFIX-$CACHE_SUFFIX"
shell: bash
- name: Prepare backend
uses: ./.github/actions/prepare-backend
with:
java-version: 21
- name: Pre-resolve dependencies
run: clojure -A:build:dev:ee:ee-dev:drivers:drivers-dev:cljs -P
- name: Check if the cache entry exists
id: cache-lookup
uses: actions/cache/restore@v4
with:
path: |
~/.m2
~/.gitlibs
key: ${{ env.m2-cache-key }}
lookup-only: true
- name: Delete the cache entry if it exists
if: ${{ steps.cache-lookup.outputs.cache-hit == 'true' }}
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api \
--method DELETE \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/actions/caches?key=${{ env.m2-cache-key }}
- name: Update M2 cache
uses: actions/cache/save@v4
with:
path: |
~/.m2
~/.gitlibs
key: ${{ env.m2-cache-key }}

View File

@@ -40,8 +40,6 @@ jobs:
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Compile CLJS
run: NODE_ENV=development yarn build-pure:cljs
- name: Publish to Chromatic

View File

@@ -38,7 +38,5 @@ jobs:
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'cljs'
- name: Run Cljs tests
run: yarn run test-cljs

View File

@@ -14,8 +14,6 @@ jobs:
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Run frontend unit tests
run: yarn run test-unit --silent --coverage
- name: Upload coverage to codecov.io

View File

@@ -9,10 +9,6 @@ on:
description: "The branch to check out and create a PR against"
required: true
type: string
m2_cache_key_suffix:
description: "A unique suffix for the Maven cache key"
required: true
type: string
secrets:
automation_token:
description: "A token with permissions to create branches and PRs"
@@ -37,8 +33,6 @@ jobs:
- name: Prepare backend environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "auto-update-docs-${{ inputs.m2_cache_key_suffix }}"
- name: Generate environment variables documentation
id: generate_env_docs

View File

@@ -11,6 +11,5 @@ jobs:
uses: ./.github/workflows/docs-generate-base.yml
with:
target_branch: "master"
m2_cache_key_suffix: "master"
secrets:
automation_token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}

View File

@@ -11,6 +11,5 @@ jobs:
uses: ./.github/workflows/docs-generate-base.yml
with:
target_branch: "release-x.56.x"
m2_cache_key_suffix: "release"
secrets:
automation_token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}

View File

@@ -112,7 +112,6 @@ jobs:
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: uberjar
java-version: "${{ needs.get-build-requirements.outputs.java_version || 21 }}"
- name: Prepare front-end environment

View File

@@ -83,7 +83,6 @@ jobs:
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: uberjar
java-version: "${{ needs.get-build-requirements.outputs.java_version || 21 }}"
- name: Build uberjar with ./bin/build.sh
@@ -144,8 +143,6 @@ jobs:
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Retrieve Embedding SDK dist artifact
uses: actions/download-artifact@v4

View File

@@ -167,7 +167,6 @@ jobs:
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: uberjar
java-version: "${{ needs.get-build-requirements.outputs.java_version || 21 }}"
- name: Build uberjar with ./bin/build.sh

View File

@@ -40,8 +40,6 @@ jobs:
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Build Embedding SDK package
run: |
# Remove the matchers to not report false positives on every PR

View File

@@ -43,8 +43,6 @@ jobs:
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Build cljs
run: yarn build:cljs
- name: Stress-test ${{ github.event.inputs.spec }} ${{ github.event.inputs.burn_in }} times

View File

@@ -35,8 +35,6 @@ jobs:
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Restore ESLint cache
uses: actions/cache@v4
with:
@@ -65,8 +63,6 @@ jobs:
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- run: yarn build-pure:cljs
name: Compile CLJS
- run: yarn type-check-pure
@@ -90,8 +86,6 @@ jobs:
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Run frontend unit tests
run: yarn run test-unit --silent --shard=${{ matrix.shard }}/${{ env.SHARDS }}
- name: Upload Test Results
@@ -116,8 +110,6 @@ jobs:
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Run frontend timezones tests
run: yarn run test-timezones

View File

@@ -22,8 +22,6 @@ jobs:
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- run: yarn test-unit frontend/src/metabase/querying/expressions/pratt/fuzz.lexifier.unit.spec.ts
env:
MB_FUZZ: 1
@@ -38,8 +36,6 @@ jobs:
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- run: yarn test-unit frontend/src/metabase/querying/expressions/fuzz.compiler.unit.spec.ts
env:
MB_FUZZ: 1
@@ -54,8 +50,6 @@ jobs:
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- run: yarn test-unit frontend/src/metabase/querying/expressions/fuzz.string.unit.spec.ts
env:
MB_FUZZ: 1

View File

@@ -40,8 +40,6 @@ jobs:
ref: ${{ inputs.ref }}
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: generative-query-test
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend

View File

@@ -38,8 +38,6 @@ jobs:
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'i18n'
- name: Install xgettext if necessary
run: |
if ! command -v xgettext > /dev/null; then

View File

@@ -20,8 +20,6 @@ jobs:
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Compile CLJS
run: yarn build-pure:cljs

View File

@@ -47,8 +47,6 @@ jobs:
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Compile CLJS
run: NODE_ENV=development yarn build-pure:cljs

View File

@@ -13,8 +13,6 @@ jobs:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'kondo'
- name: Setup Babashka
uses: turtlequeue/setup-babashka@v1.7.0
with:

View File

@@ -16,7 +16,5 @@ jobs:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: lint-migrations
- name: Verify Liquibase Migrations
run: ./bin/mage lint-migrations

View File

@@ -254,8 +254,6 @@ jobs:
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "release-sdk"
- name: Run unit tests
run: yarn embedding-sdk:test-unit
@@ -277,8 +275,6 @@ jobs:
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "release-sdk"
- name: Bump published npm package version
# NOTE: this should happen before "Build SDK bundle" as we inject SDK version into the code during build step

View File

@@ -49,8 +49,6 @@ jobs:
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "files-changed"
- name: Build static-viz frontend
run: yarn build-static-viz
env:

View File

@@ -23,8 +23,6 @@ jobs:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'snyk'
- name: Generate all pom.xml
run: .github/scripts/write-poms.sh
- name: Upload pom files

View File

@@ -29,8 +29,6 @@ jobs:
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: manage-translations
- name: install gettext
run: sudo apt-get install gettext

View File

@@ -46,8 +46,6 @@ jobs:
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- run: yarn build-pure:cljs
name: Compile CLJS

View File

@@ -134,7 +134,8 @@ jobs:
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: uberjar
# We want only the ee uberjar to update the cache to avoid race conditions!
can-update-cache: ${{ matrix.edition == 'ee' }}
java-version: "${{ needs.get-build-requirements.outputs.java_version || 21 }}"
- name: Build
run: ./bin/build.sh

View File

@@ -27,8 +27,6 @@ jobs:
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'update-be-deps'
- name: Open PRs to Upgrade Backend Deps
uses: ./.github/actions/upgrade-backend-deps
with:

View File

@@ -16,7 +16,5 @@ jobs:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'whitespace-linter'
- run: clojure -T:whitespace-linter lint
name: Run Whitespace Linter