Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add apple signing and notarization workflow #291

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
d797bc5
Add main dev deps for e2e tests
ZIMkaRU Nov 1, 2023
8e47c61
Add base webdriverio config
ZIMkaRU Nov 1, 2023
03a1de1
Add test case for app title
ZIMkaRU Nov 1, 2023
d05239b
Expose electron api in test env for main process
ZIMkaRU Nov 1, 2023
a8037e8
Add preload script for browser windows
ZIMkaRU Nov 1, 2023
46c2f10
Expose electron api in test env for browser wins
ZIMkaRU Nov 1, 2023
1b95cd3
Add npm script to launch e2e tests
ZIMkaRU Nov 1, 2023
e1e74ea
Prevent removal app unpacked folder for e2e test runner
ZIMkaRU Nov 3, 2023
53aadf7
Improve wdio config
ZIMkaRU Nov 3, 2023
e6248b2
Rework electron-builder config to be able to launch e2e tests
ZIMkaRU Nov 3, 2023
f4b6c41
Fix app e2e test spec
ZIMkaRU Nov 3, 2023
c5fc5f3
Add junit reporter for wdio
ZIMkaRU Nov 3, 2023
45044a4
Add test reports to ignore files
ZIMkaRU Nov 3, 2023
2136dc0
Add linux e2e test runner to github actions
ZIMkaRU Nov 3, 2023
8e1c38e
Launch e2e test runner after builder job
ZIMkaRU Nov 6, 2023
1daca16
Add e2e test report workflow
ZIMkaRU Nov 6, 2023
b1b5b96
Fix issue with low uploading speed on gh actions
ZIMkaRU Nov 6, 2023
f653335
Fix deps installation for e2e tests
ZIMkaRU Nov 6, 2023
45acf89
Skip redundant files in build
ZIMkaRU Nov 7, 2023
db0fdb4
Run e2e tests headlessly by enabling xvfb
ZIMkaRU Nov 7, 2023
907e8cc
Bump electron up to 27.0.3
ZIMkaRU Nov 7, 2023
b6d3249
Add script for adding time attr to testsuites tag
ZIMkaRU Nov 7, 2023
7e7dfac
Normalize e2e test report before uploading
ZIMkaRU Nov 7, 2023
90f8f7c
Add mac e2e test runner
ZIMkaRU Nov 8, 2023
6f95691
Add mac e2e test reporter
ZIMkaRU Nov 8, 2023
29b6adf
Add cross-env for dev/test scripts
ZIMkaRU Nov 8, 2023
e8d29a0
Add win e2e test runner
ZIMkaRU Nov 8, 2023
72203b0
Add win e2e test reporter
ZIMkaRU Nov 8, 2023
d08b967
Bump actions/checkout up to v4
ZIMkaRU Nov 9, 2023
b6e070c
Fix unzipping win unpacked build
ZIMkaRU Nov 9, 2023
6d48bbb
Bump electron-builder up to 24.8.1 to have executable name fix
ZIMkaRU Nov 9, 2023
181f1af
Add common executableName opt for all builds
ZIMkaRU Nov 9, 2023
e28fb6b
Fix making mac app-update-yml in build
ZIMkaRU Nov 9, 2023
f935b67
Fix mac updater for new executable name
ZIMkaRU Nov 9, 2023
a8cfff1
Add correct app binary path to wdio conf according to os
ZIMkaRU Nov 9, 2023
4d03af9
Add bash script to turn uninterrupted e2e testing on macOS
ZIMkaRU Nov 10, 2023
d9b7060
Add gh workflow step to prepare mac e2e test runner
ZIMkaRU Nov 10, 2023
0b31eff
Move prepare-mac-runner script to local gh actions
ZIMkaRU Nov 10, 2023
cb35243
Use macos-11 in gh actions
ZIMkaRU Nov 10, 2023
aaf9e26
Prevent spaces in mac unique computer name
ZIMkaRU Nov 10, 2023
5c7fb5b
Fix electron issue with executableName specifying
ZIMkaRU Nov 10, 2023
9c12e64
Bump wdio up to 8.22.0
ZIMkaRU Nov 10, 2023
08b9a05
Bump electon up to 27.0.4
ZIMkaRU Nov 10, 2023
2ffbd3e
Disable enforce macos app location for e2e test runner
ZIMkaRU Nov 10, 2023
6ce902e
Use macos-12 in gh actions
ZIMkaRU Nov 10, 2023
3285cff
Fix npm start script
ZIMkaRU Nov 10, 2023
2af7deb
Fix browser window creation
ZIMkaRU Nov 10, 2023
f7bef63
Merge pull request #276 from ZIMkaRU/feature/add-automated-testing-fo…
ezewer Jan 2, 2024
16e763a
Bump app-builder-bin up to 4.2.0
ZIMkaRU Jan 3, 2024
c531419
Fix execute permission for app-builder-bin
ZIMkaRU Jan 3, 2024
a78cd9d
Bump standard up to 17.1.0
ZIMkaRU Jan 3, 2024
0a82d90
Fix code style considering standardjs 17
ZIMkaRU Jan 3, 2024
5afb233
Bump electron up to 27.2.0
ZIMkaRU Jan 3, 2024
5b9abfd
Bump electron-builder up to 24.10.0
ZIMkaRU Jan 3, 2024
e0d042a
Bump @mapbox/node-pre-gyp up to 1.0.11
ZIMkaRU Jan 3, 2024
ec8a4df
Bump get-port up to 7.0.0
ZIMkaRU Jan 3, 2024
9e0c2f8
Bump changelog-parser up to 3.0.1
ZIMkaRU Jan 3, 2024
8b6d527
Merge pull request #289 from ZIMkaRU/feature/resolve-dependabot-depen…
ezewer Jan 5, 2024
5fce0f5
Fix skipping publishing of artifact for mac by electron-builder
ZIMkaRU Jan 5, 2024
2d4869c
Merge pull request #290 from ZIMkaRU/bugfix/fix-skipping-publishing-o…
ezewer Jan 8, 2024
c0efffc
Provide apple credential env vars to mac-builder workflow
ZIMkaRU Nov 14, 2023
1daada8
Add apple credential env vars to .env file
ZIMkaRU Nov 14, 2023
609e1a5
Add required apple app sandbox entitlements
ZIMkaRU Nov 14, 2023
a9ef132
Add mac dmg target release
ZIMkaRU Nov 14, 2023
be0aeb6
Set mac type opt as distribution
ZIMkaRU Nov 14, 2023
5e0adfc
Enable dark mode support for mac
ZIMkaRU Nov 14, 2023
03c7866
Hardcode 11 minimum system version for mac
ZIMkaRU Nov 14, 2023
b0a6356
Add ability to set teamId from env var
ZIMkaRU Nov 14, 2023
994af02
Add ability to turn off notarizing
ZIMkaRU Jan 9, 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
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ bfx-report-ui/build
bfx-report-ui/bfx-report-express/logs/*.log
bfx-report-ui/bfx-report-express/config/*.json
stub.AppImage
e2e-test-report.xml
test-report.json
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@ IS_DEV_ENV=0
IS_AUTO_UPDATE_DISABLED=0
EP_GH_IGNORE_TIME=true
GH_TOKEN=

NOTARIZE=0
APPLE_TEAM_ID=
APPLE_ID=
APPLE_APP_SPECIFIC_PASSWORD=
CSC_LINK=
CSC_KEY_PASSWORD=
7 changes: 7 additions & 0 deletions .github/actions/prepare-mac-runner/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: 'Prepare Mac runner'
description: 'Turn uninterrupted testing on mac'
runs:
using: composite
steps:
- run: ${{ github.action_path }}/prepare-mac-runner.sh
shell: bash
23 changes: 23 additions & 0 deletions .github/actions/prepare-mac-runner/prepare-mac-runner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

# Turn uninterrupted testing on mac

# Change Local name to avoid name clash causing alert
uniqueComputerName="mac-e2e-test-runner-$RANDOM"
sudo scutil --set LocalHostName "$uniqueComputerName"
sudo scutil --set ComputerName "$uniqueComputerName"

# Close Notification window
sudo killall UserNotificationCenter || true

# Do not disturb
defaults -currentHost write com.apple.notificationcenterui doNotDisturb -boolean true
defaults -currentHost write com.apple.notificationcenterui doNotDisturbDate -date "`date -u +\"%Y-%m-%d %H:%M:%S +0000\"`"
sudo killall NotificationCenter

# Disable firewall
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
sudo /usr/libexec/ApplicationFirewall/socketfilterfw -k

# Close Finder Windows using Apple Script
sudo osascript -e 'tell application "Finder" to close windows'
138 changes: 135 additions & 3 deletions .github/workflows/build-electron-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ on:
isBfxApiStaging:
description: 'Is it necessary to use BFX API Staging? (true / 1)?'
required: false
isNotarizeDisabled:
description: 'Is notarize disabled (true / 1)?'
required: false

env:
DOCKER_BUILDKIT: 1
Expand All @@ -30,7 +33,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set repo owner
Expand Down Expand Up @@ -76,17 +79,31 @@ jobs:
max_attempts: 3
retry_on: any
command: ./scripts/launch.sh -lwp
- name: Zip Linux Unpacked build
run: zip -r dist/linux-unpacked.zip dist/linux-unpacked
- name: Upload Linux Unpacked build
uses: actions/upload-artifact@v3
with:
name: linux-unpacked
path: dist/linux-unpacked.zip
- name: Zip Win Unpacked build
run: zip -r dist/win-unpacked.zip dist/win-unpacked
- name: Upload Win Unpacked build
uses: actions/upload-artifact@v3
with:
name: win-unpacked
path: dist/win-unpacked.zip
- name: Prepare cache folders
run: |
sudo chown -R $(id -u):$(id -g) ~/.cache/electron
sudo chown -R $(id -u):$(id -g) ~/.cache/electron-builder

mac-builder:
timeout-minutes: 90
runs-on: macos-11
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set repo owner
Expand All @@ -104,6 +121,10 @@ jobs:
name: Turn off auto-update
run: |
echo "IS_AUTO_UPDATE_DISABLED=1" >> $GITHUB_ENV
- if: ${{ !contains(fromJson('["true", "1", true, 1]'), github.event.inputs.isNotarizeDisabled) }}
name: Turn on notarize
run: |
echo "NOTARIZE=1" >> $GITHUB_ENV
- if: contains(fromJson('["true", "1", true, 1]'), github.event.inputs.isBfxApiStaging)
name: Use BFX API Staging for queries
run: |
Expand All @@ -127,6 +148,12 @@ jobs:
uses: nick-fields/retry@v2
continue-on-error: false
env:
NOTARIZE: true
APPLE_TEAM_ID: ${{ secrets.BFX_APPLE_TEAM_ID }}
APPLE_ID: ${{ secrets.BFX_APPLE_ID_USERNAME }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.BFX_APPLE_ID_REPORT_PASSWORD }}
CSC_LINK: ${{ secrets.BFX_APPLE_BUILD_CERTIFICATE_B64 }}
CSC_KEY_PASSWORD: ${{ secrets.BFX_APPLE_BUILD_CERTIFICATE_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ELECTRON_CACHE: ~/Library/Caches/electron
with:
Expand All @@ -135,3 +162,108 @@ jobs:
max_attempts: 3
retry_on: any
command: ./scripts/build-release.sh -mp
- name: Zip Mac Unpacked build
run: zip -r dist/mac.zip dist/mac
- name: Upload Mac Unpacked build
uses: actions/upload-artifact@v3
with:
name: mac-unpacked
path: dist/mac.zip

linux-e2e-test-runner:
name: Linux E2E Test Runner
timeout-minutes: 30
runs-on: ubuntu-22.04
needs: [linux-win-docker-builder]
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 18.17.1
- name: Install main dev deps
run: npm i --development --no-audit --progress=false --force
- name: Download Linux Unpacked build
uses: actions/download-artifact@v3
with:
name: linux-unpacked
path: dist
- name: Unzip Linux Unpacked build
run: unzip dist/linux-unpacked.zip
- name: Run tests
uses: coactions/[email protected]
with:
run: npm run e2e
- name: Normalize E2E test report
run: node ./scripts/node/normalize-e2e-test-report e2e-test-report.xml
- name: Upload Linux E2E test results
uses: actions/upload-artifact@v3
with:
name: linux-e2e-test-results
path: e2e-test-report.xml

win-e2e-test-runner:
name: Win E2E Test Runner
timeout-minutes: 30
runs-on: windows-2022
needs: [linux-win-docker-builder]
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 18.17.1
- name: Install main dev deps
run: npm i --development --no-audit --progress=false --force
- name: Download Linux Unpacked build
uses: actions/download-artifact@v3
with:
name: win-unpacked
path: dist
- name: Unzip Win Unpacked build
run: 7z -y x dist/win-unpacked.zip
- name: Run tests
uses: coactions/[email protected]
with:
run: npm run e2e
- name: Normalize E2E test report
run: node ./scripts/node/normalize-e2e-test-report e2e-test-report.xml
- name: Upload Win E2E test results
uses: actions/upload-artifact@v3
with:
name: win-e2e-test-results
path: e2e-test-report.xml

mac-e2e-test-runner:
name: Mac E2E Test Runner
timeout-minutes: 30
runs-on: macos-12
needs: [mac-builder]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare Mac runner
uses: ./.github/actions/prepare-mac-runner
- uses: actions/setup-node@v3
with:
node-version: 18.17.1
- name: Install main dev deps
run: npm i --development --no-audit --progress=false --force
- name: Download Mac Unpacked build
uses: actions/download-artifact@v3
with:
name: mac-unpacked
path: dist
- name: Unzip Mac Unpacked build
run: unzip dist/mac.zip
- name: Run tests
uses: coactions/[email protected]
with:
run: npm run e2e
- name: Normalize E2E test report
run: node ./scripts/node/normalize-e2e-test-report e2e-test-report.xml
- name: Upload Mac E2E test results
uses: actions/upload-artifact@v3
with:
name: mac-e2e-test-results
path: e2e-test-report.xml
47 changes: 47 additions & 0 deletions .github/workflows/e2e-test-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: 'E2E Test Report'
run-name: 'E2E Test Report: Commit ${{ github.sha }}'

on:
workflow_run:
workflows: ['Build release']
types:
- completed

permissions:
contents: read
actions: read
checks: write

jobs:
e2e-web-page-report:
name: E2E Web Page Report
runs-on: ubuntu-22.04
steps:
- uses: dorny/test-reporter@v1
id: linux-e2e-test-results
with:
artifact: linux-e2e-test-results
name: Linux E2E Tests
path: e2e-test-report.xml
reporter: jest-junit
- uses: dorny/test-reporter@v1
id: win-e2e-test-results
with:
artifact: win-e2e-test-results
name: Win E2E Tests
path: e2e-test-report.xml
reporter: jest-junit
- uses: dorny/test-reporter@v1
id: mac-e2e-test-results
with:
artifact: mac-e2e-test-results
name: Mac E2E Tests
path: e2e-test-report.xml
reporter: jest-junit
- name: E2E Test Report Summary
run: |
echo "### E2E Test Report page is ready! :rocket:" >> $GITHUB_STEP_SUMMARY
echo "And available at the following links for applicable OSs:" >> $GITHUB_STEP_SUMMARY
echo "- [Linux](${{ steps.linux-e2e-test-results.outputs.url_html }})" >> $GITHUB_STEP_SUMMARY
echo "- [Win](${{ steps.win-e2e-test-results.outputs.url_html }})" >> $GITHUB_STEP_SUMMARY
echo "- [Mac](${{ steps.mac-e2e-test-results.outputs.url_html }})" >> $GITHUB_STEP_SUMMARY
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ package-lock.json
lastCommit.json
electronEnv.json
stub.AppImage
e2e-test-report.xml
test-report.json
10 changes: 10 additions & 0 deletions build/entitlements.mac.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.inherit</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
Expand All @@ -22,5 +24,13 @@
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
<key>com.apple.security.automation.apple-events</key>
<true/>
</dict>
</plist>
8 changes: 8 additions & 0 deletions build/entitlements.mas.inherit.plist
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,13 @@
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
<key>com.apple.security.automation.apple-events</key>
<true/>
</dict>
</plist>
6 changes: 6 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ services:
IS_DEV_ENV: ${IS_DEV_ENV:-0}
IS_AUTO_UPDATE_DISABLED: ${IS_AUTO_UPDATE_DISABLED:-0}
IS_PUBLISHED: ${IS_PUBLISHED:-0}
NOTARIZE: ${NOTARIZE:-}
APPLE_TEAM_ID: ${APPLE_TEAM_ID:-}
APPLE_ID: ${APPLE_ID:-}
APPLE_APP_SPECIFIC_PASSWORD: ${APPLE_APP_SPECIFIC_PASSWORD:-}
CSC_LINK: ${CSC_LINK:-}
CSC_KEY_PASSWORD: ${CSC_KEY_PASSWORD:-}
GH_TOKEN: ${GH_TOKEN:-}
GITHUB_TOKEN: ${GITHUB_TOKEN:-}
EP_GH_IGNORE_TIME: ${EP_GH_IGNORE_TIME:-true}
Expand Down
Loading