Skip to content

Commit

Permalink
Merge release 2.22.0 and 2.22.1 (#3233)
Browse files Browse the repository at this point in the history
Co-authored-by: Kat Hagan <[email protected]>
Co-authored-by: Olivier Halligon <[email protected]>
Co-authored-by: Kat Hagan <[email protected]>
  • Loading branch information
4 people authored Jul 19, 2024
1 parent ecae07b commit 02f18d6
Show file tree
Hide file tree
Showing 34 changed files with 876 additions and 430 deletions.
6 changes: 6 additions & 0 deletions .buildkite/commands/install_node_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash -eu

echo "--- :npm: Install Node dependencies"
# --legacy-peer-deps is necessary because of react-monaco-editor.
# See README for more details
npm ci --legacy-peer-deps
53 changes: 53 additions & 0 deletions .buildkite/commands/package_windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Stop script execution when a non-terminating error occurs
$ErrorActionPreference = "Stop"

& "prepare_windows_host_for_node.ps1"

# First try to get the env var from the process environment
$windowsCertPassword = [System.Environment]::GetEnvironmentVariable('WINDOWS_CODE_SIGNING_CERT_PASSWORD', [System.EnvironmentVariableTarget]::Process)
If ([string]::IsNullOrEmpty($windowsCertPassword)) {
# If it fails, try from the machine-wide environment
$windowsCertPassword = [System.Environment]::GetEnvironmentVariable('WINDOWS_CODE_SIGNING_CERT_PASSWORD', [System.EnvironmentVariableTarget]::Machine)
}

If ([string]::IsNullOrEmpty($windowsCertPassword)) {
Write-Host "[!] WINDOWS_CODE_SIGNING_CERT_PASSWORD is not set in either process or machine environments."
Exit 1
} else {
[System.Environment]::SetEnvironmentVariable('CSC_KEY_PASSWORD', $windowsCertPassword, [System.EnvironmentVariableTarget]::Machine)
Write-Host "Environment variable CSC_KEY_PASSWORD set to the value of WINDOWS_CODE_SIGNING_CERT_PASSWORD."
}

Write-Host "--- :windows: Configure Windows code signing"
# The pfx path comes from the prepare script above.
# TODO: Move the set instruction in the script at the plugin level?
$certPath = (Convert-Path .\certificate.pfx)
If (Test-Path $certPath) {
[System.Environment]::SetEnvironmentVariable('CSC_LINK', $certPath, [System.EnvironmentVariableTarget]::Machine)
Write-Host "Environment variable CSC_LINK set to $certPath"
} else {
Write-Host "[!] certificate.pfx file does not exist."
Exit 1
}

# Workaround for CI not finding the certificate.
# See failure such as
# https://buildkite.com/automattic/simplenote-electron/builds/71#01900b28-9508-4bfe-bc80-63464afeaa3e/292-567
Import-PfxCertificate -FilePath $certPath -CertStoreLocation Cert:\LocalMachine\Root -Password (ConvertTo-SecureString -String $env:WINDOWS_CODE_SIGNING_CERT_PASSWORD -AsPlainText -Force)

Write-Host "--- :windows: Installing make"
choco install make

Write-Host "--- :npm: Installing dependencies"
npm ci --legacy-peer-deps

Write-Host "--- :lock_with_ink_pen: Decrypting secrets"
make decrypt_conf

Write-Host "--- :node: Building app"
make build

Write-Host "--- :windows: Packaging for Windows"
make package-win32 SKIP_BUILD=true

If ($LastExitCode -ne 0) { Exit $LastExitCode }
106 changes: 106 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
env:
BUILDKITE_PLUGINS_ALWAYS_CLONE_FRESH: 1
# Uncomment this to get more logs during the electron-builder calls.
# Useful for debugging, but very noisy
# DEBUG: electron-builder

steps:
- label: Lint
key: lint
env:
NODE_ENV: test
plugins:
- $NVM_PLUGIN
command: |
.buildkite/commands/install_node_dependencies.sh
echo "--- :eslint: Lint"
make lint
- label: Test
key: test
env:
NODE_ENV: test
plugins:
- $NVM_PLUGIN
command: |
.buildkite/commands/install_node_dependencies.sh
echo "--- :jest: Test"
npm test
# Notice that we build the app in each platform because it takes ~1-2 minutes
# to do so which is comparable to a dedicated build step, archiving the
# artifacts, uploading them, then downloading them in each package step.
#
# Also notice that we package for the different platforms on every build.
# It's up to the elector-builder configuration to decided whether to upload
# the artifacts to a GitHub release.
#
# See:
# - Makefile PUBLISH value
# - https://www.electron.build/configuration/publish

- label: Package on macOS
key: package-macos
agents:
queue: mac
env:
IMAGE_ID: $IMAGE_ID
CSC_FOR_PULL_REQUEST: true
plugins:
- $CI_TOOLKIT_PLUGIN
- $NVM_PLUGIN
command: |
.buildkite/commands/install_node_dependencies.sh
echo "--- Fetch code signing identity"
install_gems
bundle exec fastlane configure_code_signing
echo "--- Decrypt secrets"
make decrypt_conf
bundle exec fastlane run configure_apply
echo "--- Build"
make build
echo "--- Package"
make package-osx SKIP_BUILD=true
artifact_paths:
- release/*.dmg
- release/*.dmg.blockmap
- release/latest*.yml

- label: Package on Windows
key: package-windows
agents:
queue: windows
plugins:
- $CI_TOOLKIT_PLUGIN
command: .buildkite/commands/package_windows.ps1
env:
CSC_FOR_PULL_REQUEST: true
artifact_paths:
- release\*.exe
# Notice that this will not signed.
# electron-builder logs "AppX is not signed reason=Windows Store only build"
# The behavior occurs in CircleCI, too. See:
# https://app.circleci.com/pipelines/github/Automattic/simplenote-electron/3150/workflows/9970dee9-bc25-432a-a659-38ed5d4d1c36/jobs/25900?invite=true#step-106-66244_55
- release\*.appx
- release\*.blockmap
- release\*.yml

- label: Package on Linux
key: package-linux
plugins:
- $CI_TOOLKIT_PLUGIN
- $NVM_PLUGIN
command: |
.buildkite/commands/install_node_dependencies.sh
echo "--- Decrypt secrets"
make decrypt_conf
echo "--- Build"
make build
echo "--- Package"
make package-linux SKIP_BUILD=true
env:
CSC_FOR_PULL_REQUEST: true
artifact_paths:
- release/*.deb
- release/*.tar.gz
- release/*.yml
13 changes: 13 additions & 0 deletions .buildkite/shared-pipeline-vars
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

# This file is `source`'d before calling `buildkite-agent pipeline upload`, and can be used
# to set up some variables that will be interpolated in the `.yml` pipeline before uploading it.

# The ~> modifier is not currently used, but we check for it just in case
XCODE_VERSION=$(sed -E -n 's/^(~> )?(.*)/xcode-\2/p' .xcode-version)
CI_TOOLKIT_PLUGIN_VERSION='mokagio/windows-utils'
NVM_PLUGIN_VERSION='0.3.0'

export IMAGE_ID="$XCODE_VERSION"
export CI_TOOLKIT_PLUGIN="automattic/a8c-ci-toolkit#$CI_TOOLKIT_PLUGIN_VERSION"
export NVM_PLUGIN="automattic/nvm#$NVM_PLUGIN_VERSION"
4 changes: 4 additions & 0 deletions .bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
BUNDLE_PATH: "vendor/bundle"
BUNDLE_JOBS: "3"
BUNDLE_RETRY: "3"
Loading

0 comments on commit 02f18d6

Please sign in to comment.