-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added build for MacOS-12; added store on wdio-electron custom api; si…
…mplified test's setup
- Loading branch information
Showing
8 changed files
with
267 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: Build electron application as dmg package on MacOS | ||
|
||
on: | ||
workflow_call: | ||
secrets: | ||
token: | ||
required: true | ||
|
||
jobs: | ||
|
||
build-macos-12: | ||
runs-on: macos-12 | ||
|
||
steps: | ||
|
||
- name: Checkout Git repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Variables helpers | ||
id: setup | ||
run: | | ||
KRUX_VERSION=`node -e "console.log(require('./package.json').version)"` | ||
echo "app-version=$KRUX_VERSION" >> $GITHUB_OUTPUT | ||
KRUX_NAME=krux-installer_$KRUX_VERSION | ||
echo "app-name=$KRUX_NAME" >> $GITHUB_OUTPUT | ||
echo "::group::Variables" | ||
echo "app-version=$KRUX_VERSION" | ||
echo "app-name=$KRUX_NAME" | ||
echo "::endgroup::" | ||
- name: Install dependencies | ||
run: yarn install | ||
|
||
#- name: Install chromedriver | ||
#env: | ||
#CHROMEDRIVER_VERSION: '114.0.5735.90' | ||
#ZIPFILE: 'chromedriver_mac64.zip' | ||
#DESTDIR: './node_modules/chromedriver/bin' | ||
#ZIPURI: 'https://chromedriver.storage.googleapis.com' | ||
#run: | | ||
#curl -o ${TMPDIR}${ZIPFILE} $ZIPURI/$CHROMEDRIVER_VERSION/$ZIPFILE | ||
#unzip -o ${TMPDIR}${ZIPFILE} -d $DESTDIR | ||
|
||
#- name: List chromedriver binaries | ||
#run: ls -la node_modules/chromedriver/bin | ||
|
||
#- name: Pre-test chromedriver | ||
#run: ./node_modules/chromedriver/bin/chromedriver --version | ||
|
||
- name: Build electron app | ||
env: | ||
GH_TOKEN: ${{ secrets.token }} | ||
run: yarn run build --macos dmg | ||
|
||
- name: Hash electron app | ||
uses: qlrd/sha256sum-action@v2 | ||
with: | ||
working-directory: ./release/${{ steps.setup.outputs.app-version }} | ||
file: ${{ steps.setup.outputs.app-name }}.dmg | ||
ext: sha256.txt | ||
|
||
- name: List release files | ||
run: | | ||
echo "::group::Release files" | ||
ls -la release/${{ steps.setup.outputs.app-version }} | ||
echo "::endgroup::" | ||
echo "::group::Unpacked files" | ||
ls -la release/${{ steps.setup.outputs.app-version }}/mac | ||
echo "::endgroup::" | ||
echo "::group::Unpacked .app directory" | ||
ls -la release/${{ steps.setup.outputs.app-version }}/mac/krux-installer.app | ||
echo "::endgroup::" | ||
echo "::group::Unpacked .app/Contents directory" | ||
ls -la release/${{ steps.setup.outputs.app-version }}/mac/krux-installer.app/Contents | ||
echo "::endgroup::" | ||
echo "::group::Unpacked .app/Contents/Frameworks directory" | ||
ls -la release/${{ steps.setup.outputs.app-version }}/mac/krux-installer.app/Contents/Frameworks | ||
echo "::endgroup::" | ||
echo "::group::Unpacked .app/Contents/MacOS directory" | ||
ls -la release/${{ steps.setup.outputs.app-version }}/mac/krux-installer.app/Contents/MacOS | ||
echo "::endgroup::" | ||
echo "::group::Unpacked .app/Contents/Resources directory" | ||
ls -la release/${{ steps.setup.outputs.app-version }}/mac/krux-installer.app/Contents/Resources | ||
echo "::endgroup::" | ||
- name: E2E test electron app | ||
env: | ||
DEBUG: 'krux:*' | ||
run: ./node_modules/.bin/wdio run wdio.conf.mts | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ runner.os }}-${{ steps.setup.outputs.app-name }}-dmg | ||
retention-days: 5 | ||
path: | | ||
release/${{ steps.setup.outputs.app-version }}/${{ steps.setup.outputs.app-name }}.dmg | ||
release/${{ steps.setup.outputs.app-version }}/${{ steps.setup.outputs.app-name }}.dmg.sha256.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
const { readdir, readFile } = require('fs/promises') | ||
const { join } = require('path') | ||
const expectChai = require('chai').expect | ||
const { browser } = require('@wdio/globals') | ||
const { describe, it } = require('mocha') | ||
const { version } = require('../../../package.json') | ||
|
||
describe('KruxInstaller configuration', () => { | ||
|
||
it('should \'appData\' path exist with \'krux-installer\' directory', async () => { | ||
try { | ||
const api = await browser.electron.api() as Record<string, string> | ||
const list = await readdir(api.appData) | ||
expectChai(list.includes('krux-installer')).to.be.true | ||
} catch (error) { | ||
console.log(error) | ||
} | ||
}) | ||
|
||
it('should \'documents\' path exist with \'krux-installer\' directory', async () => { | ||
try { | ||
const api = await browser.electron.api() as Record<string, string> | ||
const list = await readdir(api.documents) | ||
expectChai(list.includes('krux-installer')).to.be.true | ||
} catch (error) { | ||
console.log(error) | ||
} | ||
}) | ||
|
||
it('should \'config.json\' file exists inside \'krux-installer\' directory', async () => { | ||
try { | ||
const api = await browser.electron.api() as Record<string, string> | ||
const dir = join(api.appData, 'krux-installer') | ||
const list = await readdir(dir) | ||
expectChai(list.includes('config.json')).to.be.true | ||
} catch (error) { | ||
console.log(error) | ||
} | ||
}) | ||
|
||
it('should \'config.json\' be a readable string', async () => { | ||
try { | ||
const api = await browser.electron.api() as Record<string, string> | ||
const filePath = join(api.appData, 'krux-installer', 'config.json') | ||
const file = await readFile(filePath) | ||
expectChai(file).to.be.a('string') | ||
} catch (error) { | ||
console.log(error) | ||
} | ||
}) | ||
|
||
}) |
Oops, something went wrong.