* Use bun in package.json * Update workflows * Update more workflows * Kick ci * Fix yaml * Fix type errors * Compat with snyk * Fix jest resolutions * Add another esm package * Fix aliases and next js missing deps * Update next js embed tests * Try fix embed test config * Fix * Fix requires in e2e support * Use bun not yarn in embed bin * Revert config changes * Use bun in more scripts and use prepare-release action * Replace more yarn usages * Remove overrides from bunfig move to package json * Revert e2e support changes * Add back comment * [ci skip] comment typo * Update bun lock * Update to reference bun * Update to reference bun * Update license disclaimer * Tidy tests * Update to use bun in workflows * Change aliases * Update codemirrort selector * Tidy license generation * Remove .only * Fix yarn references * Checkout .github for release scripts * Update lockfile * Re-add package * update release bunlock * fix checkout check --------- Co-authored-by: Ryan Laurie <iethree@gmail.com>
191 lines
7.2 KiB
YAML
191 lines
7.2 KiB
YAML
name: Build Uberjar
|
|
|
|
# This workflow builds an uberjar and pushes it to dockerhub for any branch, either on-demand,
|
|
# or automatically for the listed branches
|
|
|
|
concurrency:
|
|
group: uberjar-${{ github.event.inputs.commit || github.event.pull_request.head.sha || github.sha }}
|
|
cancel-in-progress: false
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- internal-tools
|
|
paths-ignore:
|
|
# config files
|
|
- ".**"
|
|
# documentation
|
|
- "docs/**"
|
|
- "**.md"
|
|
# this covers both BE and FE unit tests, as well as E2E tests
|
|
- "**test/**"
|
|
- "**_test.clj"
|
|
- "**/frontend/**.unit.*"
|
|
workflow_dispatch:
|
|
inputs:
|
|
commit:
|
|
description: "Optional full-length commit SHA-1 hash"
|
|
workflow_call:
|
|
|
|
jobs:
|
|
check-existing-artifacts:
|
|
runs-on: ubuntu-22.04
|
|
timeout-minutes: 5
|
|
outputs:
|
|
ee_exists: ${{ steps.check-ee.outcome == 'success' }}
|
|
oss_exists: ${{ steps.check-oss.outcome == 'success' }}
|
|
should_build: ${{ steps.decide.outputs.should_build }}
|
|
steps:
|
|
- name: Check out the code
|
|
uses: actions/checkout@v4
|
|
- name: Try to fetch existing EE artifact
|
|
id: check-ee
|
|
continue-on-error: true
|
|
uses: ./.github/actions/fetch-artifact
|
|
with:
|
|
commit: ${{ github.event.inputs.commit || github.event.pull_request.head.sha || github.sha }}
|
|
edition: ee
|
|
output-name: metabase-ee.jar
|
|
|
|
- name: Try to fetch existing OSS artifact
|
|
id: check-oss
|
|
continue-on-error: true
|
|
uses: ./.github/actions/fetch-artifact
|
|
with:
|
|
commit: ${{ github.event.inputs.commit || github.event.pull_request.head.sha || github.sha }}
|
|
edition: oss
|
|
output-name: metabase-oss.jar
|
|
|
|
- name: Decide if build is needed
|
|
id: decide
|
|
run: |
|
|
EE_EXISTS="${{ steps.check-ee.outcome == 'success' }}"
|
|
OSS_EXISTS="${{ steps.check-oss.outcome == 'success' }}"
|
|
|
|
echo "EE exists: $EE_EXISTS"
|
|
echo "OSS exists: $OSS_EXISTS"
|
|
|
|
# Build only if artifacts don't exist for this commit hash
|
|
# Since we build by hash, if artifacts exist for this hash, we don't need to rebuild
|
|
if [[ "$EE_EXISTS" == "false" ]] || [[ "$OSS_EXISTS" == "false" ]]; then
|
|
SHOULD_BUILD="true"
|
|
echo "Will build: ee_exists=$EE_EXISTS, oss_exists=$OSS_EXISTS"
|
|
else
|
|
SHOULD_BUILD="false"
|
|
echo "Skipping build: artifacts exist for this commit hash"
|
|
fi
|
|
|
|
echo "should_build=$SHOULD_BUILD" >> $GITHUB_OUTPUT
|
|
|
|
# if this is on a release branch, we need to check the build requirements
|
|
get-build-requirements:
|
|
if: |
|
|
!cancelled() &&
|
|
contains(github.ref, 'release-x')
|
|
runs-on: ubuntu-22.04
|
|
timeout-minutes: 10
|
|
outputs:
|
|
java_version: ${{ fromJson(steps.dependencies.outputs.result).java_version }}
|
|
node_version: ${{ fromJson(steps.dependencies.outputs.result).node_version }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
sparse-checkout: |
|
|
release
|
|
.github
|
|
- name: Prepare release scripts
|
|
uses: ./.github/actions/prepare-release-scripts
|
|
- name: Get build dependencies
|
|
uses: actions/github-script@v7
|
|
id: dependencies
|
|
with:
|
|
script: | # js
|
|
const { getBuildRequirements, getVersionFromReleaseBranch } = require('${{ github.workspace }}/release/dist/index.cjs');
|
|
|
|
const version = getVersionFromReleaseBranch('${{ github.ref }}');
|
|
const requirements = getBuildRequirements(version);
|
|
|
|
return {
|
|
java_version: requirements.java,
|
|
node_version: requirements.node,
|
|
};
|
|
|
|
|
|
build:
|
|
needs:
|
|
[check-existing-artifacts, get-build-requirements]
|
|
if: always() && !cancelled() && needs.check-existing-artifacts.outputs.should_build == 'true' && (needs.get-build-requirements.result == 'success' || needs.get-build-requirements.result == 'skipped')
|
|
name: Build MB ${{ matrix.edition }}
|
|
runs-on: ubuntu-22.04
|
|
timeout-minutes: 15
|
|
strategy:
|
|
matrix:
|
|
edition: ["ee", "oss"]
|
|
env:
|
|
MB_EDITION: ${{ matrix.edition }}
|
|
INTERACTIVE: false
|
|
SKIP_LICENSES: ${{ github.event_name == 'pull_request' }} # faster builds for dev
|
|
steps:
|
|
- name: Check out the code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.inputs.commit }}
|
|
- name: Prepare front-end environment
|
|
uses: ./.github/actions/prepare-frontend
|
|
with:
|
|
node-version: "${{ needs.get-build-requirements.outputs.node_version || '22' }}"
|
|
- name: Prepare back-end environment
|
|
uses: ./.github/actions/prepare-backend
|
|
with:
|
|
java-version: "${{ needs.get-build-requirements.outputs.java_version || 21 }}"
|
|
- name: Build
|
|
run: ./bin/build.sh
|
|
- name: Prepare uberjar artifact
|
|
uses: ./.github/actions/prepare-uberjar-artifact
|
|
with:
|
|
edition: ${{ matrix.edition }}
|
|
|
|
check-jar-health:
|
|
runs-on: ubuntu-22.04
|
|
name: Is ${{ matrix.edition }} (java ${{ matrix.java-version }}) healthy?
|
|
needs: [build, check-existing-artifacts]
|
|
# We only care about the explicit JAR health check on push to `master` and the `release-` branches.
|
|
# JARs created in random branches on PRs are 99% of the time treated as ephemeral, and used only in e2e tests.
|
|
# E2E tests already have a step where they wait for the instance health check.
|
|
if: |
|
|
always() && !cancelled() &&
|
|
(github.ref_name == 'master' || startsWith(github.ref_name, 'release-')) &&
|
|
(needs.build.result == 'success' || (needs.check-existing-artifacts.outputs.should_build == 'false' && needs.check-existing-artifacts.outputs.ee_exists == 'true' && needs.check-existing-artifacts.outputs.oss_exists == 'true'))
|
|
timeout-minutes: 10
|
|
strategy:
|
|
matrix:
|
|
edition: ["ee", "oss"]
|
|
java-version: [21]
|
|
steps:
|
|
- name: Check out the code
|
|
uses: actions/checkout@v4
|
|
- name: Prepare JRE (Java Run-time Environment)
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-package: jre
|
|
java-version: ${{ matrix.java-version }}
|
|
distribution: "temurin"
|
|
- run: java -version
|
|
- name: Retrieve uberjar artifact
|
|
uses: ./.github/actions/fetch-artifact
|
|
with:
|
|
commit: ${{ github.event.inputs.commit || github.event.pull_request.head.sha || github.sha }}
|
|
edition: ${{ matrix.edition }}
|
|
- name: Verify license files are present in uberjar
|
|
run: |
|
|
echo "Checking for license files in uberjar..."
|
|
unzip -l ./metabase.jar | grep -q "license-backend-third-party.txt" || (echo "ERROR: license-backend-third-party.txt not found in uberjar" && exit 1)
|
|
unzip -l ./metabase.jar | grep -q "license-frontend-third-party.txt" || (echo "ERROR: license-frontend-third-party.txt not found in uberjar" && exit 1)
|
|
echo "Both license files found in uberjar"
|
|
- name: Launch uberjar
|
|
run: >-
|
|
java --add-opens java.base/java.nio=ALL-UNNAMED -jar ./metabase.jar &
|
|
- name: Wait for Metabase to start
|
|
run: while ! curl 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
|