Skip to content
Draft
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
2 changes: 2 additions & 0 deletions .buildkite/commands/build-for-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ if ($Architecture -notin $VALID_ARCHITECTURES) {
Exit 1
}

Write-Output "AMI_VERSION: $([Environment]::GetEnvironmentVariable('AMI_VERSION'))"

# setup_windows_code_signing.ps1 comes from CI Toolkit Plugin
& "setup_windows_code_signing.ps1"
If ($LastExitCode -ne 0) { Exit $LastExitCode }
Expand Down
242 changes: 1 addition & 241 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,126 +7,12 @@ env:
IMAGE_ID: $IMAGE_ID

steps:
- label: Lint
agents:
queue: mac
key: lint
command: |
.buildkite/commands/install-node-dependencies.sh
echo '--- :eslint: Lint'
npm run lint
plugins: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
notify:
- github_commit_status:
context: Lint

- label: Unit Tests on {{matrix}}
key: unit_tests
command: bash .buildkite/commands/run-unit-tests.sh "{{matrix}}"
plugins: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
agents:
queue: "{{matrix}}"
matrix:
- mac
- windows
notify:
- github_commit_status:
context: Unit Tests

# 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: bash .buildkite/commands/run-e2e-tests.sh "{{matrix}}"
artifact_paths:
- test-results/**/*.zip
- test-results/**/*.png
- test-results/**/*error-context.md
plugins: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
agents:
queue: "{{matrix}}"
env:
# See https://playwright.dev/docs/ci#debugging-browser-launches
DEBUG: "pw:browser"
matrix:
- mac
- windows
# Skip E2E tests on draft PRs to save CI resources
# Tests will run automatically when PR is marked ready for review
if: build.branch == 'trunk' || build.tag =~ /^v[0-9]+/ || !build.pull_request.draft
notify:
- github_commit_status:
context: E2E Tests

- input: "🚦 Build for Mac?"
prompt: "Do you want to build Mac dev binaries for this PR?"
key: input-dev-mac
if: build.tag !~ /^v[0-9]+/ && build.branch != 'trunk'

- group: 📦 Build for Mac
key: dev-mac
depends_on: input-dev-mac
if: build.tag !~ /^v[0-9]+/
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

export IS_DEV_BUILD=true

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
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: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
artifact_paths:
- out/**/*.app.zip
- out/*.dmg
matrix:
- x64
- arm64

- input: "🚦 Build for Windows?"
prompt: "Do you want to build Windows dev binaries for this PR?"
key: input-dev-windows
if: build.tag !~ /^v[0-9]+/ && build.branch != 'trunk'

- group: 📦 Build for Windows
key: dev-windows
depends_on: input-dev-windows
if: build.tag !~ /^v[0-9]+/
steps:
- label: 🔨 Windows Dev Build - {{matrix}}
agents:
queue: windows
queue: windows-staging
command: powershell -File .buildkite/commands/build-for-windows.ps1 -BuildType dev -Architecture {{matrix}}
artifact_paths:
- out\**\studio-setup.exe
Expand All @@ -137,129 +23,3 @@ steps:
matrix:
- x64
- arm64

- label: ":rocket: Distribute Dev Builds"
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 "*.appx" .
buildkite-agent artifact download "*.nupkg" .
buildkite-agent artifact download "*\\RELEASES" .

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

export IS_DEV_BUILD=true

echo "--- :node: Generating Release Manifest"
node ./scripts/prepare-dev-build-version.mjs

echo "--- :fastlane: Distributing Dev Builds"
install_gems
bundle exec fastlane distribute_dev_build
agents:
queue: mac
depends_on:
- step: dev-mac
- step: dev-windows
plugins: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
if: build.branch == 'trunk' && build.tag !~ /^v[0-9]+/
notify:
- github_commit_status:
context: Distribute Dev Builds

- 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
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: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
artifact_paths:
- out/**/*.app.zip
- out/*.dmg
matrix:
- x64
- arm64
notify:
- github_commit_status:
context: All Mac Release Builds
if: build.tag =~ /^v[0-9]+/

- group: 📦 Build for Windows
key: release-windows
steps:
- label: 🔨 Windows Release Build - {{matrix}}
agents:
queue: windows
command: powershell -File .buildkite/commands/build-for-windows.ps1 -BuildType release -Architecture {{matrix}}
artifact_paths:
- out\**\studio-setup.exe
- out\**\studio-update.nupkg
- out\**\RELEASES
- out\**\*.appx
plugins: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
matrix:
- x64
- arm64
notify:
- github_commit_status:
context: All Windows Release Builds
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 "*.appx" .
buildkite-agent artifact download "*.nupkg" .
buildkite-agent artifact download "*\\RELEASES" .

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

echo "--- :fastlane: Distributing Release Builds"
install_gems
bundle exec fastlane distribute_release_build
agents:
queue: mac
depends_on:
- step: release-mac
- step: release-windows
plugins: [$CI_TOOLKIT_PLUGIN, $NVM_PLUGIN]
if: build.tag =~ /^v[0-9]+/
notify:
- github_commit_status:
context: Publish Release Builds