Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6423fb5
Dev – Hack pipeline to test Windows builds faster
mokagio Oct 23, 2024
fc33c56
Install `maker-appx` module
mokagio Oct 23, 2024
2f908fd
Add `MakerAppX` instance to `makers` in config
mokagio Oct 23, 2024
84e314a
Add step to install Windows SDK
mokagio Oct 23, 2024
b725ee7
Set config to build beta/dev versions AppX
mokagio Oct 23, 2024
afbdf0c
Try with a different `publisher`
mokagio Oct 23, 2024
9dba8b4
Add APPX filter to artifacts
mokagio Oct 23, 2024
72bb5b4
Add note regarding Windows 10 SDK
mokagio Oct 23, 2024
c26a168
Experiment – Remove AppX cert details
mokagio Oct 23, 2024
db5d03b
Experiment – Use password 'None'
mokagio Oct 23, 2024
f2a23b1
Revert "Experiment – Use password 'None'"
mokagio Oct 23, 2024
a4f59ff
Revert "Experiment – Remove AppX cert details"
mokagio Oct 23, 2024
d56087c
Add note regarding AppX signing
mokagio Oct 23, 2024
9255a87
Try with publisher only
mokagio Oct 30, 2024
c4510cd
Try again with remote PFX
mokagio Oct 30, 2024
4b1bc42
Add note about new failure
mokagio Oct 31, 2024
ab2a284
Add `electron2appx` node module
mokagio Oct 31, 2024
e88ef64
Add first attempt of script to generate AppX without Forge support
mokagio Oct 31, 2024
6a105c9
Comment out AppX maker config – Doc reference once experiment done
mokagio Oct 31, 2024
4e842a5
Hack to download artifacts from prev build - faster feedback loop
mokagio Oct 31, 2024
69d82d8
Add `xml2js`
mokagio Oct 31, 2024
dc2393d
Use `\` paths (even though it's running in bash?)
mokagio Oct 31, 2024
2bb83ff
Address ESLint warning from VS Code
mokagio Oct 31, 2024
0491344
Try building again, looks like sources are needed
mokagio Oct 31, 2024
7d1af43
Wild guess on the path the AppX script needs
mokagio Oct 31, 2024
ee70408
Address some Prettier warnings
mokagio Oct 31, 2024
67bc967
Remove `xml2js` that is not unused
mokagio Oct 31, 2024
905e437
Fix import order to please ESLint
mokagio Oct 31, 2024
a94451a
Fix all prettier/prettier problems (WordPress style) via VS Code helper
mokagio Oct 31, 2024
54e6650
Add missing definition for `appxBundleName`
mokagio Oct 31, 2024
ab53ca7
Tweak build-appx-version.mjs to complete build
mokagio Oct 31, 2024
c8be48d
Add required assets
mokagio Nov 1, 2024
8413445
Fix file name for "Square" logos
mokagio Nov 1, 2024
88c1803
Replace 40x40 logo with 44x44 logo
mokagio Nov 1, 2024
448a2a2
Condense all AppX config in a single dictionary
mokagio Nov 1, 2024
ae11de4
Add required numerical id for AppX build
mokagio Nov 1, 2024
ab2359e
Centralize Windows 10 SDK definition
mokagio Nov 4, 2024
49d173c
Add test step for AppX from release build
mokagio Nov 4, 2024
7f975c3
Add note regarding skipping code signing
mokagio Nov 4, 2024
169b755
Remove unused code
mokagio Nov 4, 2024
c8dfc82
Print AppX output path to console
mokagio Nov 4, 2024
fed010b
Add `set -e` to Buildkite command to see if release fails as expected
mokagio Nov 4, 2024
3c2e1b7
Add header log for Buildkite build
mokagio Nov 4, 2024
22577af
Bypass tag check while in development
mokagio Nov 4, 2024
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
1 change: 0 additions & 1 deletion .buildkite/commands/build-for-windows-dev.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ $artifactsPath = Get-Item ".\out" | Select-Object -ExpandProperty FullName
Get-ChildItem -Path $artifactsPath -Recurse -Include "*.nupkg" | Rename-Item -NewName "studio-update.nupkg"

If ($LastExitCode -ne 0) { Exit $LastExitCode }

44 changes: 44 additions & 0 deletions .buildkite/commands/install-windows-10-sdk.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Stop script execution when a non-terminating error occurs
$ErrorActionPreference = "Stop"

$windowsSDKVersionFile = ".windows-10-sdk-version"
if (-not (Test-Path $windowsSDKVersionFile)) {
Write-Output "[!] No Windows 10 SDK version file found at $windowsSDKVersionFile."
exit 1
}

$windows10SDKVersion = Get-Content $windowsSDKVersionFile

Write-Host "--- :wrench: Setting up Windows 10 ($windows10SDKVersion) SDK and Visual Studio Build Tools"

# Download the Visual Studio Build Tools Bootstrapper
Write-Output "Downloading Visual Studio Build Tools..."
Invoke-WebRequest -Uri https://aka.ms/vs/17/release/vs_buildtools.exe -OutFile vs_buildtools.exe
If (-not (Test-Path .\vs_buildtools.exe)) {
Write-Output "[!] Failed to download Visual Studio Build Tools"
Exit 1
}

# Install the Windows SDK and other required components
Write-Output "Installing Visual Studio Build Tools..."
Start-Process -FilePath .\vs_buildtools.exe -ArgumentList "--quiet --wait --add Microsoft.VisualStudio.Component.Windows10SDK.$windows10SDKVersion" -NoNewWindow -Wait

# Check if the installation was successful in file system
$windowsSDKsRoot = "C:\Program Files (x86)\Windows Kits\10\bin"
$sdkPath = "$windowsSDKsRoot\10.0.$windows10SDKVersion.0\x64"
If (-not (Test-Path $sdkPath)) {
Write-Output "[!] Failed to install Windows 10 SDK: Could not find SDK at $sdkPath."
If (-not (Test-Path $windowsSDKsRoot)) {
Write-Output "[!] Expected $windowsSDKsRoot to exist, but it does not."
} else {
Write-Output " Found:"
Get-ChildItem -Path $windowsSDKsRoot | ForEach-Object { Write-Output " - $windowsSDKsRoot\$_" }
}
Exit 1
}

Write-Output "Visual Studio Build Tools + Windows 10 ($windows10SDKVersion) SDK installation completed. SDK path: $sdkPath."

Write-Output "Cleaning up..."
Remove-Item -Path .\vs_buildtools.exe
Write-Output "Done"
8 changes: 7 additions & 1 deletion .buildkite/commands/prepare-windows-host.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,15 @@ If ($LastExitCode -ne 0) { Exit $LastExitCode }

# From https://stackoverflow.com/a/46760714
Write-Host "--- :windows: Setting up Package Manager"
$env:ChocolateyInstall = Convert-Path "$((Get-Command choco).Path)\..\.."
$env:ChocolateyInstall = Convert-Path "$((Get-Command choco).Path)\..\.."
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"

# Building AppX with Electron Forge requires the Windows 10 SDK
#
# See https://github.com/electron/forge/blob/4e7517c11f46b87a1e7b2a31b7c7ca39b0ee0a97/packages/maker/appx/README.md?plain=1#L5
& "$PSScriptRoot\install-windows-10-sdk.ps1"
If ($LastExitCode -ne 0) { Exit $LastExitCode }

Write-Host "--- :node: Installing NVM"
choco install nvm.portable -y
If ($LastExitCode -ne 0) { Exit $LastExitCode }
Expand Down
231 changes: 14 additions & 217 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,235 +10,32 @@ env:
IMAGE_ID: $IMAGE_ID

steps:
- label: Lint
key: lint
command: |
.buildkite/commands/install-node-dependencies.sh
echo '--- :eslint: Lint'
npm run lint
plugins: *common_plugins

- label: Unit Tests
key: unit_tests
command: |
.buildkite/commands/install-node-dependencies.sh
echo '--- :npm: Run Unit Tests'
npm run test
plugins: *common_plugins

- label: Experiment Windows Unit Tests
# Reference: https://github.com/Automattic/studio/pull/76#issuecomment-2162689679
skip: "Disabled till we solve Windows-specific test failures"
command: |
bash .buildkite/commands/install-node-dependencies.sh
echo '--- :npm: Run Unit Tests'
npm run test
agents:
queue: windows
plugins: *common_plugins

# Notice that we use the queue name (matrix value) in the label.
# We could have added values for queue and label, but that would have resulted in 'macOS + windows' and 'Windows + mac' combinations, which we don't want.
# Buildkite offers an option to remove those combinations, but the overhead in code readability did not seem worth the visual effect in the build page.
# See https://buildkite.com/docs/pipelines/build-matrix#removing-combinations-from-the-build-matrix
- label: "E2E Tests on {{ matrix }}"
key: e2e_tests
command: |
# call with bash explicitly because we run this on Windows, too
bash .buildkite/commands/install-node-dependencies.sh
echo '--- :package: Package app for testing'
npm run package
echo '--- :playwright: Run End To End Tests'
npm run e2e
artifact_paths:
- test-results/**/*.zip
plugins: *common_plugins
agents:
queue: "{{ matrix }}"
env:
# See https://playwright.dev/docs/ci#debugging-browser-launches
DEBUG: 'pw:browser'
matrix:
- mac
#- windows

- group: "📦 Build for Mac"
key: 'dev-mac'
steps:
- label: '🔨 Mac Dev Build - {{matrix}}'
agents:
queue: mac
command: |
.buildkite/commands/prepare-environment.sh

.buildkite/commands/install-node-dependencies.sh

node ./scripts/prepare-dev-build-version.mjs

echo "--- :node: Building Binary"
npm run make:macos-{{matrix}}

# Local trial and error show this needs to run before the DMG generation (obviously) but after the binary has been built
echo "--- :hammer: Rebuild fs-attr if necessary before generating DMG"
case {{matrix}} in
universal | x64)
echo "Rebuilding fs-xattr for {{matrix}} architecture"
npm rebuild fs-xattr --cpu universal
;;
arm64)
echo "No need to rebuild fs-xattr because it works out of the box on Apple Silicon"
;;
*)
echo "^^^ +++ Unexpected architecture {{matrix}}"
exit 1
;;
esac

echo "--- :node: Packaging in DMG"
npm run make:dmg-{{matrix}}

echo "--- 📃 Notarizing Binary"
bundle exec fastlane notarize_binary

plugins: *common_plugins
artifact_paths:
- 'out/**/*.app.zip'
- 'out/*.dmg'
matrix:
- "universal"
- "x64"
- "arm64"
if: "build.tag !~ /^v[0-9]+/"

- label: "🔨 Windows Dev Build"
key: "dev-windows"
command: .buildkite/commands/build-for-windows-dev.ps1
command: |
set -e
.buildkite/commands/build-for-windows-dev.ps1
node scripts/build-appx-version.mjs
artifact_paths:
- 'out\**\studio-setup.exe'
- 'out\**\studio-update.nupkg'
- 'out\**\RELEASES'
- 'out\**\*.appx'
- 'out\**\*.appxbundle'
agents:
queue: windows
if: "build.tag !~ /^v[0-9]+/"

- label: ':rocket: Distribute Dev Builds'
- label: "🔨 Windows Release Build"
key: "windows"
command: |
echo "--- :node: Downloading Binaries"
buildkite-agent artifact download "*.app.zip" .
buildkite-agent artifact download "*.dmg" .
buildkite-agent artifact download "*.exe" .
buildkite-agent artifact download "*.nupkg" .
buildkite-agent artifact download "*\\RELEASES" .

.buildkite/commands/install-node-dependencies.sh

echo "--- :node: Generating Release Manifest"
IS_DEV_BUILD=true node ./scripts/generate-releases-manifest.mjs

echo "--- :fastlane: Distributing Dev Builds"
install_gems
bundle exec fastlane distribute_dev_build
artifact_paths:
- 'out/releases.json'
agents:
queue: mac
# Using concurrency_group to ensure the CI builds from `trunk` & the git tag, which are likely to run at roughly the
# same time, don't run into a race condition when downloading+updating+uploading the `releases.json` file from/to S3
concurrency_group: 'studio/release-manifest-update'
concurrency: 1
concurrency_method: eager
depends_on:
- step: "dev-mac"
- step: "dev-windows"
plugins: *common_plugins
if: "build.branch == 'trunk' && build.tag !~ /^v[0-9]+/"

- group: "📦 Build for Mac"
key: 'release-mac'
steps:
- label: '🔨 Mac Release Build - {{matrix}}'
agents:
queue: mac
command: |
.buildkite/commands/prepare-environment.sh

.buildkite/commands/install-node-dependencies.sh
node ./scripts/confirm-tag-matches-version.mjs

echo "--- :node: Building Binary"
npm run make:macos-{{matrix}}

# Local trial and error show this needs to run before the DMG generation (obviously) but after the binary has been built
echo "--- :hammer: Rebuild fs-attr if necessary before generating DMG"
case {{matrix}} in
universal | x64)
echo "Rebuilding fs-xattr for {{matrix}} architecture"
npm rebuild fs-xattr --cpu universal
;;
arm64)
echo "No need to rebuild fs-xattr because it works out of the box on Apple Silicon"
;;
*)
echo "^^^ +++ Unexpected architecture {{matrix}}"
exit 1
;;
esac

echo "--- :node: Packaging in DMG"
npm run make:dmg-{{matrix}}

echo "--- 📃 Notarizing Binary"
bundle exec fastlane notarize_binary

plugins: *common_plugins
artifact_paths:
- 'out/**/*.app.zip'
- 'out/*.dmg'
matrix:
- "universal"
- "x64"
- "arm64"
if: "build.tag =~ /^v[0-9]+/"

- label: '🔨 Windows Release Build'
key: 'release-windows'
command: .buildkite/commands/build-for-windows-release.ps1
agents:
queue: windows
set -e
.buildkite/commands/build-for-windows-release.ps1
node scripts/build-appx-version.mjs
artifact_paths:
- 'out\**\studio-setup.exe'
- 'out\**\studio-update.nupkg'
- 'out\**\RELEASES'
if: "build.tag =~ /^v[0-9]+/"

- label: ':rocket: Publish Release Builds'
command: |
echo "--- :node: Downloading Binaries"
buildkite-agent artifact download "*.zip" .
buildkite-agent artifact download "*.dmg" .
buildkite-agent artifact download "*.exe" .
buildkite-agent artifact download "*.nupkg" .
buildkite-agent artifact download "*\\RELEASES" .

.buildkite/commands/install-node-dependencies.sh

echo "--- :node: Generating Release Manifest"
node ./scripts/generate-releases-manifest.mjs

echo "--- :fastlane: Distributing Release Builds"
install_gems
bundle exec fastlane distribute_release_build
artifact_paths:
- 'out/releases.json'
- 'out\**\*.appx'
- 'out\**\*.appxbundle'
agents:
queue: mac
# Using concurrency_group to ensure the CI builds from `trunk` & the git tag, which are likely to run at roughly the
# same time, don't run into a race condition when downloading+updating+uploading the `releases.json` file from/to S3
concurrency_group: 'studio/release-manifest-update'
concurrency: 1
concurrency_method: eager
depends_on:
- step: "release-mac"
- step: "release-windows"
plugins: *common_plugins
if: "build.tag =~ /^v[0-9]+/"
queue: windows
1 change: 1 addition & 0 deletions .windows-10-sdk-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20348
Binary file added assets/appx/Square150x150Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/appx/Square44x44Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/appx/StoreLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/appx/Wide310x150Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import fs from 'fs';
import path from 'path';
import { MakerAppX } from '@electron-forge/maker-appx';
import { MakerDeb } from '@electron-forge/maker-deb';
import { MakerDMG } from '@electron-forge/maker-dmg';
import { MakerSquirrel } from '@electron-forge/maker-squirrel';
Expand Down Expand Up @@ -36,6 +37,35 @@ const config: ForgeConfig = {
name: 'studio',
},
} ),
// new MakerAppX( {
// // The Windows Store does not require the AppX to be signed.
// // However, there does not seem to be a way to configure this maker to skip signing.
// // As such, we attempt signing at this point.
// //
// // At the time of writing, it is unknown whether the Window Store will allow or reject an AppX signed in this way.
// //
// // If a rejection occur, we can look at using a post build hook to convert to AppX instead.
// //
// // Notes:
// //
// // - I tried with publisher only, to see if it skipped code signing, but it looks like the process required user input in CI...
// // > When asked to enter a password, please select "None".
// // I wonder if there's a way to pass that via CI...
// //
// // - The certificate.pfx stored in S3 does not match (or has some other issue with)
// // the publisher 'CN=E2E5A157-746D-4B04-9116-ABE5CB928306'.
// // See https://buildkite.com/automattic/studio/builds/3035#0192df1a-3ad9-4c15-9843-e7b16fd84448
// //
// // - Using publisher 'Automattic Inc. etc etc' results in a successful code sign, but Partner Center rejects the build.
// publisher: 'CN=E2E5A157-746D-4B04-9116-ABE5CB928306',
// devCert: 'certificate.pfx',
// certPass: process.env.WINDOWS_CODE_SIGNING_CERT_PASSWORD,
// // Windows Store version numbers don't support semver beta tags.
// //
// // See implementation details at:
// // https://github.com/electron/forge/blob/4e7517c11f46b87a1e7b2a31b7c7ca39b0ee0a97/packages/maker/base/src/Maker.ts#L172-L179
// makeVersionWinStoreCompatible: true,
// } ),
new MakerSquirrel(
{
loadingGif: './installers/loading.gif',
Expand Down
Loading
Loading