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
197 changes: 171 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: CI

on:
workflow_dispatch:
inputs:
disable_caches:
description: Build helper without restoring or saving dependency/model caches
type: boolean
default: false
push:
branches:
- "**"
Expand All @@ -21,12 +27,39 @@ env:
SKIP_BUNDLED_SEPARATOR_HELPER: "1"

jobs:
changes:
name: Select Helper Validation
runs-on: macos-26
outputs:
helper_required: ${{ steps.changes.outputs.helper_required }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Select checks
id: changes
run: python3 scripts/separator_ci_changes.py

python-tests:
name: Separator Helper Tests
runs-on: macos-26
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Set up pinned Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version-file: JammLabSeparatorHelper/.python-version
architecture: arm64
check-latest: false

- name: Validate dependency inputs
run: python3 scripts/check_separator_dependencies.py --check-platform

- name: Test dependency and CI checks
run: python3 -m unittest discover -s scripts -p 'test_separator_dependencies.py'

- name: Run Python helper tests
run: python3 -m unittest JammLabSeparatorHelper/test_runner.py
Expand All @@ -39,7 +72,7 @@ jobs:
runs-on: macos-26
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Run Swift tests
run: >
Expand Down Expand Up @@ -85,7 +118,7 @@ jobs:
- Release
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Build unsigned app
run: >
Expand All @@ -103,12 +136,14 @@ jobs:
ARCHS=arm64

tag-artifacts:
name: Tag Build Artifacts
name: Packaged Helper and Release Artifacts
runs-on: macos-26
needs:
- python-tests
- swift-tests
if: startsWith(github.ref, 'refs/tags/v')
- changes
if: needs.changes.outputs.helper_required == 'true'
timeout-minutes: 120
outputs:
release_version: ${{ steps.release_metadata.outputs.RELEASE_VERSION }}
app_version: ${{ steps.release_metadata.outputs.APP_VERSION }}
Expand All @@ -117,38 +152,76 @@ jobs:
is_prerelease: ${{ steps.release_metadata.outputs.IS_PRERELEASE }}
env:
SKIP_BUNDLED_SEPARATOR_HELPER: "0"
PIP_CACHE_DIR: ${{ github.workspace }}/build/JammLabSeparatorHelper/pip-cache
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

- name: Derive release metadata from tag
- name: Set up pinned Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version-file: JammLabSeparatorHelper/.python-version
architecture: arm64
check-latest: false

- name: Record toolchain
run: |
mkdir -p build/JammLabSeparatorHelper/reports
{
python3 --version
sw_vers
uname -m
xcodebuild -version
} > build/JammLabSeparatorHelper/reports/toolchain.txt

- name: Derive release metadata
id: release_metadata
run: |
set -euo pipefail
metadata="$(scripts/derive_release_metadata.sh "$GITHUB_REF_NAME")"
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
build_tag="$GITHUB_REF_NAME"
else
build_tag="v0.0.0-dev.${GITHUB_RUN_NUMBER}"
fi
metadata="$(scripts/derive_release_metadata.sh "$build_tag")"
printf '%s\n' "$metadata"
printf '%s\n' "$metadata" >> "$GITHUB_ENV"
printf '%s\n' "$metadata" >> "$GITHUB_OUTPUT"

- name: Cache bundled separator helper dependencies
uses: actions/cache@v4
- name: Cache Python downloads
if: ${{ !inputs.disable_caches }}
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: build/JammLabSeparatorHelper/pip-cache
key: separator-pip-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('JammLabSeparatorHelper/.python-version', 'JammLabSeparatorHelper/requirements*.txt', 'JammLabSeparatorHelper/*.lock', 'JammLabSeparatorHelper/build-constraints.txt') }}

- name: Cache separator models
if: ${{ !inputs.disable_caches }}
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
build/JammLabSeparatorHelper/venv
build/JammLabSeparatorHelper/model-cache
build/JammLabSeparatorHelper/pyinstaller-config
key: separator-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('JammLabSeparatorHelper/requirements.txt', 'JammLabSeparatorHelper/requirements-build.txt', 'JammLabSeparatorHelper/runner.py', 'JammLabSeparatorHelper/JammLabSeparatorHelper.spec', 'scripts/build_separator_helper.sh') }}
restore-keys: |
separator-${{ runner.os }}-${{ runner.arch }}-
path: build/JammLabSeparatorHelper/model-cache
key: separator-models-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('JammLabSeparatorHelper/helper-manifest.json') }}

- name: Build bundled separator helper
run: scripts/build_separator_helper.sh
run: |
set -euo pipefail
scripts/build_separator_helper.sh 2>&1 | tee build/JammLabSeparatorHelper/reports/build.log

- name: Validate packaged helper offline
run: >
build/JammLabSeparatorHelper/venv/bin/python scripts/smoke_separator_helper.py
build/JammLabSeparatorHelper/dist/JammLabSeparatorHelper/JammLabSeparatorHelper
--report-dir build/JammLabSeparatorHelper/reports/standalone

- name: Test smoke rejection cases
run: build/JammLabSeparatorHelper/venv/bin/python -m unittest discover -s scripts -p 'test_separator_smoke.py'

- name: Build unsigned release app
run: |
set -euo pipefail
# Bash 3.2 needs guarded expansion of empty arrays with nounset enabled.
update_check_build_setting=()
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
update_check_build_setting+=("SWIFT_ACTIVE_COMPILATION_CONDITIONS=JAMMLAB_STABLE_RELEASE")
Expand All @@ -166,7 +239,7 @@ jobs:
ONLY_ACTIVE_ARCH=YES \
ARCHS=arm64 \
-only-testing:JammLabTests/AppVersionTests/testCompiledReleasePolicyMatchesBuildFlags \
"${update_check_build_setting[@]}"
${update_check_build_setting[@]+"${update_check_build_setting[@]}"}

xcodebuild build \
-project "$XCODE_PROJECT" \
Expand All @@ -182,7 +255,7 @@ jobs:
CURRENT_PROJECT_VERSION="${{ github.run_number }}" \
ONLY_ACTIVE_ARCH=YES \
ARCHS=arm64 \
"${update_check_build_setting[@]}"
${update_check_build_setting[@]+"${update_check_build_setting[@]}"}

app_path="$DERIVED_DATA_PATH/Build/Products/Release/JammLab.app"
built_version="$(plutil -extract CFBundleShortVersionString raw -o - "$app_path/Contents/Info.plist")"
Expand All @@ -200,52 +273,124 @@ jobs:
exit 1
fi

- name: Validate app-embedded helper offline
run: >
build/JammLabSeparatorHelper/venv/bin/python scripts/smoke_separator_helper.py
build-ci/Build/Products/Release/JammLab.app/Contents/Resources/JammLabSeparatorHelper/JammLabSeparatorHelper
--report-dir build/JammLabSeparatorHelper/reports/app

- name: Package unsigned DMG
run: >
scripts/package_dmg.sh
"$DERIVED_DATA_PATH/Build/Products/Release/JammLab.app"
"dist/JammLab-$RELEASE_VERSION-unsigned.dmg"

- name: Verify DMG
run: hdiutil verify "dist/JammLab-$RELEASE_VERSION-unsigned.dmg"

- name: Package source archive
run: |
set -euo pipefail
mkdir -p dist
git archive --format=zip --output "dist/JammLab-$RELEASE_VERSION-source.zip" "$GITHUB_REF_NAME"
git archive --format=zip --output "dist/JammLab-$RELEASE_VERSION-source.zip" "HEAD"

- name: Upload unsigned DMG
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: JammLab-${{ steps.release_metadata.outputs.RELEASE_VERSION }}-unsigned-dmg
path: dist/JammLab-${{ steps.release_metadata.outputs.RELEASE_VERSION }}-unsigned.dmg
if-no-files-found: error

- name: Upload source archive
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: JammLab-${{ steps.release_metadata.outputs.RELEASE_VERSION }}-source
path: dist/JammLab-${{ steps.release_metadata.outputs.RELEASE_VERSION }}-source.zip
if-no-files-found: error

- name: Record artifact checksums
working-directory: dist
run: shasum -a 256 "JammLab-$RELEASE_VERSION-unsigned.dmg" "JammLab-$RELEASE_VERSION-source.zip" > SHA256SUMS

- name: Upload checksums
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: JammLab-${{ steps.release_metadata.outputs.RELEASE_VERSION }}-checksums
path: dist/SHA256SUMS
if-no-files-found: error

- name: Upload helper diagnostics
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: separator-diagnostics
path: build/JammLabSeparatorHelper/reports
if-no-files-found: warn

verify-artifacts:
name: Verify Downloaded Artifacts
runs-on: ubuntu-latest
needs: tag-artifacts
steps:
- name: Download build artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: JammLab-${{ needs.tag-artifacts.outputs.release_version }}-*
merge-multiple: true
path: dist
- name: Verify names, contents and checksums
working-directory: dist
env:
RELEASE_VERSION: ${{ needs.tag-artifacts.outputs.release_version }}
run: |
test -f "JammLab-$RELEASE_VERSION-unsigned.dmg"
test -f "JammLab-$RELEASE_VERSION-source.zip"
sha256sum --check SHA256SUMS
unzip -t "JammLab-$RELEASE_VERSION-source.zip"

helper-validation:
name: Helper Validation
runs-on: ubuntu-latest
if: always()
needs: [changes, tag-artifacts, verify-artifacts]
steps:
- name: Require selected validation to succeed
env:
CHANGES_RESULT: ${{ needs.changes.result }}
REQUIRED: ${{ needs.changes.outputs.helper_required }}
BUILD_RESULT: ${{ needs.tag-artifacts.result }}
ARTIFACT_RESULT: ${{ needs.verify-artifacts.result }}
run: |
test "$CHANGES_RESULT" = success
if [ "$REQUIRED" = true ]; then
test "$BUILD_RESULT" = success
test "$ARTIFACT_RESULT" = success
else
test "$BUILD_RESULT" = skipped
test "$ARTIFACT_RESULT" = skipped
fi

publish-release:
name: Publish GitHub Release
runs-on: ubuntu-latest
needs:
- tag-artifacts
if: startsWith(github.ref, 'refs/tags/v') && needs.tag-artifacts.outputs.is_github_release == 'true'
- helper-validation
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && needs.tag-artifacts.outputs.is_github_release == 'true'
permissions:
contents: write
env:
RELEASE_VERSION: ${{ needs.tag-artifacts.outputs.release_version }}
IS_PRERELEASE: ${{ needs.tag-artifacts.outputs.is_prerelease }}
steps:
- name: Download unsigned DMG
uses: actions/download-artifact@v4
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: JammLab-${{ needs.tag-artifacts.outputs.release_version }}-unsigned-dmg
path: dist

- name: Download source archive
uses: actions/download-artifact@v4
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: JammLab-${{ needs.tag-artifacts.outputs.release_version }}-source
path: dist
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ development artifact builds use `vMAJOR.MINOR.PATCH-dev.N`.

## Unreleased

- Fixed development and beta release builds failing in CI with the macOS system Bash.
- Made bundled Stem helper builds repeatable with pinned Python dependencies and added offline separation and release-artifact checks to CI.

## 1.2.0

### New Features
Expand Down
Loading
Loading