Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ build/*
Dockerfile
.dockerignore
node_modules/*
website/node_modules
website/dist
website/.astro
92 changes: 92 additions & 0 deletions .github/workflows/deploy-viewer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: viewer/deploy

# Publishes the Slim viewer to https://slim-app.web.app, built against the IDC
# public proxy. The website's "Open in Slim" links point here.
on:
push:
branches: [master]
paths:
- "src/**"
- "public/**"
- "index.html"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- "vite.config.ts"
- "tsconfig*.json"
- "scripts/**"
- ".github/workflows/deploy-viewer.yml"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: deploy-viewer-${{ github.ref }}
cancel-in-progress: true

jobs:
deploy:
name: "Deploy the viewer"
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Setup pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9

- name: Setup Node.js
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: 24
cache: pnpm

# A git-hosted dicom-microscopy-viewer runs a nested install that ignores
# this workspace's allowBuilds.
- name: Allow dependency build scripts
run: pnpm config set strict-dep-builds false --global

- name: Install dependencies
# Install without lifecycle scripts, then rebuild only the packages that
# need prepare (dicom-microscopy-viewer dist/).
run: |
set -euo pipefail
pnpm install --frozen-lockfile --ignore-scripts
pnpm rebuild dicom-microscopy-viewer core-js-pure
if [ ! -f "node_modules/dicom-microscopy-viewer/dist/dynamic-import/dicomMicroscopyViewer.min.js" ]; then
(cd node_modules/dicom-microscopy-viewer && pnpm run build)
fi

- name: Require preview DICOMweb URL
env:
SLIM_PREVIEW_DICOMWEB_URL: ${{ secrets.SLIM_PREVIEW_DICOMWEB_URL }}
run: |
if [ -z "${SLIM_PREVIEW_DICOMWEB_URL}" ]; then
echo "::error::Set Actions secret SLIM_PREVIEW_DICOMWEB_URL (the IDC proxy, read by public/config/preview.js)."
exit 1
fi

- name: Build
env:
REACT_APP_CONFIG: preview
PUBLIC_URL: /
SLIM_PREVIEW_DICOMWEB_URL: ${{ secrets.SLIM_PREVIEW_DICOMWEB_URL }}
run: pnpm run build

# The Firebase CLI skips gitignored directories, and the build output is
# gitignored, so the deploy runs from a copy outside the checkout.
- name: Stage the deploy
run: |
mkdir -p "$RUNNER_TEMP/viewer"
cp -R build "$RUNNER_TEMP/viewer/build"
jq '.hosting.site = "slim-app"' firebase.json > "$RUNNER_TEMP/viewer/firebase.json"

- name: Deploy to Firebase
uses: FirebaseExtended/action-hosting-deploy@500ac625ca2dd40cbd15f7659af953801858032a # v0.11.0
with:
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_SLIM }}"
projectId: slim-website
entryPoint: ${{ runner.temp }}/viewer
channelId: live
123 changes: 123 additions & 0 deletions .github/workflows/deploy-website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: website/deploy

on:
# feat/slim-modern-redesign is included while the website PR is stacked on the
# redesign branch; it can be dropped once the site is merged to master.
pull_request:
branches: [master, feat/slim-modern-redesign]
paths:
- "website/**"
- "src/styles/tokens.css"
- "src/components/ui/**"
- "src/components/slim/**"
- "docs/CHANGELOG.md"
- "CITATION.cff"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- ".github/workflows/deploy-website.yml"
push:
branches: [master, feat/slim-modern-redesign]
paths:
- "website/**"
- "src/styles/tokens.css"
- "src/components/ui/**"
- "src/components/slim/**"
- "docs/CHANGELOG.md"
- "CITATION.cff"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- ".github/workflows/deploy-website.yml"
workflow_dispatch:

concurrency:
group: deploy-website-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

env:
SITE_URL: https://slim-website.web.app

jobs:
build:
name: "Check and build the website"
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Setup pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9

- name: Setup Node.js
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: 24
cache: pnpm

- name: Install dependencies
# The site needs no dependency build scripts, and skipping them avoids
# building dicom-microscopy-viewer, which only the app uses.
run: pnpm install --frozen-lockfile --ignore-scripts --filter slim-website...

- name: Check
run: pnpm --filter slim-website run check

- name: Test
run: pnpm --filter slim-website run test

- name: Build
run: pnpm --filter slim-website run build

- name: Upload site
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: website-dist
path: website/dist
retention-days: 7

deploy:
name: "Deploy to Firebase"
needs: build
# Forked PRs cannot access the Firebase service account secret, so skip them.
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
checks: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Download site
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: website-dist
path: website/dist

- name: Deploy preview
if: github.event_name == 'pull_request'
uses: FirebaseExtended/action-hosting-deploy@500ac625ca2dd40cbd15f7659af953801858032a # v0.11.0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_SLIM }}"
projectId: slim-website
entryPoint: website
channelId: website-pr-${{ github.event.pull_request.number }}

- name: Deploy to live
if: github.event_name != 'pull_request'
uses: FirebaseExtended/action-hosting-deploy@500ac625ca2dd40cbd15f7659af953801858032a # v0.11.0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_SLIM }}"
projectId: slim-website
entryPoint: website
channelId: live
10 changes: 10 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,13 @@ jobs:

- name: Test
run: pnpm run test

# The website shares tokens and components with the app, so app changes can break it
- name: Website check
run: pnpm --filter slim-website run check

- name: Website test
run: pnpm --filter slim-website run test

- name: Website build
run: pnpm --filter slim-website run build
58 changes: 58 additions & 0 deletions .github/workflows/website-idc-examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: website/verify-idc-examples

# The support matrix on the website links to public IDC series. IDC releases
# can retire or replace series, so check weekly that every link still resolves
# on the IDC proxy, and open an issue when one breaks or a new type appears.

on:
schedule:
- cron: "17 6 * * 1"
workflow_dispatch:

permissions:
contents: read
issues: write

jobs:
verify:
name: "Verify IDC examples"
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Setup Node.js
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: 24

- name: Verify examples against IDC
id: verify
# The script only uses Node built-ins, so no install is needed
env:
IDC_REPORT_PATH: ${{ runner.temp }}/idc-examples-report.md
run: node website/scripts/find-idc-examples.mjs --verify

- name: Open or update an issue
if: failure() && steps.verify.outcome == 'failure'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPORT_PATH: ${{ runner.temp }}/idc-examples-report.md
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
TITLE="Website: IDC examples in the support matrix need attention"
{
if [ -f "${REPORT_PATH}" ]; then cat "${REPORT_PATH}"; else echo "The check failed before writing a report."; fi
echo
echo "Run \`pnpm --filter slim-website find-idc-examples\` to pick new examples, then commit \`website/src/data/idc-examples.json\`."
echo
echo "Workflow run: ${RUN_URL}"
} > "${RUNNER_TEMP}/issue-body.md"
EXISTING=$(gh issue list --state open --search "in:title \"${TITLE}\"" --json number --jq '.[0].number // empty')
if [ -n "${EXISTING}" ]; then
gh issue comment "${EXISTING}" --body-file "${RUNNER_TEMP}/issue-body.md"
else
gh issue create --title "${TITLE}" --body-file "${RUNNER_TEMP}/issue-body.md"
fi
6 changes: 5 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
"useIgnoreFile": true
},
"files": {
"includes": ["src/**/*.{ts,tsx,js,jsx}", "!src/__mocks__"]
"includes": [
"src/**/*.{ts,tsx,js,jsx}",
"!src/__mocks__",
"website/**/*.{ts,tsx,mjs}"
]
},
"formatter": {
"enabled": true,
Expand Down
Loading
Loading