Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

fix(ci): speed up checks and fix Workshop publication (#7138)

Thomas42add2609aa7
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d3d9ce861..334cc79f9 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -51,35 +51,29 @@ env:
jobs:
database-validation:
name: Database validation
- if: github.event_name != 'pull_request_target' && (github.event_name != 'release' || startsWith(github.event.release.tag_name, 'v2.')) && (github.event_name != 'workflow_dispatch' || inputs.operation != 'cleanup')
+ if: github.event_name != 'pull_request_target' && (github.event_name != 'workflow_dispatch' || inputs.operation != 'cleanup')
uses: ./.github/workflows/database.yml
- fast-gate:
- name: Fast gate
- needs: database-validation
- if: ${{ !cancelled() && github.event_name != 'pull_request_target' && (github.event_name != 'release' || startsWith(github.event.release.tag_name, 'v2.')) && (github.event_name != 'workflow_dispatch' || inputs.operation != 'cleanup') }}
+ validation-plan:
+ name: Plan affected checks
+ if: github.event_name != 'pull_request_target' && (github.event_name != 'workflow_dispatch' || inputs.operation != 'cleanup')
runs-on: ubuntu-latest
- timeout-minutes: 20
+ timeout-minutes: 5
+ outputs:
+ build-tasks: ${{ steps.plan.outputs.build-tasks }}
+ builds-app: ${{ steps.plan.outputs.builds-app }}
+ typecheck-matrix: ${{ steps.plan.outputs.typecheck-matrix }}
+ has-typechecks: ${{ steps.plan.outputs.has-typechecks }}
env:
- TURBO_API: ${{ secrets.TURBO_API }}
- TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
- TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
- TURBO_REMOTE_CACHE_SIGNATURE_KEY: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
TURBO_SCM_BASE: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before || 'HEAD~1' }}
TURBO_SCM_HEAD: ${{ github.sha }}
steps:
- - name: Require database validation
- env:
- DATABASE_RESULT: ${{ needs.database-validation.result }}
- run: test "$DATABASE_RESULT" = success
-
- uses: actions/checkout@v7
if: "!env.ACT"
with:
fetch-depth: 0
persist-credentials: false
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || '' }}
-
- name: Validate manual inputs
if: github.event_name == 'workflow_dispatch' && inputs.operation == 'publish'
env:
@@ -88,37 +82,141 @@ jobs:
run: |
test -n "$PR_NUMBER" || { echo "pr_number is required for publish"; exit 1; }
test -n "$BUILD_REF" || { echo "ref is required for publish"; exit 1; }
-
- name: Setup
uses: ./tooling/github/setup
- with:
- next-cache: "all"
- turbo-cache: "true"
-
- - name: Copy environment defaults
- run: cp .env.example .env
-
- - name: Lint, typecheck, and build workspaces
+ - name: Plan validation
+ id: plan
run: |
+ cp .env.example .env
scope=(--affected)
if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
scope=()
fi
- bun run turbo run lint typecheck build "${scope[@]}" --continue=dependencies-successful --concurrency=2
-
+ bun run turbo run typecheck build "${scope[@]}" --dry=json > "$RUNNER_TEMP/turbo-plan.json"
+ jq -r '
+ [.tasks[] | select(.command != null and .command != "" and .command != "<NONEXISTENT>")] as $tasks |
+ [$tasks[] | select(.task == "build") | .taskId] as $workspace |
+ ([$tasks[] | select(.task == "typecheck") | .taskId] | sort) as $typechecks |
+ {include: ($typechecks | to_entries | group_by(.key % 4) | map({
+ shard: (.[0].key % 4 + 1 | tostring), tasks: map(.value)
+ }))} as $matrix |
+ "build-tasks=\($workspace | tojson)",
+ "builds-app=\($workspace | index("@homarr/nextjs#build") != null)",
+ "typecheck-matrix=\($matrix | tojson)",
+ "has-typechecks=\($typechecks | length > 0)"
+ ' "$RUNNER_TEMP/turbo-plan.json" >> "$GITHUB_OUTPUT"
+
+ workspace-checks:
+ name: Lint and build
+ needs: validation-plan
+ runs-on: ubuntu-latest
+ timeout-minutes: 20
+ env:
+ TURBO_API: ${{ secrets.TURBO_API }}
+ TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
+ TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
+ TURBO_REMOTE_CACHE_SIGNATURE_KEY: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
+ steps:
+ - uses: actions/checkout@v7
+ if: "!env.ACT"
+ with:
+ fetch-depth: 0
+ persist-credentials: false
+ ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || '' }}
+ - name: Setup
+ uses: ./tooling/github/setup
+ with:
+ next-cache: "all"
+ turbo-cache: "true"
+ - name: Lint changed files
+ env:
+ BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }}
+ run: |
+ if [[ -n "$BASE_SHA" ]] && git cat-file -e "$BASE_SHA^{commit}" 2>/dev/null &&
+ git diff --quiet "$BASE_SHA...HEAD" -- '.oxlintrc*' '**/.oxlintrc*' '**/oxlint.config.*' \
+ package.json '**/package.json' bun.lock bunfig.toml patches tooling/typescript '**/tsconfig*.json'; then
+ git diff --name-only --diff-filter=ACMR -z "$BASE_SHA...HEAD" -- \
+ '*.js' '*.jsx' '*.mjs' '*.cjs' '*.ts' '*.tsx' '*.mts' '*.cts' \
+ | xargs -0 -r bun x oxlint --no-error-on-unmatched-pattern --
+ else
+ bun run turbo run lint --continue=dependencies-successful --concurrency=2
+ fi
+ - name: Build selected workspaces
+ env:
+ TASKS: ${{ needs.validation-plan.outputs.build-tasks }}
+ run: |
+ cp .env.example .env
+ mapfile -t tasks < <(node -e 'for (const task of JSON.parse(process.env.TASKS)) console.log(task)')
+ if [[ ${#tasks[@]} -gt 0 ]]; then
+ bun run turbo run "${tasks[@]}" --continue=dependencies-successful --concurrency=2
+ fi
- name: Validate workspace configuration
run: bun run lint:ws
-
- name: Validate Custom Widget architecture
run: bun run check:custom-widgets
-
- name: Validate checked-in OpenAPI schema
run: bun run check:openapi
-
- name: Validate Custom Widget bundle budget
+ if: needs.validation-plan.outputs.builds-app == 'true'
+ run: bun run check:custom-widget-bundle
+
+ typecheck:
+ name: Typecheck (${{ matrix.shard }})
+ needs: validation-plan
+ if: needs.validation-plan.outputs.has-typechecks == 'true'
+ strategy:
+ fail-fast: false
+ matrix: ${{ fromJSON(needs.validation-plan.outputs.typecheck-matrix) }}
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+ env:
+ TURBO_API: ${{ secrets.TURBO_API }}
+ TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
+ TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
+ TURBO_REMOTE_CACHE_SIGNATURE_KEY: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
+ steps:
+ - uses: actions/checkout@v7
+ if: "!env.ACT"
+ with:
+ persist-credentials: false
+ ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || '' }}
+ - name: Setup
+ uses: ./tooling/github/setup
+ with:
+ turbo-cache: "true"
+ typecheck-cache: "true"
+ typecheck-cache-scope: ${{ matrix.shard }}
+ - name: Typecheck selected workspaces
+ env:
+ TASKS: ${{ toJSON(matrix.tasks) }}
+ run: |
+ cp .env.example .env
+ mapfile -t tasks < <(node -e 'for (const task of JSON.parse(process.env.TASKS)) console.log(task)')
+ bun run turbo run "${tasks[@]}" --continue=dependencies-successful --concurrency=1
+
+ fast-gate:
+ name: Fast gate
+ needs: [database-validation, validation-plan, workspace-checks, typecheck]
+ if: ${{ !cancelled() && github.event_name != 'pull_request_target' && (github.event_name != 'workflow_dispatch' || inputs.operation != 'cleanup') }}
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ steps:
+ - name: Require all validation jobs
+ env:
+ DATABASE_RESULT: ${{ needs.database-validation.result }}
+ PLAN_RESULT: ${{ needs.validation-plan.result }}
+ WORKSPACE_RESULT: ${{ needs.workspace-checks.result }}
+ TYPECHECK_RESULT: ${{ needs.typecheck.result }}
+ HAS_TYPECHECKS: ${{ needs.validation-plan.outputs.has-typechecks }}
run: |
- bun run turbo run build --filter=@homarr/nextjs
- bun run check:custom-widget-bundle
+ test "$DATABASE_RESULT" = success
+ test "$PLAN_RESULT" = success
+ test "$WORKSPACE_RESULT" = success
+ if [[ "$HAS_TYPECHECKS" == true ]]; then
+ test "$TYPECHECK_RESULT" = success
+ else
+ test "$TYPECHECK_RESULT" = skipped
+ fi
container:
name: Container and migration smoke
@@ -345,7 +443,7 @@ jobs:
permissions:
contents: read
packages: write
- pull-requests: read
+ pull-requests: write
env:
PREVIEW_TAG: ${{ github.event_name == 'push' && 'v2' || format('pr-{0}', github.event.pull_request.number || inputs.pr_number) }}
steps:
@@ -407,6 +505,39 @@ jobs:
docker buildx imagetools inspect "$image"
done
+ - name: Comment with preview image
+ if: github.event_name == 'pull_request' && !env.ACT
+ uses: actions/github-script@v8
+ with:
+ script: |
+ const marker = "<!-- homarr-preview-image -->";
+ const image = `${process.env.PREVIEW_IMAGE}:${process.env.PREVIEW_TAG}`;
+ const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
+ const body = [
+ marker,
+ "**Homarr test image published**",
+ "",
+ `\`${image}\` — available for Linux amd64 and arm64.`,
+ "",
+ "```sh",
+ `docker pull ${image}`,
+ "```",
+ "",
+ `[Build details](${runUrl}) · Commit \`${context.sha.slice(0, 7)}\``,
+ "This comment updates when a new preview is published.",
+ ].join("\n");
+ const comments = await github.paginate(github.rest.issues.listComments, {
+ ...context.repo, issue_number: context.issue.number, per_page: 100,
+ });
+ const existing = comments.find((comment) =>
+ comment.user?.login === "github-actions[bot]" && comment.body?.includes(marker),
+ );
+ if (existing) {
+ await github.rest.issues.updateComment({ ...context.repo, comment_id: existing.id, body });
+ } else {
+ await github.rest.issues.createComment({ ...context.repo, issue_number: context.issue.number, body });
+ }
+
cleanup:
name: Clean up preview image
if: github.event_name == 'pull_request_target' || (github.event_name == 'workflow_dispatch' && inputs.operation == 'cleanup')
diff --git a/.github/workflows/database.yml b/.github/workflows/database.yml
index e414c3137..d39ae779d 100644
--- a/.github/workflows/database.yml
+++ b/.github/workflows/database.yml
@@ -12,6 +12,7 @@ env:
CI: "true"
SKIP_ENV_VALIDATION: "true"
TURBO_TELEMETRY_DISABLED: "1"
+ BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }}
jobs:
changes:
@@ -52,22 +53,8 @@ jobs:
fi
echo "migrations=$migrations" >> "$GITHUB_OUTPUT"
- journals:
- name: Migration journals
- needs: changes
- if: needs.changes.outputs.migrations == 'true'
- runs-on: ubuntu-latest
- timeout-minutes: 10
- steps:
- - uses: actions/checkout@v7
- if: "!env.ACT"
- with:
- persist-credentials: false
- - uses: ./tooling/github/setup
- - run: bun x vitest run --project db-node packages/db/test/migration-journal.spec.ts
-
migrations:
- name: SQLite and PostgreSQL migrations
+ name: Database checks
needs: changes
if: needs.changes.outputs.migrations == 'true'
runs-on: ubuntu-latest
@@ -76,28 +63,32 @@ jobs:
- uses: actions/checkout@v7
if: "!env.ACT"
with:
+ fetch-depth: 0
persist-credentials: false
- uses: ./tooling/github/setup
- - name: Reject retired database configuration
- run: bun x vitest run --project dom packages/core/src/infrastructure/db/env.spec.ts
- - run: bun x vitest run --project db-node --project integration packages/db/test/sqlite-migration.spec.ts packages/db/test/postgresql-migration.spec.ts packages/db/proxy-reader.integration.spec.ts --maxWorkers 1
+ - name: Check affected database tests
+ run: |
+ scope=()
+ if [[ -n "$BASE_SHA" ]]; then scope=(--changed "$BASE_SHA" --passWithNoTests); fi
+ bun x vitest run --project dom --project db-node --project integration \
+ packages/core/src/infrastructure/db/env.spec.ts packages/db/test/migration-journal.spec.ts \
+ packages/db/test/sqlite-migration.spec.ts packages/db/test/postgresql-migration.spec.ts \
+ packages/db/proxy-reader.integration.spec.ts --maxWorkers 1 "${scope[@]}"
database-gate:
name: Database gate
- needs: [changes, journals, migrations]
+ needs: [changes, migrations]
if: always()
runs-on: ubuntu-latest
steps:
- name: Require selected database checks
env:
CHANGES: ${{ needs.changes.result }}
- JOURNALS: ${{ needs.journals.result }}
MIGRATIONS: ${{ needs.migrations.result }}
RUN_MIGRATIONS: ${{ needs.changes.outputs.migrations }}
run: |
test "$CHANGES" = success
test "$RUN_MIGRATIONS" = true || test "$RUN_MIGRATIONS" = false
if [ "$RUN_MIGRATIONS" = true ]; then
- test "$JOURNALS" = success
test "$MIGRATIONS" = success
fi
diff --git a/.github/workflows/workshop.yml b/.github/workflows/workshop.yml
index a3b010b5f..a12066be3 100644
--- a/.github/workflows/workshop.yml
+++ b/.github/workflows/workshop.yml
@@ -1,12 +1,35 @@
name: Workshop
+# GitHub skips PR/push runs unless a listed path changed.
on:
pull_request:
+ types: [opened, synchronize, reopened, ready_for_review]
paths:
- ".github/workflows/workshop.yml"
- - "tooling/github/**"
+ - "tooling/github/docker-build.sh"
- "apps/workshop/**"
- - "apps/docs/**"
+ - "packages/workshop/**"
+ - "apps/docs/src/components/workshop/**"
+ - "apps/docs/src/components/custom-widget-code.tsx"
+ - "apps/docs/src/components/custom-widget-code-client.tsx"
+ - "apps/docs/src/components/ui/**"
+ - "apps/docs/src/components/carbon.tsx"
+ - "apps/docs/src/components/mdx/link.tsx"
+ - "apps/docs/src/hooks/use-color-mode.ts"
+ - "apps/docs/src/lib/utils.ts"
+ - "apps/docs/src/lib/analytics.ts"
+ - "apps/docs/src/app/(home)/workshop/**"
+ - "apps/docs/src/lib/workshop*"
+ - "apps/docs/src/lib/pocketbase.ts"
+ - "apps/docs/src/lib/runtime-config.ts"
+ - "apps/docs/public/workshop-runtime-config.js"
+ - "apps/docs/package.json"
+ - "apps/docs/next.config.mjs"
+ - "apps/docs/postcss.config.mjs"
+ - "apps/docs/source.config.ts"
+ - "apps/docs/tsconfig.json"
+ - "apps/docs/turbo.json"
+ - "apps/docs/scripts/validate-docs-coverage.ts"
- "packages/common/**"
- "packages/core/**"
- "packages/custom-widgets/**"
@@ -17,20 +40,24 @@ on:
- "packages/translation/**"
- "packages/ui/**"
- "packages/validation/**"
- - "packages/workshop/**"
- "tooling/typescript/**"
- "patches/**"
- "package.json"
- "bun.lock"
- "bunfig.toml"
- "turbo.json"
+ - "!**/*.md"
+ - "!**/*.mdx"
push:
- branches: [dev, main]
+ branches: [dev]
+ # The deployed image serves both Workshop and the docs site.
paths:
- ".github/workflows/workshop.yml"
- - "tooling/github/**"
+ - ".dockerignore"
+ - "tooling/github/docker-build.sh"
- "apps/workshop/**"
- "apps/docs/**"
+ - "tools/motion-reel/three/**"
- "packages/common/**"
- "packages/core/**"
- "packages/custom-widgets/**"
@@ -48,19 +75,63 @@ on:
- "bun.lock"
- "bunfig.toml"
- "turbo.json"
-
+ - "!packages/**/*.spec.ts"
+ - "!packages/**/*.spec.tsx"
+ - "!packages/**/*.test.ts"
+ - "!packages/**/*.test.tsx"
+ - "!packages/**/__tests__/**"
+ - "!packages/**/*.md"
+ - "!packages/db/migrations/seed.ts"
+ # Stable releases already include Semantic Release's version commit.
+ release:
+ types: [published]
workflow_dispatch:
permissions:
contents: read
concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
+ group: ${{ github.workflow }}-${{ github.event_name == 'release' && 'main' || github.event.pull_request.number || github.ref_name }}
cancel-in-progress: true
jobs:
+ validate:
+ if: |
+ (github.event_name != 'release' || !github.event.release.prerelease) &&
+ (github.event_name != 'workflow_dispatch' || github.ref_name == 'main' || github.ref_name == 'dev')
+ runs-on: ubuntu-24.04
+ timeout-minutes: 5
+ outputs:
+ sha: ${{ steps.image.outputs.sha }}
+ tags: ${{ steps.image.outputs.tags }}
+ publish: ${{ !env.ACT && (github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && !github.event.pull_request.draft)) }}
+ steps:
+ - uses: actions/checkout@v7
+ if: "!env.ACT"
+ with:
+ persist-credentials: false
+ - run: docker compose --env-file apps/workshop/.env.staging.example -f apps/workshop/docker-compose.staging.yml config --quiet
+ - name: Image tags
+ id: image
+ env:
+ PR_NUMBER: ${{ github.event.pull_request.number }}
+ RELEASE_TAG: ${{ github.event.release.tag_name }}
+ run: |
+ sha=$(git rev-parse HEAD)
+ tags=dev
+ if [[ "$GITHUB_EVENT_NAME" == pull_request ]]; then
+ tags="pr-$PR_NUMBER"
+ elif [[ "$GITHUB_EVENT_NAME" == release || "$GITHUB_REF_NAME" == main ]]; then
+ version=$(jq -r .version package.json)
+ [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
+ if [[ "$GITHUB_EVENT_NAME" == release ]]; then test "$RELEASE_TAG" = "v$version"; fi
+ tags="latest v$version v${version%%.*}"
+ fi
+ printf 'sha=%s\ntags=%s sha-%s\n' "$sha" "$tags" "$sha" >> "$GITHUB_OUTPUT"
+
production-smoke:
- if: github.event_name == 'pull_request'
+ needs: validate
+ if: github.event_name == 'pull_request' && needs.validate.outputs.publish != 'true'
name: Production image smoke (${{ matrix.arch }})
strategy:
fail-fast: false
@@ -77,6 +148,7 @@ jobs:
if: "!env.ACT"
with:
persist-credentials: false
+ ref: ${{ needs.validate.outputs.sha }}
- uses: actions/setup-node@v6
with:
node-version: 24.18.0
@@ -114,16 +186,8 @@ jobs:
TURBO_REMOTE_CACHE_SIGNATURE_KEY: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
run: sh apps/workshop/test-image.sh
- validate:
- runs-on: ubuntu-24.04
- timeout-minutes: 5
- steps:
- - uses: actions/checkout@v7
- if: "!env.ACT"
- - run: docker compose --env-file apps/workshop/.env.staging.example -f apps/workshop/docker-compose.staging.yml config --quiet
-
publish-amd64:
- if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref_name == 'dev' || github.ref_name == 'main')
+ if: needs.validate.outputs.publish == 'true'
needs: validate
runs-on: ubuntu-24.04
timeout-minutes: 20
@@ -135,6 +199,12 @@ jobs:
steps:
- uses: actions/checkout@v7
if: "!env.ACT"
+ with:
+ persist-credentials: false
+ ref: ${{ needs.validate.outputs.sha }}
+ - uses: actions/setup-node@v6
+ with:
+ node-version: 24.18.0
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
@@ -148,6 +218,7 @@ jobs:
file: apps/workshop/Dockerfile
target: production
platforms: linux/amd64
+ labels: org.opencontainers.image.revision=${{ needs.validate.outputs.sha }}
outputs: type=image,"name=ghcr.io/homarr-labs/workshop",push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha,scope=workshop-linux-amd64
cache-to: type=gha,scope=workshop-linux-amd64,mode=max
@@ -156,9 +227,13 @@ jobs:
TURBO_TEAM=${{ secrets.TURBO_TEAM }}
TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_CACHE_SIGNATURE_KEY=${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
+ - name: Exercise the candidate image
+ env:
+ WORKSHOP_IMAGE_TEST_IMAGE: ghcr.io/homarr-labs/workshop@${{ steps.build.outputs.digest }}
+ run: sh apps/workshop/test-image.sh
publish-arm64:
- if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref_name == 'dev' || github.ref_name == 'main')
+ if: needs.validate.outputs.publish == 'true'
needs: validate
runs-on: ubuntu-24.04-arm
timeout-minutes: 20
@@ -170,6 +245,12 @@ jobs:
steps:
- uses: actions/checkout@v7
if: "!env.ACT"
+ with:
+ persist-credentials: false
+ ref: ${{ needs.validate.outputs.sha }}
+ - uses: actions/setup-node@v6
+ with:
+ node-version: 24.18.0
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
@@ -183,6 +264,7 @@ jobs:
file: apps/workshop/Dockerfile
target: production
platforms: linux/arm64
+ labels: org.opencontainers.image.revision=${{ needs.validate.outputs.sha }}
outputs: type=image,"name=ghcr.io/homarr-labs/workshop",push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha,scope=workshop-linux-arm64
cache-to: type=gha,scope=workshop-linux-arm64,mode=max
@@ -191,15 +273,20 @@ jobs:
TURBO_TEAM=${{ secrets.TURBO_TEAM }}
TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_CACHE_SIGNATURE_KEY=${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
+ - name: Exercise the candidate image
+ env:
+ WORKSHOP_IMAGE_TEST_IMAGE: ghcr.io/homarr-labs/workshop@${{ steps.build.outputs.digest }}
+ run: sh apps/workshop/test-image.sh
publish:
- if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref_name == 'dev' || github.ref_name == 'main')
- needs: [publish-amd64, publish-arm64]
+ if: needs.validate.outputs.publish == 'true'
+ needs: [validate, publish-amd64, publish-arm64]
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read
packages: write
+ pull-requests: write
env:
WORKSHOP_IMAGE: ghcr.io/homarr-labs/workshop
steps:
@@ -209,41 +296,85 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- - name: Verify branch head before publication
+ - name: Verify source before publication
uses: actions/github-script@v8
+ env:
+ EXPECTED_SHA: ${{ needs.validate.outputs.sha }}
+ EXPECTED_PR_HEAD: ${{ github.event.pull_request.head.sha }}
with:
script: |
- const branchName = context.ref.replace("refs/heads/", "");
- const { data: branch } = await github.rest.repos.getBranch({
- owner: context.repo.owner,
- repo: context.repo.repo,
- branch: branchName,
- });
- if (branch.commit.sha !== context.sha) {
- core.setFailed(`Branch ${branchName} moved from ${context.sha} to ${branch.commit.sha}.`);
+ if (context.eventName === "pull_request") {
+ const { data: pull } = await github.rest.pulls.get({
+ ...context.repo, pull_number: context.payload.pull_request.number,
+ });
+ if (pull.state !== "open" || pull.draft || pull.head.sha !== process.env.EXPECTED_PR_HEAD) {
+ core.setFailed("PR closed, became a draft, or changed while building; refusing stale publication.");
+ }
+ return;
+ }
+ let branchName = context.ref.replace("refs/heads/", "");
+ if (context.eventName === "release") branchName = "main";
+ const { data: branch } = await github.rest.repos.getBranch({ ...context.repo, branch: branchName });
+ if (branch.commit.sha !== process.env.EXPECTED_SHA) {
+ core.setFailed("Branch changed while building; refusing stale publication.");
}
- name: Publish multi-platform image
env:
AMD64_DIGEST: ${{ needs.publish-amd64.outputs.digest }}
ARM64_DIGEST: ${{ needs.publish-arm64.outputs.digest }}
+ IMAGE_TAGS: ${{ needs.validate.outputs.tags }}
run: |
- tags=(-t "${WORKSHOP_IMAGE}:sha-${GITHUB_SHA}")
- if [[ "${GITHUB_REF_NAME}" == "dev" ]]; then
- tags+=(-t "${WORKSHOP_IMAGE}:dev")
- fi
- if [[ "${GITHUB_REF_NAME}" == "main" ]]; then
- tags+=(-t "${WORKSHOP_IMAGE}:latest" -t "${WORKSHOP_IMAGE}:v2")
- fi
+ tags=()
+ for tag in $IMAGE_TAGS; do tags+=(-t "${WORKSHOP_IMAGE}:$tag"); done
docker buildx imagetools create "${tags[@]}" \
"${WORKSHOP_IMAGE}@${AMD64_DIGEST}" \
"${WORKSHOP_IMAGE}@${ARM64_DIGEST}"
- - name: Verify multi-platform image
+ - name: Verify every published tag
+ env:
+ IMAGE_TAGS: ${{ needs.validate.outputs.tags }}
run: |
- image="${WORKSHOP_IMAGE}:sha-${GITHUB_SHA}"
- manifest="$(docker buildx imagetools inspect "$image" --raw)"
- for architecture in amd64 arm64; do
- jq --exit-status --arg architecture "$architecture" \
- 'any(.manifests[]; .platform.os == "linux" and .platform.architecture == $architecture)' \
- <<<"$manifest" >/dev/null
+ expected_manifest=""
+ for tag in $IMAGE_TAGS; do
+ image="${WORKSHOP_IMAGE}:$tag"
+ manifest="$(docker buildx imagetools inspect "$image" --raw)"
+ for architecture in amd64 arm64; do
+ jq --exit-status --arg architecture "$architecture" \
+ 'any(.manifests[]; .platform.os == "linux" and .platform.architecture == $architecture)' \
+ <<<"$manifest" >/dev/null
+ done
+ if [[ -n "$expected_manifest" ]]; then test "$manifest" = "$expected_manifest"; fi
+ expected_manifest="$manifest"
done
- docker buildx imagetools inspect "$image"
+
+ - name: Comment with preview image
+ if: github.event_name == 'pull_request' && !env.ACT
+ uses: actions/github-script@v8
+ with:
+ script: |
+ const marker = "<!-- workshop-preview-image -->";
+ const image = `${process.env.WORKSHOP_IMAGE}:pr-${context.issue.number}`;
+ const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
+ const body = [
+ marker,
+ "**Workshop preview image published**",
+ "",
+ `\`${image}\` — available for Linux amd64 and arm64.`,
+ "",
+ "```sh",
+ `docker pull ${image}`,
+ "```",
+ "",
+ `[Build details](${runUrl}) · Commit \`${context.sha.slice(0, 7)}\``,
+ "This comment updates when a new preview is published.",
+ ].join("\n");
+ const comments = await github.paginate(github.rest.issues.listComments, {
+ ...context.repo, issue_number: context.issue.number, per_page: 100,
+ });
+ const existing = comments.find((comment) =>
+ comment.user?.login === "github-actions[bot]" && comment.body?.includes(marker),
+ );
+ if (existing) {
+ await github.rest.issues.updateComment({ ...context.repo, comment_id: existing.id, body });
+ } else {
+ await github.rest.issues.createComment({ ...context.repo, issue_number: context.issue.number, body });
+ }
diff --git a/apps/docs/docs/advanced/development/workshop-operator.mdx b/apps/docs/docs/advanced/development/workshop-operator.mdx
index f0075b730..c706d618f 100644
--- a/apps/docs/docs/advanced/development/workshop-operator.mdx
+++ b/apps/docs/docs/advanced/development/workshop-operator.mdx
@@ -14,6 +14,10 @@ tags:
Workshop uses PocketBase. The production image serves the Workshop website and API from one origin and stores state in
`/pb_data`.
+Use `ghcr.io/homarr-labs/workshop:latest` for stable deployments or `:dev` for development builds.
+Workshop pull requests from the main repository publish `:pr-<number>` after validation; docs-only pull requests do not.
+Stable images also have `:v<major>` and `:v<version>` tags, such as `:v2` and `:v2.4.1`.
+
## Environment variables
| Variable | Purpose | Default |
@@ -81,7 +85,7 @@ fees can still apply to BYOK requests. Streaming responses include upstream toke
## Deployment
The Workshop image includes the documentation site. Use `ghcr.io/homarr-labs/workshop:latest` for stable builds from
-`main`, or `:dev` for development builds from `dev`. The `:v2` tag is a compatibility alias for stable builds.
+`main`, or `:dev` for development builds from `dev`. Pin `:v<major>` to stay on one stable major version.
Immutable `sha-<commit>` tags are preferable for promotion. The service listens on port 8090.
When using a reverse proxy, forward the complete hostname, including `/api`, `/_/`, and
diff --git a/tooling/github/setup/action.yml b/tooling/github/setup/action.yml
index a56b22be6..56a11c382 100644
--- a/tooling/github/setup/action.yml
+++ b/tooling/github/setup/action.yml
@@ -8,6 +8,12 @@ inputs:
turbo-cache:
description: Restore local Turbo artifacts when signed remote caching is not configured
default: "false"
+ typecheck-cache:
+ description: Reuse TypeScript incremental state when a Turbo task misses cache
+ default: "false"
+ typecheck-cache-scope:
+ description: Isolate incremental snapshots for parallel typecheck shards
+ default: "default"
runs:
using: composite
@@ -48,9 +54,20 @@ runs:
uses: actions/cache@v5
with:
path: .turbo/cache
- key: ${{ env.TURBO_PLATFORM }}-turbo-${{ github.job }}-${{ hashFiles('bun.lock') }}-${{ github.sha }}
+ key: ${{ env.TURBO_PLATFORM }}-turbo-${{ github.job }}-${{ inputs.typecheck-cache-scope }}-${{ hashFiles('bun.lock') }}-${{ github.sha }}
+ restore-keys: |
+ ${{ env.TURBO_PLATFORM }}-turbo-${{ github.job }}-${{ inputs.typecheck-cache-scope }}-${{ hashFiles('bun.lock') }}-
+
+ - name: Restore TypeScript incremental state
+ if: inputs.typecheck-cache == 'true' && !env.ACT
+ uses: actions/cache@v5
+ with:
+ path: |
+ apps/*/node_modules/.cache/tsbuildinfo.json
+ packages/*/node_modules/.cache/tsbuildinfo.json
+ key: ${{ env.TURBO_PLATFORM }}-typecheck-${{ inputs.typecheck-cache-scope }}-${{ hashFiles('bun.lock', 'tooling/typescript/**', 'apps/*/tsconfig*.json', 'packages/*/tsconfig*.json') }}-${{ github.sha }}
restore-keys: |
- ${{ env.TURBO_PLATFORM }}-turbo-${{ github.job }}-${{ hashFiles('bun.lock') }}-
+ ${{ env.TURBO_PLATFORM }}-typecheck-${{ inputs.typecheck-cache-scope }}-${{ hashFiles('bun.lock', 'tooling/typescript/**', 'apps/*/tsconfig*.json', 'packages/*/tsconfig*.json') }}-
- name: Restore application compiler cache
if: (inputs.next-cache == 'nextjs' || inputs.next-cache == 'all') && !env.ACT
diff --git a/turbo.json b/turbo.json
index de36402b4..06a25f702 100644
--- a/turbo.json
+++ b/turbo.json
@@ -49,7 +49,6 @@
"outputLogs": "new-only"
},
"lint": {
- "dependsOn": ["^topo"],
"inputs": ["$TURBO_DEFAULT$", "$TURBO_ROOT$/.oxlintrc.json"]
},
"typecheck": {
diff --git a/vitest.config.mts b/vitest.config.mts
index 653db645a..76afa553f 100644
--- a/vitest.config.mts
+++ b/vitest.config.mts
@@ -2,7 +2,7 @@ import react from "@vitejs/plugin-react";
import tsconfigPaths from "vite-tsconfig-paths";
import { configDefaults, defineConfig } from "vitest/config";
-// Docker-backed suites are opt-in through pnpm test:integration.
+// Docker-backed suites are opt-in through bun run test:integration.
const integrationTests = [
"**/*.integration.spec.ts",
"packages/db/test/postgresql-migration.spec.ts",
@@ -20,6 +20,22 @@ export default defineConfig({
test: {
setupFiles: ["./vitest.setup.ts"],
clearMocks: true,
+ // --changed follows imports; these runtime inputs also invalidate the selected tests.
+ forceRerunTriggers: [
+ ...configDefaults.forceRerunTriggers,
+ "**/{package.json,bun.lock,bunfig.toml,mise.toml}",
+ "**/{vitest,vite}.config.*",
+ "**/vitest.setup.*",
+ "**/tsconfig*.json",
+ "**/tooling/typescript/**",
+ "**/patches/**",
+ "**/packages/db/migrations/**",
+ "**/Dockerfile",
+ "**/scripts/{run,entrypoint}.sh",
+ "**/deployments/**",
+ "**/tooling/github/setup/**",
+ "**/.github/workflows/{ci,database,validate-docs}.yml",
+ ].map((pattern) => `${import.meta.dirname}/${pattern}`),
coverage: {
provider: "v8",
reporter: ["html", "json-summary", "json"],