Skip to content

Commit 2faeccc

Browse files
authored
Merge pull request #102 from pol-rivero/upstream-merge
Upstream merge
2 parents 56ac5cd + c2f47e1 commit 2faeccc

24 files changed

Lines changed: 1826 additions & 175 deletions
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Setup CI Environment
2+
description: Set up Python, Node.js, optional ffmpeg, and install dependencies.
3+
4+
inputs:
5+
node-version:
6+
description: Node.js version to use.
7+
required: true
8+
arch:
9+
description: Target architecture for dependency installation.
10+
required: true
11+
install-ffmpeg:
12+
description: Whether to install ffmpeg on Windows.
13+
required: false
14+
default: 'false'
15+
16+
runs:
17+
using: composite
18+
steps:
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.11'
22+
23+
- name: Use Node.js ${{ inputs.node-version }}
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ inputs.node-version }}
27+
cache: yarn
28+
29+
- name: Install ffmpeg
30+
if: ${{ runner.os == 'Windows' && inputs.install-ffmpeg == 'true' }}
31+
shell: bash
32+
run: choco install ffmpeg --yes --no-progress
33+
34+
- name: Install and build dependencies
35+
shell: bash
36+
run: yarn
37+
env:
38+
npm_config_arch: ${{ inputs.arch }}
39+
TARGET_ARCH: ${{ inputs.arch }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Setup Windows Signing
2+
description: Install Azure Code Signing prerequisites and authenticate.
3+
4+
inputs:
5+
enabled:
6+
description: Whether Windows signing setup should run.
7+
required: false
8+
default: 'false'
9+
azure-client-id:
10+
description: Azure Code Signing client ID.
11+
required: false
12+
azure-tenant-id:
13+
description: Azure Code Signing tenant ID.
14+
required: false
15+
16+
runs:
17+
using: composite
18+
steps:
19+
- name: Install Azure Code Signing Client
20+
if: ${{ runner.os == 'Windows' && inputs.enabled == 'true' }}
21+
shell: pwsh
22+
run: |
23+
$acsZip = Join-Path $env:RUNNER_TEMP "acs.zip"
24+
$acsDir = Join-Path $env:RUNNER_TEMP "acs"
25+
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/Microsoft.Trusted.Signing.Client/1.0.95 -OutFile $acsZip -Verbose
26+
Expand-Archive $acsZip -Destination $acsDir -Force -Verbose
27+
Copy-Item -Path "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\*" -Include signtool.exe,signtool.exe.manifest,Microsoft.Windows.Build.Signing.mssign32.dll.manifest,mssign32.dll,Microsoft.Windows.Build.Signing.wintrust.dll.manifest,wintrust.dll,Microsoft.Windows.Build.Appx.AppxSip.dll.manifest,AppxSip.dll,Microsoft.Windows.Build.Appx.AppxPackaging.dll.manifest,AppxPackaging.dll,Microsoft.Windows.Build.Appx.OpcServices.dll.manifest,OpcServices.dll -Destination "node_modules\electron-winstaller\vendor" -Verbose
28+
29+
- name: Azure Login (OIDC)
30+
if: ${{ runner.os == 'Windows' && inputs.enabled == 'true' }}
31+
uses: azure/login@v2
32+
with:
33+
client-id: ${{ inputs.azure-client-id }}
34+
tenant-id: ${{ inputs.azure-tenant-id }}
35+
allow-no-subscriptions: true

.github/workflows/ci.yml

Lines changed: 138 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,10 @@ jobs:
137137
repository: ${{ inputs.repository || github.repository }}
138138
ref: ${{ inputs.ref }}
139139
submodules: recursive
140-
- uses: actions/setup-python@v6
141-
with:
142-
python-version: '3.11'
143-
- name: Use Node.js ${{ env.NODE_VERSION }}
144-
uses: actions/setup-node@v6
140+
- uses: ./.github/actions/setup-ci-environment
145141
with:
146142
node-version: ${{ env.NODE_VERSION }}
147-
cache: yarn
148-
- name: Install and build dependencies
149-
run: yarn
150-
env:
151-
npm_config_arch: ${{ matrix.arch }}
152-
TARGET_ARCH: ${{ matrix.arch }}
143+
arch: ${{ matrix.arch }}
153144
- name: Validate macOS version
154145
if: runner.os == 'macOS'
155146
run: yarn validate-macos-version
@@ -189,22 +180,12 @@ jobs:
189180
run: yarn test:unit
190181
- name: Run script tests
191182
run: yarn test:script
192-
- name: Install Azure Code Signing Client
193-
if: ${{ runner.os == 'Windows' }}
194-
run: |
195-
$acsZip = Join-Path $env:RUNNER_TEMP "acs.zip"
196-
$acsDir = Join-Path $env:RUNNER_TEMP "acs"
197-
Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/Microsoft.Trusted.Signing.Client/1.0.95 -OutFile $acsZip -Verbose
198-
Expand-Archive $acsZip -Destination $acsDir -Force -Verbose
199-
# Replace ancient signtool in electron-winstall with one that supports ACS
200-
Copy-Item -Path "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\*" -Include signtool.exe,signtool.exe.manifest,Microsoft.Windows.Build.Signing.mssign32.dll.manifest,mssign32.dll,Microsoft.Windows.Build.Signing.wintrust.dll.manifest,wintrust.dll,Microsoft.Windows.Build.Appx.AppxSip.dll.manifest,AppxSip.dll,Microsoft.Windows.Build.Appx.AppxPackaging.dll.manifest,AppxPackaging.dll,Microsoft.Windows.Build.Appx.OpcServices.dll.manifest,OpcServices.dll -Destination "node_modules\electron-winstaller\vendor" -Verbose
201-
- name: Azure Login (OIDC)
202-
if: ${{ runner.os == 'Windows' && inputs.sign }}
203-
uses: azure/login@v2
183+
- if: runner.os == 'Windows'
184+
uses: ./.github/actions/setup-windows-signing
204185
with:
205-
client-id: ${{ secrets.AZURE_CODE_SIGNING_CLIENT_ID }}
206-
tenant-id: ${{ secrets.AZURE_CODE_SIGNING_TENANT_ID }}
207-
allow-no-subscriptions: true
186+
enabled: ${{ inputs.sign }}
187+
azure-client-id: ${{ secrets.AZURE_CODE_SIGNING_CLIENT_ID }}
188+
azure-tenant-id: ${{ secrets.AZURE_CODE_SIGNING_TENANT_ID }}
208189
- name: Package production app
209190
run: yarn package
210191
env:
@@ -233,6 +214,137 @@ jobs:
233214
dist/bundle-size.json
234215
if-no-files-found: error
235216

217+
e2e-smoke:
218+
name: E2E Smoke ${{ matrix.friendlyName }} ${{ matrix.arch }}
219+
runs-on: ${{ matrix.os }}
220+
permissions:
221+
contents: read
222+
id-token: write
223+
strategy:
224+
fail-fast: false
225+
matrix:
226+
include:
227+
- os: macos-14
228+
friendlyName: macOS
229+
arch: arm64
230+
- os: windows-2022
231+
friendlyName: Windows
232+
arch: x64
233+
timeout-minutes: 60
234+
environment: ${{ inputs.environment }}
235+
env:
236+
RELEASE_CHANNEL: ${{ inputs.environment }}
237+
steps:
238+
- uses: actions/checkout@v4
239+
with:
240+
repository: ${{ inputs.repository || github.repository }}
241+
ref: ${{ inputs.ref }}
242+
submodules: recursive
243+
- uses: ./.github/actions/setup-ci-environment
244+
with:
245+
node-version: ${{ env.NODE_VERSION }}
246+
arch: ${{ matrix.arch }}
247+
install-ffmpeg: 'true'
248+
- name: Build production app
249+
run: yarn build:prod
250+
env:
251+
DESKTOP_E2E_UPDATES_URL: http://127.0.0.1:51789/update
252+
DESKTOP_OAUTH_CLIENT_ID: ${{ secrets.DESKTOP_OAUTH_CLIENT_ID }}
253+
DESKTOP_OAUTH_CLIENT_SECRET:
254+
${{ secrets.DESKTOP_OAUTH_CLIENT_SECRET }}
255+
APPLE_ID: ${{ secrets.APPLE_ID }}
256+
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
257+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
258+
APPLE_APPLICATION_CERT: ${{ secrets.APPLE_APPLICATION_CERT }}
259+
KEY_PASSWORD: ${{ secrets.APPLE_APPLICATION_CERT_PASSWORD }}
260+
npm_config_arch: ${{ matrix.arch }}
261+
TARGET_ARCH: ${{ matrix.arch }}
262+
- name: Prepare testing environment
263+
run: yarn test:setup
264+
env:
265+
npm_config_arch: ${{ matrix.arch }}
266+
- if: runner.os == 'Windows'
267+
uses: ./.github/actions/setup-windows-signing
268+
with:
269+
enabled: ${{ inputs.sign }}
270+
azure-client-id: ${{ secrets.AZURE_CODE_SIGNING_CLIENT_ID }}
271+
azure-tenant-id: ${{ secrets.AZURE_CODE_SIGNING_TENANT_ID }}
272+
- name: Package production app
273+
run: yarn package
274+
env:
275+
npm_config_arch: ${{ matrix.arch }}
276+
AZURE_TENANT_ID: ${{ secrets.AZURE_CODE_SIGNING_TENANT_ID }}
277+
AZURE_CLIENT_ID: ${{ secrets.AZURE_CODE_SIGNING_CLIENT_ID }}
278+
- name: Install app on macOS
279+
if: runner.os == 'macOS'
280+
run: |
281+
rm -rf "/Applications/GitHub Desktop Plus.app"
282+
ditto "dist/GitHub Desktop Plus-darwin-arm64/GitHub Desktop Plus.app" "/Applications/GitHub Desktop Plus.app"
283+
echo "DESKTOP_E2E_APP_PATH=/Applications/GitHub Desktop Plus.app/Contents/MacOS/GitHub Desktop Plus" >> "$GITHUB_ENV"
284+
- name: Install app on Windows
285+
if: runner.os == 'Windows'
286+
shell: pwsh
287+
run: |
288+
function Write-SquirrelLogs {
289+
$logPaths = @(
290+
"$env:LOCALAPPDATA\SquirrelSetup.log",
291+
"$env:LOCALAPPDATA\GitHubDesktopPlus\SquirrelSetup.log"
292+
)
293+
294+
foreach ($logPath in $logPaths) {
295+
if (Test-Path $logPath) {
296+
Write-Host "Showing log: $logPath"
297+
Get-Content $logPath -Tail 200
298+
}
299+
}
300+
}
301+
302+
$setupExe = Get-ChildItem "dist/GitHubDesktopPlus-*-windows-${{ matrix.arch }}.exe" -ErrorAction SilentlyContinue |
303+
Sort-Object FullName -Descending |
304+
Select-Object -First 1 -ExpandProperty FullName
305+
306+
if (-not $setupExe) {
307+
throw "Unable to locate Windows installer executable"
308+
}
309+
310+
$installer = Start-Process -FilePath $setupExe -ArgumentList "/S" -PassThru
311+
312+
try {
313+
Wait-Process -Id $installer.Id -Timeout 300 -ErrorAction Stop
314+
} catch {
315+
Write-SquirrelLogs
316+
throw "Windows installer timed out after 300 seconds"
317+
}
318+
319+
Get-Process GitHubDesktopPlus -ErrorAction SilentlyContinue | Stop-Process -Force
320+
321+
$installedExe = $null
322+
for ($attempt = 0; $attempt -lt 30 -and -not $installedExe; $attempt++) {
323+
$installedExe = Get-ChildItem "$env:LOCALAPPDATA\GitHubDesktopPlus\app-*\GitHubDesktopPlus.exe" -ErrorAction SilentlyContinue |
324+
Sort-Object FullName -Descending |
325+
Select-Object -First 1 -ExpandProperty FullName
326+
327+
if (-not $installedExe) {
328+
Start-Sleep -Seconds 2
329+
}
330+
}
331+
332+
if (-not $installedExe) {
333+
Write-SquirrelLogs
334+
throw "Unable to locate installed GitHub Desktop executable"
335+
}
336+
337+
Add-Content -Path $env:GITHUB_ENV -Value "DESKTOP_E2E_APP_PATH=$installedExe"
338+
- name: Run packaged E2E smoke tests
339+
run: yarn test:e2e:run:packaged
340+
- name: Upload E2E artifacts
341+
if: ${{ always() }}
342+
uses: actions/upload-artifact@v4
343+
with:
344+
name: e2e-${{matrix.friendlyName}}-${{matrix.arch}}
345+
path: playwright-videos/**
346+
if-no-files-found: warn
347+
236348
release_github:
237349
name: Create GitHub release
238350
needs: [build, compute_version]

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ junit*.xml
2020
*.swp
2121
tslint-rules/
2222
script/release_notes.txt
23+
playwright-videos/

app/app-info.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function getReplacements() {
4646
__DEV__: isDevBuild,
4747
__DEV_SECRETS__: isDevBuild || !process.env.DESKTOP_OAUTH_CLIENT_SECRET,
4848
__RELEASE_CHANNEL__: s(channel),
49-
__UPDATES_URL__: s(getUpdatesURL()),
49+
__UPDATES_URL__: s(process.env.DESKTOP_E2E_UPDATES_URL ?? getUpdatesURL()),
5050
__SHA__: s(getSHA()),
5151
'process.platform': s(process.platform),
5252
'process.env.NODE_ENV': s(process.env.NODE_ENV || 'development'),

app/src/ui/app.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,6 +1563,8 @@ export class App extends React.Component<IAppProps, IAppState> {
15631563
dispatcher={this.props.dispatcher}
15641564
repository={popup.repository}
15651565
branch={popup.branch}
1566+
accounts={this.state.accounts}
1567+
cachedRepoRulesets={this.state.cachedRepoRulesets}
15661568
onDismissed={onPopupDismissedFn}
15671569
/>
15681570
)

app/src/ui/branches/branch-list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ export class BranchList extends React.Component<IBranchListProps> {
373373

374374
private onRenderNewButton = () => {
375375
return this.props.canCreateNewBranch ? (
376-
<Button onClick={this.onCreateNewBranch}>
376+
<Button className="new-branch-button" onClick={this.onCreateNewBranch}>
377377
<Octicon symbol={octicons.plus} className="mr" />
378378
{__DARWIN__ ? 'New Branch' : 'New branch'}
379379
</Button>

0 commit comments

Comments
 (0)