Skip to content

Commit

Permalink
Merge pull request #298 from bitfinexcom/staging
Browse files Browse the repository at this point in the history
Release version 4.17.0
  • Loading branch information
ezewer authored Jan 11, 2024
2 parents e3e2917 + 421401d commit 2ef39b2
Show file tree
Hide file tree
Showing 22 changed files with 645 additions and 30 deletions.
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 .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'
125 changes: 122 additions & 3 deletions .github/workflows/build-electron-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,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 +76,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 Down Expand Up @@ -135,3 +149,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
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [4.17.0] - 2024-01-10

### Added

- Added ability to define what kind of API keys are stored `prod`/`staging`. The `prod`/`staging` is detected by existing the `staging` string in the restUrl config option: `https://api-pub.bitfinex.com`/`https://api.staging.bitfinex.com`. And `isStagingBfxApi` flag is set or updated on `signUp`/`signIn` to the `user` table. Than, `getUsers` endpoint will return the `isStagingBfxApi` flag to be shown in the UI for each user on the login stage. PR: [bfx-reports-framework#347](https://github.com/bitfinexcom/bfx-reports-framework/pull/347)
- Added automated testing for electron app binaries. The flow: build release on GitHub Actions, use unpacked builds for E2E tests, launch E2E test on Linux and Mac and Win OSs independently, provide E2E test reports for every OS launch. PR: [bfx-report-electron#276](https://github.com/bitfinexcom/bfx-report-electron/pull/276)

### Fixed

- Fixed `parentCellHeight` related warnings for the several column configurations. PR: [bfx-report-ui#749](https://github.com/bitfinexcom/bfx-report-ui/pull/749)
- Fixes skipping publishing of artifact for `Mac` by `electron-builder`. The issue came from this PR of `electron-builder`: [electron-builder#7715](https://github.com/electron-userland/electron-builder/pull/7715). PR: [bfx-report-electron#290](https://github.com/bitfinexcom/bfx-report-electron/pull/290)

### Security

- Replaced `Lodash` `_isEqual` helper usage all across the app with the corresponding one from the internal library for security reasons. PR: [bfx-report-ui#750](https://github.com/bitfinexcom/bfx-report-ui/pull/750)
- Resolved `dependabot` dependency updates: [bfx-report-electron#269](https://github.com/bitfinexcom/bfx-report-electron/pull/269), [bfx-report-electron#270](https://github.com/bitfinexcom/bfx-report-electron/pull/270), [bfx-report-electron#272](https://github.com/bitfinexcom/bfx-report-electron/pull/272), [bfx-report-electron#273](https://github.com/bitfinexcom/bfx-report-electron/pull/273), [bfx-report-electron#280](https://github.com/bitfinexcom/bfx-report-electron/pull/280). PR: [bfx-report-electron#289](https://github.com/bitfinexcom/bfx-report-electron/pull/289)

## [4.16.0] - 2023-12-13

### Added
Expand Down
30 changes: 24 additions & 6 deletions electron-builder-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const exec = promisify(require('child_process').exec)

let version
let zippedAppImageArtifactPath
let zippedMacArtifactPath
const appOutDirs = new Map()

/* eslint-disable no-template-curly-in-string */
Expand Down Expand Up @@ -107,6 +108,10 @@ module.exports = {
'build/icon.*',
'build/loader.*',
'!scripts${/*}',
'!test/${/*}',
'!electronEnv.json.example',
'!e2e-test-report.xml',
'!wdio.conf.js',

'!bfx-report-ui',
'bfx-report-ui/build',
Expand All @@ -133,6 +138,8 @@ module.exports = {
'!**/LICENSE.md',
'!**/.gitmodules',
'!**/.npmrc',
'!**/.mocharc.json',
'!**/.github/${/*}',
{
from: 'bfx-reports-framework/node_modules',
to: 'bfx-reports-framework/node_modules',
Expand All @@ -143,6 +150,16 @@ module.exports = {
to: 'bfx-report-ui/bfx-report-express/node_modules',
filter: nodeModulesFilter
},
{
from: 'node_modules/wdio-electron-service',
to: 'node_modules/wdio-electron-service',
filter: nodeModulesFilter
},
{
from: 'node_modules/wdio-electron-service/node_modules',
to: 'node_modules/wdio-electron-service/node_modules',
filter: nodeModulesFilter
},
...getNodeModulesSubSources('bfx-reports-framework'),
...getNodeModulesSubSources('bfx-report-ui/bfx-report-express')
],
Expand Down Expand Up @@ -189,24 +206,25 @@ module.exports = {
!targets.has('zip')
) {
targets.set('zip', {})
artifactPaths.push(path.join(
outDir,
`BitfinexReport-${version}-x64-${targetPlatform}.zip`
))
}

for (const [targetName] of targets) {
const ext = targetName === 'nsis'
? 'exe'
: targetName
const appFilePath = artifactPaths.find((path) => (
const foundAppFilePath = artifactPaths.find((path) => (
new RegExp(`${targetPlatform}.*${ext}$`, 'i').test(path)
))
const appFilePath = foundAppFilePath ?? path.join(
outDir,
`BitfinexReport-${version}-x64-${targetPlatform}.${ext}`
)

if (
targetPlatform === 'mac' &&
targetName === 'zip'
) {
zippedMacArtifactPath = appFilePath
macBlockmapFilePaths.push(
`${appFilePath}.blockmap`,
path.join(outDir, `${channel}-mac.yml`)
Expand Down Expand Up @@ -283,7 +301,7 @@ module.exports = {
}

const macFiles = macBlockmapFilePaths.length > 0
? [...artifactPaths, ...macBlockmapFilePaths]
? [zippedMacArtifactPath, ...macBlockmapFilePaths]
: []
const linuxFiles = zippedAppImageArtifactPath
? [zippedAppImageArtifactPath]
Expand Down
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ try {

const { app } = require('electron')

const isTestEnv = process.env.NODE_ENV === 'test'

const productName = require('./src/helpers/product-name')
app.setName(productName)

Expand All @@ -33,6 +35,10 @@ if (shouldQuit) {
} else {
;(async () => {
try {
if (isTestEnv) {
require('wdio-electron-service/main')
}

await initializeApp()
} catch (err) {
console.error(err)
Expand Down
Loading

0 comments on commit 2ef39b2

Please sign in to comment.