Merging for testing since this can't be tested without a merge to master
fix(ci): use --no-frozen-lockfile for docs deploy (pnpm migration)
The Build and Deploy Docs workflow ran `pnpm install --frozen-lockfile` and
failed on every master push after the pnpm migration:
[ERR_PNPM_OUTDATED_LOCKFILE] pnpm-lock.yaml is not up to date with
platform/core/package.json
- @ohif/ui (lockfile: workspace:*, manifest: 3.13.0-beta.90)
publish-version.mjs rewrites @ohif/* workspace deps from "workspace:*" to the
concrete release version and commits that bump to master, so the committed
manifests intentionally drift from pnpm-lock.yaml. Every CircleCI job already
passes --no-frozen-lockfile for exactly this reason (pnpm-workspace.yaml sets
frozenLockfile:true as the default); the docs workflow was the lone job still
using frozen and so broke the docs deploy.
Switch the docs install to --no-frozen-lockfile to match the rest of CI.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@
* fix(ci): write npm auth token to ~/.npmrc so publishes authenticate
NPM_PUBLISH wrote the registry auth token to ~/repo/.npmrc (the repo root),
but publish-package.mjs does process.chdir(packageDirectory) and runs
`npm publish` from inside each package (platform/ui, extensions/*, ...). npm
reads the project .npmrc from that package dir and the user .npmrc from
$HOME -- it never walks up to ~/repo/.npmrc -- so every publish failed with
ENEEDAUTH ("need auth ... requires you to be logged in").
publish-package.mjs catches and swallows per-package publish errors, so
NPM_PUBLISH still exited 0 and reported green; the breakage was silent. As a
result no @ohif/* package newer than 3.13.0-beta.89 (the last publish before
the pnpm migration) reached npm -- beta.90 and beta.91 are missing and the
beta dist-tag is stuck at beta.89.
Write the token to ~/.npmrc (npm per-user config, read regardless of cwd)
instead. This also stops clobbering the committed workspace-config .npmrc
(node-linker=hoisted) at the repo root, which the in-job pnpm install/build
relies on. Applied to all three auth steps for consistency.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(docker): copy preinstall.js before pnpm install in builder stage
The builder stage copies only the package.json manifests, runs
`pnpm install --no-frozen-lockfile`, and copies the rest of the source
afterward (for layer caching). But the root package.json defines a
"preinstall" lifecycle script (node preinstall.js) that pnpm runs at the
start of install -- before the source copy -- so the script file was absent
and install aborted:
. preinstall$ node preinstall.js
Error: Cannot find module '/usr/src/app/preinstall.js' (MODULE_NOT_FOUND)
ERROR: process "pnpm install --no-frozen-lockfile" did not complete
This surfaced once the .npmrc COPY fix (#6076) let the build advance past
the earlier COPY failure. preinstall.js is self-contained (it no-ops without
GITHUB_TOKEN and guards the AGENTS.md/CLAUDE.md symlink with existsSync), so
copying just the script into the early manifest layer is sufficient.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(build): declare postcss plugins in platform/app for Docker build
The shared root postcss.config.js (which platform/app re-exports) loads
postcss-import, postcss-preset-env, and cssnano, but none were declared in
platform/app or the root. They only reached node_modules by being hoisted
from platform/docs (postcss-import, postcss-preset-env) and transitively
(cssnano). The Docker image excludes platform/docs via .dockerignore and
libs/@cornerstonejs is not a workspace member, so under pnpm's stricter
node-linker=hoisted the app build failed to resolve the plugins:
Loading PostCSS "postcss-preset-env" plugin failed:
Cannot find module 'postcss-preset-env'
(The accompanying "Can't resolve assets/woff2/latin.woff2" error was a
cascade from the broken PostCSS chain and clears with this fix.)
Declare the three plugins the config explicitly loads as devDependencies of
platform/app, pinned to the versions already resolved by working builds
(postcss-import@14.1.0, postcss-preset-env@7.8.3, cssnano@5.1.15), so the
build no longer depends on incidental hoisting from docs.
The lockfile was regenerated against a workspace:* baseline so the only
@ohif change is none -- the diff adds just the postcss plugin trees, keeping
specifiers at workspace:* per the repo's convention. Verified by building the
full Docker image locally: rspack compiles with 0 errors and the image
exports successfully.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
120 lines
5.1 KiB
YAML
120 lines
5.1 KiB
YAML
name: Build and Deploy Docs
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
|
|
env:
|
|
ACTIONS_STEP_DEBUG: true
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build-and-deploy-docs:
|
|
timeout-minutes: 60
|
|
runs-on: ubuntu-latest
|
|
# Need permissions to read actions and pull requests
|
|
permissions:
|
|
actions: read
|
|
contents: read
|
|
pull-requests: read
|
|
steps:
|
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
with:
|
|
persist-credentials: false
|
|
- uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
|
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
with:
|
|
node-version: 24
|
|
cache: pnpm
|
|
|
|
- name: Configure git for private repos
|
|
run: git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@github.com/".insteadOf ssh://git@github.com/
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install dependencies
|
|
# Use --no-frozen-lockfile to match every CircleCI job. The release flow
|
|
# (publish-version.mjs) rewrites @ohif/* workspace deps from "workspace:*"
|
|
# to the concrete version and commits that bump to master, which leaves
|
|
# pnpm-lock.yaml out of sync with the manifests. pnpm-workspace.yaml sets
|
|
# frozenLockfile:true, so a master-triggered install must opt out or it
|
|
# fails with ERR_PNPM_OUTDATED_LOCKFILE.
|
|
run: pnpm install --no-frozen-lockfile
|
|
|
|
# Removed Playwright tests and coverage generation steps
|
|
|
|
- name: Find PR and associated workflow run
|
|
id: find_pr_run
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
MERGE_COMMIT_SHA: ${{ github.sha }}
|
|
run: |
|
|
# Find the PR associated with the merge commit SHA
|
|
# Note: This relies on the merge commit being directly pushed to main
|
|
PR_DATA=$(gh pr list --state merged --search "$MERGE_COMMIT_SHA" --json number,headRefOid --jq '.[0]')
|
|
if [ -z "$PR_DATA" ]; then
|
|
echo "::warning::Could not find merged PR for commit $MERGE_COMMIT_SHA. Skipping coverage embedding."
|
|
echo "coverage_found=false" >> $GITHUB_OUTPUT
|
|
exit 0
|
|
fi
|
|
PR_HEAD_SHA=$(echo "$PR_DATA" | jq -r '.headRefOid')
|
|
PR_NUMBER=$(echo "$PR_DATA" | jq -r '.number')
|
|
echo "Found PR Number: $PR_NUMBER"
|
|
echo "Found PR Head SHA: $PR_HEAD_SHA"
|
|
|
|
# Find the latest *successful* playwright.yml run for the PR head commit so we
|
|
# never embed coverage from a failed/incomplete run.
|
|
RUN_ID=$(gh run list --workflow playwright.yml --commit "$PR_HEAD_SHA" --event pull_request --status success --json databaseId --jq '.[0].databaseId')
|
|
|
|
if [ -z "$RUN_ID" ]; then
|
|
echo "::warning::Could not find a successful 'playwright.yml' run for PR $PR_NUMBER (Head SHA: $PR_HEAD_SHA). Skipping coverage embedding."
|
|
echo "coverage_found=false" >> $GITHUB_OUTPUT
|
|
exit 0
|
|
fi
|
|
echo "Found Run ID: $RUN_ID"
|
|
echo "run_id=$RUN_ID" >> $GITHUB_OUTPUT
|
|
echo "coverage_found=true" >> $GITHUB_OUTPUT
|
|
|
|
- name: Download coverage artifact from PR run
|
|
if: steps.find_pr_run.outputs.coverage_found == 'true'
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
mkdir -p ./coverage-artifact
|
|
gh run download ${{ steps.find_pr_run.outputs.run_id }} -n coverage-report-pr --dir ./coverage-artifact
|
|
# Verify the artifact contains an HTML coverage report rather than checking a single asset
|
|
if [ -z "$(ls -A ./coverage-artifact)" ] || ! ls ./coverage-artifact/*.html >/dev/null 2>&1; then
|
|
echo "Failed to download or find an HTML coverage report in artifact 'coverage-report-pr' from run ${{ steps.find_pr_run.outputs.run_id }}."
|
|
exit 1
|
|
fi
|
|
echo "Artifact downloaded successfully."
|
|
|
|
- name: Copy coverage to docs static directory
|
|
if: steps.find_pr_run.outputs.coverage_found == 'true'
|
|
run: |
|
|
# Copy files from the downloaded artifact directory
|
|
mkdir -p platform/docs/static/coverage
|
|
cp -r ./coverage-artifact/* platform/docs/static/coverage/
|
|
# Copy specific asset files from the downloaded artifact root to static root
|
|
cp ./coverage-artifact/base.css platform/docs/static/
|
|
cp ./coverage-artifact/block-navigation.js platform/docs/static/
|
|
cp ./coverage-artifact/prettify.css platform/docs/static/
|
|
cp ./coverage-artifact/prettify.js platform/docs/static/
|
|
cp ./coverage-artifact/favicon.png platform/docs/static/
|
|
cp ./coverage-artifact/sort-arrow-sprite.png platform/docs/static/
|
|
cp ./coverage-artifact/sorter.js platform/docs/static/
|
|
|
|
- name: Build docs
|
|
run: pnpm --filter ohif-docs run build
|
|
|
|
- name: Deploy to Netlify
|
|
run: |
|
|
cd platform/docs
|
|
npx netlify-cli deploy --dir=./build --prod
|
|
env:
|
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|