Skip to content
Merged
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
144 changes: 95 additions & 49 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,73 +4,83 @@ on:
push:
tags:
- v*.*.*
workflow_dispatch:
inputs:
server_image_tag:
description: Server image tag to package. Defaults to the release tag.
required: false
server_image_digest:
description: Optional server image digest. Overrides the tag when set.
required: false
neuroglancer_plugin_tag:
description: Neuroglancer plugin release tag. Defaults to the production pin.
required: false
default: v1.0.0
neuroglancer_plugin_artifact:
description: Neuroglancer plugin artifact name. Defaults to the production pin.
required: false
default: release.zip
autoseg_plugin_tag:
description: Automatic segmentation plugin release tag. Defaults to the production pin.
required: false
default: v0.4.0-beta
autoseg_cpu_plugin_artifact:
description: CPU automatic segmentation plugin artifact name. Defaults to the production pin.
required: false
default: auto-segmentation-v0.4.0-beta-cpu.zip
autoseg_cuda_plugin_artifact:
description: CUDA automatic segmentation plugin artifact name. Defaults to the production pin.
required: false
default: auto-segmentation-v0.4.0-beta-cuda.zip

env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GH_TOKEN: "${{ secrets.OUROBOROS_RELEASE_ASSET_TOKEN || secrets.GITHUB_TOKEN }}"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

jobs:
release:
build-packages:
runs-on: ${{ matrix.os }}

permissions:
contents: write
contents: read

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
package:
- flavor: core
- flavor: with-plugins-cpu
- flavor: with-plugins-cuda

steps:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install PostgreSQL development headers (Mac)
if: matrix.os == 'macos-latest'
run: brew install postgresql

- name: Install Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: '2.1.3'

- name: Install Dependencies
working-directory: ./python
run: poetry install

- name: Build Wheel
working-directory: ./python
run: poetry build

- name: Copy Python Server Executable Mac or Linux
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: |
mkdir -p ./extra-resources/server/dist/
cp -r ./python/dist/* ./extra-resources/server/dist/
cp ./python/Dockerfile-prod ./extra-resources/server/Dockerfile
cp ./python/compose.yml ./extra-resources/server/compose.yml

- name: Copy Python Server Executable Windows
if: matrix.os == 'windows-latest'
run: |
New-Item -Path ./extra-resources/server/dist/ -ItemType Directory -Force
Copy-Item -Path ./python/dist/* -Destination ./extra-resources/server/dist/ -Recurse
Copy-Item -Path ./python/Dockerfile-prod -Destination ./extra-resources/server/Dockerfile
Copy-Item -Path ./python/compose.yml -Destination ./extra-resources/server/compose.yml
shell: powershell
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 24

- name: Install Dependencies
run: npm install

- name: Prepare registry-backed server resources
run: npm run prepare:production-server
env:
OUROBOROS_SERVER_IMAGE_TAG: ${{ github.event.inputs.server_image_tag || github.ref_name }}
OUROBOROS_SERVER_IMAGE_DIGEST: ${{ github.event.inputs.server_image_digest }}

- name: Prepare production package flavor
run: npm run prepare:package-flavor
env:
OUROBOROS_PACKAGE_FLAVOR: ${{ matrix.package.flavor }}
OUROBOROS_NEUROGLANCER_PLUGIN_TAG: ${{ github.event.inputs.neuroglancer_plugin_tag || 'v1.0.0' }}
OUROBOROS_NEUROGLANCER_PLUGIN_ARTIFACT: ${{ github.event.inputs.neuroglancer_plugin_artifact }}
OUROBOROS_AUTOSEG_PLUGIN_TAG: ${{ github.event.inputs.autoseg_plugin_tag || 'v0.4.0-beta' }}
OUROBOROS_AUTOSEG_CPU_PLUGIN_ARTIFACT: ${{ github.event.inputs.autoseg_cpu_plugin_artifact }}
OUROBOROS_AUTOSEG_CUDA_PLUGIN_ARTIFACT: ${{ github.event.inputs.autoseg_cuda_plugin_artifact }}

- name: build-linux
if: matrix.os == 'ubuntu-latest'
run: npm run build:linux
Expand All @@ -83,11 +93,17 @@ jobs:
if: matrix.os == 'windows-latest'
run: npm run build:win

- name: release
uses: softprops/action-gh-release@v1
- name: Add package flavor to artifact names
run: npm run rename:release-artifacts
env:
OUROBOROS_PACKAGE_FLAVOR: ${{ matrix.package.flavor }}

- name: Upload release artifacts
uses: actions/upload-artifact@v4
with:
draft: true
files: |
name: ${{ matrix.os }}-${{ matrix.package.flavor }}-release-assets
if-no-files-found: error
path: |
dist/*.exe
dist/*.zip
dist/*.dmg
Expand All @@ -98,3 +114,33 @@ jobs:
dist/*.tar.gz
dist/*.yml
dist/*.blockmap

release:
runs-on: ubuntu-latest
needs: build-packages

permissions:
contents: write

steps:
- name: Download release artifacts
uses: actions/download-artifact@v4
with:
path: release-assets
merge-multiple: true

- name: Publish draft release
uses: softprops/action-gh-release@v1
with:
draft: true
files: |
release-assets/*.exe
release-assets/*.zip
release-assets/*.dmg
release-assets/*.AppImage
release-assets/*.snap
release-assets/*.deb
release-assets/*.rpm
release-assets/*.tar.gz
release-assets/*.yml
release-assets/*.blockmap
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ out
*.log*
documentation/site
extra-resources
.package-plugin-artifacts
data
ignoreme.py
temp
62 changes: 62 additions & 0 deletions documentation/docs/development/production-package-flavors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Production package flavors

The release workflow builds three production package flavors for each supported
desktop runner:

- `core`: Ouroboros only, with the production server compose file pointing at
the registry-published server image.
- `with-plugins-cpu`: the core package plus bundled Neuroglancer and Automatic
Segmentation plugin artifacts. The automatic segmentation plugin uses its CPU
backend image.
- `with-plugins-cuda`: the core package plus bundled Neuroglancer and Automatic
Segmentation plugin artifacts. The automatic segmentation plugin uses its
CUDA backend image and Docker Compose GPU reservation.

Plugin flavors stage release artifacts into
`extra-resources/preinstalled-plugins` before Electron Builder runs. The app
installs those bundled plugin folders into the user plugin directory on startup,
so production packages can ship with plugins already available.

## Release inputs

Tag releases default the server image to the Ouroboros release tag and default
bundled plugins to explicit production pins. Manual workflow runs can override
these inputs:

- `server_image_tag` or `server_image_digest`
- `neuroglancer_plugin_tag` (default `v1.0.0`)
- `neuroglancer_plugin_artifact` (default `release.zip`)
- `autoseg_plugin_tag` (default `v0.4.0-beta`)
- `autoseg_cpu_plugin_artifact` (default `auto-segmentation-v0.4.0-beta-cpu.zip`)
- `autoseg_cuda_plugin_artifact` (default `auto-segmentation-v0.4.0-beta-cuda.zip`)

The current plugin pins are:

- Neuroglancer plugin: `ChengLabResearch/neuroglancer-plugin` tag `v1.0.0`,
asset `release.zip`
- Automatic segmentation plugin: `ChengLabResearch/ouroboros_autoseg_plugin`
tag `v0.4.0-beta`, assets `auto-segmentation-v0.4.0-beta-cpu.zip` and
`auto-segmentation-v0.4.0-beta-cuda.zip`

`extra-resources/package-flavor.json` records the selected package flavor,
server image metadata, and exact plugin release tag/artifact inputs. When a
plugin archive includes `plugin-release.json`, its release metadata is copied
into `package-flavor.json` as well.

If plugin release repositories are private, set
`OUROBOROS_RELEASE_ASSET_TOKEN` to a token that can read those release assets.
The workflow falls back to `GITHUB_TOKEN` when that secret is not set.

## Local checks

Prepare the core package resources with:

```sh
npm run prepare:production-server
OUROBOROS_PACKAGE_FLAVOR=core npm run prepare:package-flavor
```

Plugin flavors can be checked against local release zips by placing them in
`.package-plugin-artifacts` or setting `OUROBOROS_PLUGIN_ARTIFACT_DIR`.
Use `OUROBOROS_PACKAGE_FLAVOR=with-plugins-cpu` or
`OUROBOROS_PACKAGE_FLAVOR=with-plugins-cuda` to stage bundled plugin packages.
24 changes: 19 additions & 5 deletions documentation/docs/development/registry-server-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,29 @@ Both tags are produced from the same wheel artifact that the Dockerfile installs

## Release Compose Usage

Release packaging should prefer an immutable image tag when the corresponding image exists:
Release packaging uses `npm run prepare:production-server` to write
`extra-resources/server/compose.yml` and `extra-resources/server/server-image.json`.
For a tag build, the app package workflow sets:

```yaml
services:
ouroboros-server:
image: ghcr.io/chenglabresearch/ouroboros-server:v1.4.0
OUROBOROS_SERVER_IMAGE_TAG=v1.4.0
```

Keep the bundled wheel and `Dockerfile-prod` path available as a fallback until installers consistently ship a release-specific compose file. Development compose files should keep building locally from source so local edits do not depend on registry state.
The generated compose file preserves the production ports, `ouroboros-volume`
mount, `host.docker.internal` mapping, `OUR_ENV=docker`, and `shm_size` settings,
but uses `image:` instead of `build:`. Production first launch therefore pulls
the published GHCR image instead of building the server locally.

For digest-pinned packages, set:

```bash
OUROBOROS_SERVER_IMAGE_REPOSITORY=ghcr.io/chenglabresearch/ouroboros-server
OUROBOROS_SERVER_IMAGE_DIGEST=sha256:<digest>
npm run prepare:production-server
```

Development compose files still build locally from source so local edits do not
depend on registry state.

## Manual Runs

Expand Down
14 changes: 13 additions & 1 deletion documentation/docs/guide/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@

_Where are plugins installed? In the [appData](https://github.com/electron/electron/blob/main/docs/api/app.md#appgetpathname)/ouroboros folder. This folder is different on each OS._

### Preinstalled Production Plugins

Production packages can bundle plugin folders under
`extra-resources/preinstalled-plugins/<plugin-name>/`. On startup, Ouroboros
copies missing bundled plugins into the normal user-data plugin folder before it
loads plugins.

Bundled plugin installs are idempotent and version-aware. If a user already has
the same plugin installed, Ouroboros compares the `version` field in each
plugin's `package.json`; it upgrades only when the bundled version is newer and
skips existing installs that are current, newer, or not safely comparable.

### Creating a Plugin

See the [template README](https://github.com/ChengLabResearch/ouroboros/blob/main/plugins/plugin-template/README.md) for more information.
See the [template README](https://github.com/ChengLabResearch/ouroboros/blob/main/plugins/plugin-template/README.md) for more information.
1 change: 1 addition & 0 deletions documentation/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ nav:
- Plugins: https://github.com/ChengLabResearch/ouroboros/blob/main/plugins/plugin-template/README.md
- Docker Builds: 'development/docker-builds.md'
- Registry Server Images: 'development/registry-server-images.md'
- Production Package Flavors: 'development/production-package-flavors.md'
- Releases: 'https://github.com/ChengLabResearch/ouroboros/releases'
- Repository: https://github.com/ChengLabResearch/ouroboros

Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"start": "electron-vite preview",
"dev": "electron-vite dev",
"build": "npm run typecheck && electron-vite build",
"prepare:production-server": "node scripts/prepare-production-server.mjs",
"prepare:package-flavor": "node scripts/prepare-package-flavor.mjs",
"rename:release-artifacts": "node scripts/rename-release-artifacts.mjs",
"postinstall": "electron-builder install-app-deps",
"build:unpack": "npm run build && electron-builder --dir",
"build:win": "electron-vite build && electron-builder --win --config --publish never",
Expand Down
Loading
Loading