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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
24 changes: 20 additions & 4 deletions .github/workflows/build-docker-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

env:
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
IMAGE_NAME: imswitch-noqt
IMAGE_NAME: imswitch
MAIN_BRANCH: 'master' # pushing to this branch will update the "edge" tag on the image
BETA_BRANCH: 'beta' # pushing to this branch will update the "beta" tag on the image
STABLE_BRANCH: 'stable' # pushing to this branch will update the "stable" tag on the image
Expand All @@ -30,9 +30,10 @@ env:
PUSH_IMAGE: ${{ github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'push tag' }}

jobs:
build-container-image:
build-ctr-img:
permissions:
contents: read
actions: read
packages: write
strategy:
fail-fast: false
Expand All @@ -51,6 +52,21 @@ jobs:
fetch-depth: 0
filter: 'blob:none'

- name: Wait for frontend to build
id: wait-build-frontend
uses: lucasssvaz/wait-on-workflow@v1
with:
workflow: build-frontend.yaml
sha: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Download built frontend
uses: actions/download-artifact@v5
with:
name: frontend
path: ./frontend/build
github-token: ${{github.token}}
run-id: ${{ steps.wait-build-frontend.outputs.run-id }}

# Work around a bug where capital letters in the GitHub username (e.g. "PlanktoScope") make it
# impossible to push to GHCR. See https://github.com/macbre/push-to-ghcr/issues/12
- name: Lowercase image registry and owner
Expand Down Expand Up @@ -116,13 +132,13 @@ jobs:
if-no-files-found: error
retention-days: 1

merge-container-images:
merge-ctr-imgs:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
needs:
- build-container-image
- build-ctr-img
steps:
- name: Download digests
uses: actions/download-artifact@v4
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/build-frontend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: build-frontend

on:
push:
branches:
- 'master'
- 'main'
tags:
- 'v*'
pull_request:
merge_group:
workflow_dispatch:
inputs:
git-ref:
description: 'Git ref (optional)'
required: false

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
# This repo has tons of cruft in its history, so we try to only fetch files we actually need:
fetch-depth: 0
filter: 'blob:none'

- name: Use cached ~/.npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ matrix.variant }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node

- name: Install build dependencies
working-directory: ./frontend
run: npm install

- name: Build
working-directory: ./frontend
run: |
export NODE_OPTIONS=--max_old_space_size=4096
CI=false npm run build

- name: Upload build output
uses: actions/upload-artifact@v4
with:
name: frontend
path: ./frontend/build
35 changes: 35 additions & 0 deletions .github/workflows/merge-gatekeeper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: merge-gatekeeper

on:
pull_request:
types:
- opened
- synchronize
- reopened
- auto_merge_enabled # needed for PRs opened via CI workflows without PATs
merge_group:

jobs:
merge-gatekeeper:
runs-on: ubuntu-latest
permissions:
checks: read
statuses: read
steps:
- name: Run Merge Gatekeeper
if: github.event_name != 'merge_group'
uses: upsidr/merge-gatekeeper@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
timeout: 900 # 15-minute timeout, since checks may take 8 minutes to run
interval: 15

- name: Run Merge Gatekeeper in Merge Queue
if: github.event_name == 'merge_group'
uses: upsidr/merge-gatekeeper@v1
with:
ref: ${{github.ref}}
token: ${{ secrets.GITHUB_TOKEN }}
timeout: 900 # 15-minute timeout, since checks may take 8 minutes to run
interval: 15
33 changes: 31 additions & 2 deletions .github/workflows/test-uv.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
name: test-uv

on:
push:
branches:
- 'master'
- 'main'
tags:
- 'v*'
pull_request:
merge_group:
workflow_dispatch:
inputs:
git-ref:
description: 'Git ref (optional)'
required: false

jobs:
test:
runs-on: ${{ matrix.os }}
permissions:
contents: read
actions: read
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest]
python-version: ["3.12", "3.13"]
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
Expand Down Expand Up @@ -73,6 +87,21 @@ jobs:
python -c "from imswitch.imcontrol.model import Options; print('Options import successful')" || echo "Options import failed"
shell: bash

- name: Wait for frontend to build
id: wait-build-frontend
uses: lucasssvaz/wait-on-workflow@v1
with:
workflow: build-frontend.yaml
sha: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Download built frontend
uses: actions/download-artifact@v5
with:
name: frontend
path: ./frontend/build
github-token: ${{github.token}}
run-id: ${{ steps.wait-build-frontend.outputs.run-id }}

- name: Run Unit Tests
run: |
# Run unit tests using --pyargs to find the installed package
Expand Down
37 changes: 32 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
name: test

on:
push:
branches:
- 'master'
- 'main'
tags:
- 'v*'
pull_request:
merge_group:
workflow_dispatch:
schedule:
- cron: '30 7 * * *'
inputs:
git-ref:
description: 'Git ref (optional)'
required: false

jobs:
build:
runs-on: ${{ matrix.os }}
test:
permissions:
contents: read
actions: read
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
os: [ubuntu-latest, macos-latest]
python-version: ["3.11", "3.12"]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -49,6 +61,21 @@ jobs:
# Run all configured checks (exit-zero treats all errors as warnings)
ruff check . --exit-zero --output-format=full
shell: bash

- name: Wait for frontend to build
id: wait-build-frontend
uses: lucasssvaz/wait-on-workflow@v1
with:
workflow: build-frontend.yaml
sha: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Download built frontend
uses: actions/download-artifact@v5
with:
name: frontend
path: ./frontend/build
github-token: ${{github.token}}
run-id: ${{ steps.wait-build-frontend.outputs.run-id }}

- name: Run Unit Tests
run: |
Expand Down
Loading
Loading