Skip to content

Commit

Permalink
sadds
Browse files Browse the repository at this point in the history
  • Loading branch information
dfunckt committed Nov 15, 2023
1 parent e145aa7 commit 1bd9e0d
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 46 deletions.
52 changes: 14 additions & 38 deletions .github/actions/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ runs:

- name: Extract custom source artifact
if: runner.os != 'Windows'
shell: pwsh
shell: bash
working-directory: .
run: tar -xf ${{ runner.temp }}/custom.tgz

Expand All @@ -47,7 +47,7 @@ runs:

- name: Install host dependencies
if: runner.os == 'Linux'
shell: bash --noprofile --norc -eo pipefail -x {0}
shell: bash
run: |
set -ea
sudo apt-get update
Expand All @@ -66,7 +66,7 @@ runs:
# https://dev.to/rwwagner90/signing-electron-apps-with-github-actions-4cof
- name: Import Apple code signing certificate
if: runner.os == 'macOS'
shell: bash --noprofile --norc -eo pipefail -x {0}
shell: bash
run: |
KEY_CHAIN=build.keychain
CERTIFICATE_P12=certificate.p12
Expand Down Expand Up @@ -103,45 +103,21 @@ runs:

- name: Package release
id: package_release
shell: bash --noprofile --norc -eo pipefail -x {0}
if: runner.os != 'Windows'
shell: bash
run: |
set -ea
[[ '${{ inputs.VERBOSE }}' =~ on|On|Yes|yes|true|True ]] && set -x
runner_os="$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')"
./build/make-all.sh
APPLICATION_VERSION="$(jq -r '.version' package.json)"
if [[ $runner_os =~ linux ]]; then
BUILD_ARCH=x64
npm run make -- --arch="${BUILD_ARCH}"
elif [[ $runner_os =~ darwin|macos|osx ]]; then
BUILD_ARCH=x64,arm64
npm run make -- --arch="${BUILD_ARCH}"
elif [[ $runner_os =~ windows|win ]]; then
BUILD_ARCH=ia32,x64
npm run make-debug-win -- --arch="${BUILD_ARCH}"
else
echo "ERROR: unexpected runner OS: ${runner_os}"
exit 1
fi
echo "version=${APPLICATION_VERSION}" >> $GITHUB_OUTPUT
# collect all artifacts from subdirectories under a common top-level directory
mkdir -p dist
find ./out/make -type f \( \
-iname "*.zip" -o \
-iname "*.dmg" -o \
-iname "*.rpm" -o \
-iname "*.deb" -o \
-iname "*.AppImage" -o \
-iname "*Setup.exe" \
\) -ls -exec cp '{}' dist/ \;
- name: Package release
id: package_release
if: runner.os == 'Windows'
shell: powershell # npm run make fails on bash on windows
run: |
./build/make-all.sh
APPLICATION_VERSION="$(jq -r '.version' package.json)"
echo "version=${APPLICATION_VERSION}" >> $GITHUB_OUTPUT
env:
# ensure we sign the artifacts
Expand Down
4 changes: 1 addition & 3 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ runs:
shell: bash --noprofile --norc -eo pipefail -x {0}
run: |
set -ea
runner_os="$(echo "${RUNNER_OS}" | tr '[:upper:]' '[:lower:]')"
npm ci
npm run package
npm run test-${runner_os}
./build/test-all.sh
env:
# https://www.electronjs.org/docs/latest/api/environment-variables
ELECTRON_NO_ATTACH_CONSOLE: 'true'
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ out/

# ---- Do not modify entries above this line ----

# Build artifacts
dist/

# Certificates
*.spc
*.pvk
Expand Down
33 changes: 33 additions & 0 deletions build/make-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

set -ea

if [[ "$VERBOSE" =~ 1|on|On|Yes|yes|true|True ]]; then
set +x
export DEBUG='electron-forge:*,electron-packager,electron-rebuild'
fi

case "$(uname -s)" in
"Linux")
TARGET_ARCH=x64
;;
"Darwin")
TARGET_ARCH=x64,arm64
;;
"Windows"*|"MINGW"*|"MSYS"*)
TARGET_ARCH=ia32,x64
;;
esac

npm run make -- --arch="$TARGET_ARCH"

# collect all artifacts from subdirectories under a common top-level directory
mkdir -p dist
find ./out/make -type f \( \
-iname "*.zip" -o \
-iname "*.dmg" -o \
-iname "*.rpm" -o \
-iname "*.deb" -o \
-iname "*.AppImage" -o \
-iname "*Setup.exe" \
\) -ls -exec cp '{}' dist/ \;
23 changes: 23 additions & 0 deletions build/test-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -ea

if [[ "$VERBOSE" =~ 1|on|On|Yes|yes|true|True ]]; then
set +x
export DEBUG='electron-forge:*,electron-packager,electron-rebuild'
fi

npm run package
npm run lint

case "$(uname -s)" in
"Linux")
xvfb-run --auto-servernum npm run test-gui && xvfb-run --auto-servernum npm run test-shared
;;
"Darwin")
npm run test-gui && npm run test-shared
;;
"Windows"*|"MINGW"*|"MSYS"*)
npm run test-gui && npm run test-shared
;;
esac
4 changes: 3 additions & 1 deletion forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { MakerDMG } from '@electron-forge/maker-dmg';
import { MakerAppImage } from '@reforged/maker-appimage';
import { AutoUnpackNativesPlugin } from '@electron-forge/plugin-auto-unpack-natives';
import { WebpackPlugin } from '@electron-forge/plugin-webpack';
import { ResourcePlugin } from 'electron-forge-resource-plugin';
// import { ResourcePlugin } from 'electron-forge-resource-plugin';

import { mainConfig, rendererConfig } from './webpack.config';

Expand Down Expand Up @@ -134,6 +134,7 @@ const config: ForgeConfig = {
],
},
}),
/*
new ResourcePlugin({
env: 'ETCHER_UTIL_BIN_PATH',
path: `out/sidecar/bin/etcher-util${process.platform === 'win32' ? '.exe' : ''}`,
Expand All @@ -142,6 +143,7 @@ const config: ForgeConfig = {
sources: './lib/util/',
},
}),
*/
],
};

Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
"lint": "npm run lint-ts && npm run lint-css",
"test-gui": "electron-mocha --recursive --reporter spec --window-config tests/gui/window-config.json --require ts-node/register/transpile-only --require-main tests/gui/allow-renderer-process-reuse.ts --full-trace --no-sandbox --renderer tests/gui/**/*.ts",
"test-shared": "electron-mocha --recursive --reporter spec --require ts-node/register/transpile-only --require-main tests/gui/allow-renderer-process-reuse.ts --full-trace --no-sandbox tests/shared/**/*.ts",
"test-windows": "npm run lint && npm run test-gui && npm run test-shared",
"test-macos": "npm run lint && npm run test-gui && npm run test-shared",
"test-linux": "npm run lint && xvfb-run --auto-servernum npm run test-gui && xvfb-run --auto-servernum npm run test-shared",
"test": "echo npm run test-{linux,windows,macos}",
"test": "build/test-all.sh",
"package": "electron-forge package",
"start": "electron-forge start",
"make": "electron-forge make"
Expand Down

0 comments on commit 1bd9e0d

Please sign in to comment.