GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
ci: update GitHub Actions workflows to run on macOS + Windows (#1286)
Lars Bergerfec117d4ef70
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yamlnew file mode 100644index 00000000..871fe380--- /dev/null+++ b/.github/workflows/build.yaml@@ -0,0 +1,73 @@+name: Build++on:+ workflow_call:+ inputs:+ enable_ui_access:+ type: boolean+ default: false+ description: (Windows only) Enable UIAccess in the application manifest.+ version_number:+ type: string+ default: 0.0.0+ description: Version number to use for the build.++jobs:+ build:+ strategy:+ fail-fast: false+ matrix:+ include:+ # MacOS (Intel)+ - platform: macos-latest+ target: x86_64-apple-darwin+ # MacOS (Apple Silicon)+ - platform: macos-latest+ target: aarch64-apple-darwin+ # 64-bit Windows (Intel & AMD)+ - platform: windows-latest+ target: x86_64-pc-windows-msvc+ # 64-bit Windows (ARM)+ - platform: windows-latest+ target: aarch64-pc-windows-msvc++ runs-on: ${{ matrix.platform }}+ steps:+ - uses: actions/checkout@v4++ - uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17+ with:+ targets: ${{ matrix.target }}+ toolchain: nightly++ - uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3+ with:+ shared-key: ${{ matrix.target }}-${{ hashFiles('Cargo.lock') }}++ - name: Build for ${{ matrix.target }}+ env:+ VERSION_NUMBER: ${{ inputs.version_number }}+ # Conditionally enable UIAccess feature for Windows.+ FEATURES: ${{ matrix.platform == 'windows-latest' && inputs.enable_ui_access && '--features ui_access' || '' }}+ # Include `wm-watcher` when building for Windows.+ SCOPE: ${{ matrix.platform == 'windows-latest' && '--workspace' || '' }}+ shell: bash+ run: cargo build --locked --release --target ${{ matrix.target }} $SCOPE $FEATURES++ - name: Create upload directory+ shell: bash+ run: |+ SOURCE_DIR="target/${{ matrix.target }}/release"+ UPLOAD_DIR="temp/$SOURCE_DIR"+ mkdir -p "$UPLOAD_DIR"++ # Move build artifacts. Suppress errors for missing platform-specific binaries.+ mv "$SOURCE_DIR"/glazewm{,-cli} \+ "$SOURCE_DIR"/glazewm{,-cli,-watcher}.exe \+ "$UPLOAD_DIR/" 2>/dev/null || true++ - uses: actions/upload-artifact@v6+ with:+ if-no-files-found: error+ name: build-${{ matrix.target }}+ path: tempdiff --git a/.github/workflows/lint-check.yaml b/.github/workflows/lint-check.yamlindex 616ed9ab..e6dd298c 100644--- a/.github/workflows/lint-check.yaml+++ b/.github/workflows/lint-check.yaml@@ -7,22 +7,34 @@ on:jobs:lint-check:- runs-on: windows-latest+ strategy:+ fail-fast: false+ matrix:+ include:+ # MacOS (Apple Silicon)+ - platform: macos-latest+ target: aarch64-apple-darwin+ # Windows (x64)+ - platform: windows-latest+ target: x86_64-pc-windows-msvc++ runs-on: ${{ matrix.platform }}steps:- uses: actions/checkout@v4- uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17with:- toolchain: nightlycomponents: clippy, rustfmt+ targets: ${{ matrix.target }}+ toolchain: nightly- uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3+ with:+ shared-key: ${{ matrix.target }}-${{ hashFiles('Cargo.lock') }}- name: Check formatting (rustfmt)run: cargo fmt --check+ # Clippy itself runs `cargo check`, so this will also check for compilation errors.- name: Check linting (clippy)run: cargo clippy --all-targets --all-features -- -D warnings-- - name: Check build- run: cargo build --lockeddiff --git a/.github/workflows/package.yaml b/.github/workflows/package.yamlindex 0b22f2d4..f12e514d 100644--- a/.github/workflows/package.yaml+++ b/.github/workflows/package.yaml@@ -2,24 +2,38 @@ name: Packageon:workflow_call:+ inputs:+ version_number:+ type: string+ default: 0.0.0+ description: Version number to use for the build (e.g. `1.0.0`).workflow_dispatch:+ inputs:+ version_number:+ type: string+ default: 0.0.0+ description: Version number to use for the build (e.g. `1.0.0`).jobs:- next-version:- uses: semantic-release-action/next-release-version/.github/workflows/next-release-version.yml@3c2d88ce0390012bac0b8383059a0b67d2594dc1+ build:+ uses: ./.github/workflows/build.yaml+ with:+ enable_ui_access: true+ version_number: ${{ inputs.version_number }}- package:- needs: [next-version]+ package-windows:+ needs: buildruns-on: windows-latest+ env:+ VERSION: ${{ inputs.version_number }}steps:- uses: actions/checkout@v4- - uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17+ - name: Download build artifacts+ uses: actions/download-artifact@v8with:- toolchain: nightly- targets: x86_64-pc-windows-msvc,aarch64-pc-windows-msvc-- - uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3+ pattern: build-*+ merge-multiple: true- name: Install WiX and its extensionsrun: |@@ -39,10 +53,160 @@ jobs:AZ_TENANT_ID: ${{ secrets.AZ_TENANT_ID }}RFC3161_TIMESTAMP_URL: ${{ vars.RFC3161_TIMESTAMP_URL }}run: |- ./resources/scripts/package.ps1 -VersionNumber ${{ needs.next-version.outputs.new-release-version || '3.1.0' }}+ ./resources/scripts/package.ps1 -VersionNumber $env:VERSION- - uses: actions/upload-artifact@v4+ - uses: actions/upload-artifact@v6with:- name: installers+ name: package-windowsif-no-files-found: errorpath: out/installer-*++ package-macos:+ needs: build+ runs-on: macos-latest+ env:+ VERSION: ${{ inputs.version_number }}+ steps:+ - uses: actions/checkout@v4++ - name: Download build artifacts+ uses: actions/download-artifact@v8+ with:+ pattern: build-*+ merge-multiple: true++ - name: Create universal binaries+ run: |+ mkdir temp+ for binary in glazewm glazewm-cli; do+ lipo -create \+ "target/x86_64-apple-darwin/release/$binary" \+ "target/aarch64-apple-darwin/release/$binary" \+ -output "temp/$binary"+ chmod +x "temp/$binary"+ done++ - name: Import signing certificate+ env:+ APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}+ APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}+ run: |+ # Create a temporary keychain.+ KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db+ KEYCHAIN_PASSWORD=$(openssl rand -base64 32)++ security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"+ security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"+ security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"++ # Import the certificate.+ echo "$APPLE_CERTIFICATE" | base64 --decode > $RUNNER_TEMP/certificate.p12+ security import $RUNNER_TEMP/certificate.p12 \+ -P "$APPLE_CERTIFICATE_PASSWORD" \+ -A \+ -t cert \+ -f pkcs12 \+ -k "$KEYCHAIN_PATH"++ security list-keychain -d user -s "$KEYCHAIN_PATH"++ # Store the keychain path for later steps.+ echo "KEYCHAIN_PATH=$KEYCHAIN_PATH" >> $GITHUB_ENV++ # Make sure to sign the binaries before they're copied into the app bundle.+ - name: Sign universal binaries+ env:+ APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}+ run: |+ for binary in glazewm glazewm-cli; do+ codesign --force --options runtime --timestamp \+ --sign "$APPLE_SIGNING_IDENTITY" \+ "temp/$binary"+ codesign --verify --verbose=2 "temp/$binary"+ done++ - name: Convert icon to ICNS+ run: |+ ICONSET_DIR="temp/icon.iconset"+ mkdir -p $ICONSET_DIR+ sips -z 16 16 resources/assets/icon.png --out $ICONSET_DIR/icon_16x16.png+ sips -z 32 32 resources/assets/icon.png --out $ICONSET_DIR/[email protected]+ sips -z 32 32 resources/assets/icon.png --out $ICONSET_DIR/icon_32x32.png+ sips -z 64 64 resources/assets/icon.png --out $ICONSET_DIR/[email protected]+ sips -z 128 128 resources/assets/icon.png --out $ICONSET_DIR/icon_128x128.png+ sips -z 256 256 resources/assets/icon.png --out $ICONSET_DIR/[email protected]+ sips -z 256 256 resources/assets/icon.png --out $ICONSET_DIR/icon_256x256.png+ sips -z 512 512 resources/assets/icon.png --out $ICONSET_DIR/[email protected]+ sips -z 512 512 resources/assets/icon.png --out $ICONSET_DIR/icon_512x512.png+ sips -z 1024 1024 resources/assets/icon.png --out $ICONSET_DIR/[email protected]+ iconutil -c icns $ICONSET_DIR -o temp/icon.icns++ - name: Create app bundle+ run: |+ CONTENTS_DIR="temp/GlazeWM.app/Contents"+ mkdir -p "$CONTENTS_DIR/MacOS" "$CONTENTS_DIR/Resources"++ cp temp/glazewm "$CONTENTS_DIR/MacOS/"+ cp temp/glazewm-cli "$CONTENTS_DIR/MacOS/"+ cp temp/icon.icns "$CONTENTS_DIR/Resources/icon.icns"+ chmod +x "$CONTENTS_DIR/MacOS"/*++ # Substitute version placeholder in Info.plist.+ sed "s/\${VERSION}/$VERSION/g" resources/Info.plist > "$CONTENTS_DIR/Info.plist"++ echo -n "APPL????" > "$CONTENTS_DIR/PkgInfo"++ - name: Sign app bundle+ env:+ APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}+ run: |+ codesign --force --options runtime --timestamp \+ --sign "$APPLE_SIGNING_IDENTITY" \+ temp/GlazeWM.app+ codesign --verify --verbose=2 --deep --strict temp/GlazeWM.app++ - name: Create DMG+ run: |+ DMG_DIR="temp/dmg-contents"+ mkdir -p $DMG_DIR+ cp -R temp/GlazeWM.app $DMG_DIR/++ # Create a symbolic link to `/Applications` folder.+ ln -s /Applications $DMG_DIR/Applications++ # Create the DMG.+ hdiutil create -volname GlazeWM \+ -srcfolder $DMG_DIR \+ -ov -format UDZO \+ installer-universal.dmg++ - name: Sign DMG+ env:+ APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}+ run: |+ codesign --force --timestamp \+ --sign "$APPLE_SIGNING_IDENTITY" \+ installer-universal.dmg++ - name: Notarize DMG+ env:+ APPLE_ID: ${{ secrets.APPLE_ID }}+ APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}+ APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}+ run: |+ # Submit for notarization.+ xcrun notarytool submit installer-universal.dmg \+ --apple-id "$APPLE_ID" \+ --password "$APPLE_ID_PASSWORD" \+ --team-id "$APPLE_TEAM_ID" \+ --wait++ # Staple the notarization ticket to the DMG.+ xcrun stapler staple installer-universal.dmg++ - name: Upload DMG+ uses: actions/upload-artifact@v6+ with:+ name: package-macos+ if-no-files-found: error+ path: installer-universal.dmgdiff --git a/.github/workflows/release.yaml b/.github/workflows/release.yamlindex f1f32b33..d0a1e7b1 100644--- a/.github/workflows/release.yaml+++ b/.github/workflows/release.yaml@@ -3,15 +3,12 @@ name: Releaseon:workflow_dispatch:inputs:- draft-release:- type: boolean- default: true- description: Whether to publish the release as a draft.+ version_number:+ type: string+ description: Version number to use for the build (e.g. `1.0.0`).permissions:contents: write- issues: write- pull-requests: writeconcurrency:group: release@@ -20,42 +17,42 @@ jobs:package:uses: ./.github/workflows/package.yamlsecrets: inherit+ with:+ version_number: ${{ inputs.version_number }}release:- needs: [package]+ needs: packageruns-on: ubuntu-lateststeps:- uses: actions/checkout@v4- with:- fetch-depth: 0- name: Download installers- uses: actions/download-artifact@v4+ uses: actions/download-artifact@v8with:- name: installers- path: out/+ name: package-*+ merge-multiple: true- - name: Semantic release- uses: glzr-io/actions/semantic-release@main- with:- gh-publish: true- gh-draft-release: ${{ inputs.draft-release }}- gh-token: ${{ github.token }}- gh-assets: |- [- {- "path": "out/installer-universal.exe",- "name": "glazewm-${nextRelease.gitTag}.exe",- "label": "${nextRelease.gitTag} Installer (standard)"- },- {- "path": "out/installer-x64.msi",- "name": "standalone-glazewm-${nextRelease.gitTag}-x64.msi",- "label": "${nextRelease.gitTag} Standalone Installer (x64)"- },- {- "path": "out/installer-arm64.msi",- "name": "standalone-glazewm-${nextRelease.gitTag}-arm64.msi",- "label": "${nextRelease.gitTag} Standalone Installer (arm64)"- }- ]+ - name: Rename installers+ env:+ # Add a `v` prefix to the version number.+ VERSION: v${{ inputs.version_number }}+ run: |+ mv installer-universal.exe "glazewm-$VERSION.exe"+ mv installer-arm64.msi "standalone-glazewm-$VERSION-arm64.msi"+ mv installer-x64.msi "standalone-glazewm-$VERSION-x64.msi"+ mv installer-universal.dmg "glazewm-$VERSION.dmg"++ - name: Create draft release+ env:+ # Add a `v` prefix to the version number.+ VERSION: v${{ inputs.version_number }}+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ run: |+ gh release create "$VERSION" \+ --title "$VERSION" \+ --generate-notes \+ --draft \+ "./glazewm-$VERSION.exe#$VERSION for Windows (standard)" \+ "./standalone-glazewm-$VERSION-arm64.msi#$VERSION for Windows (standalone, arm64)" \+ "./standalone-glazewm-$VERSION-x64.msi#$VERSION for Windows (standalone, x64)" \+ "./glazewm-$VERSION.dmg#$VERSION for macOS"diff --git a/resources/scripts/package.ps1 b/resources/scripts/package.ps1index ef1f56a1..0b1ab887 100644--- a/resources/scripts/package.ps1+++ b/resources/scripts/package.ps1@@ -81,18 +81,25 @@ function BuildExes() {$outDir = if ($target -eq "x86_64-pc-windows-msvc") { "out/x64" } else { "out/arm64" }$sourceDir = "target/$target/release"- Write-Output "Building for $target"- cargo build --locked --release --target $target --features ui_access+ $requiredExes = @("glazewm.exe", "glazewm-cli.exe", "glazewm-watcher.exe")+ $sourcePaths = $requiredExes | ForEach-Object { "$sourceDir/$_" }- Write-Output "Moving built executables to $outDir"+ # Build for the target if the executables do not exist.+ if (($sourcePaths | Where-Object { !(Test-Path $_) }).Count -gt 0) {+ Write-Output "Build artifact not found for target '$target'. Building now..."++ cargo build --locked --release --target $target --features ui_access+ ExitOnError++ Write-Output "Build completed successfully for target '$target'."+ }++ Write-Output "Moving built executables from $sourceDir to $outDir"New-Item -ItemType Directory -Force -Path $outDir- Move-Item -Force -Path "$sourceDir/glazewm.exe", "$sourceDir/glazewm-cli.exe", "$sourceDir/glazewm-watcher.exe" -Destination $outDir+ Move-Item -Force -Path $sourcePaths -Destination $outDir- SignFiles @(- "$outDir/glazewm.exe",- "$outDir/glazewm-cli.exe",- "$outDir/glazewm-watcher.exe"- )+ $outPaths = $requiredExes | ForEach-Object { "$outDir/$_" }+ SignFiles $outPaths}}diff --git a/resources/wix/standalone.wxs b/resources/wix/standalone.wxsindex b8175318..ea958fda 100644--- a/resources/wix/standalone.wxs+++ b/resources/wix/standalone.wxs@@ -36,6 +36,7 @@<ComponentRef Id="Custom_AddDesktopShortcut" /><ComponentRef Id="Custom_AddStartMenuShortcut" /><ComponentRef Id="Custom_AddPathEnv" />+ <ComponentRef Id="Custom_RemoveAutoLaunchRegistry" /></Feature><StandardDirectory Id="ProgramFiles6432Folder">@@ -125,18 +126,23 @@<!-- Remove auto-launch registry values on uninstall. --><Component Id="Custom_RemoveAutoLaunchRegistry" Guid="B1A2C3D4-E5F6-47A8-9B0C-1234567890AB">+ <!-- `RegistryValue` with `KeyPath="yes"` is needed for component state tracking. -->+ <RegistryValue+ Root="HKLM"+ Key="SOFTWARE\glzr.io\GlazeWM"+ Name="AutoLaunchCleanup"+ Type="integer"+ Value="1"+ KeyPath="yes"+ /><RemoveRegistryValueRoot="HKCU"Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Run"- Name="GlazeWM"- Action="remove"- On="uninstall" />+ Name="GlazeWM" /><RemoveRegistryValueRoot="HKCU"Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run"- Name="GlazeWM"- Action="remove"- On="uninstall" />+ Name="GlazeWM" /></Component></Package></Wix>