Skip to content

Commit

Permalink
ci: build binaries on multi-platforms
Browse files Browse the repository at this point in the history
hdiutil was removed because it uses old APIs, and fails to build. there
is no reference in the commit in which it was added to package.json.
it looks to me that hdiutil is not maintained.

update electron-builder. version 14.5.x is too old and has bugs on macos
and Windows. at least, 21.2.x is required to build the code.
see electron-userland/electron-builder#3990
for example.

for ARCH, `amd64` and `i386` are chosen because they are widely used,
and what `uname -m` returns. i'm open for alternatives.

there are too many `if: matrix.OS == 'windows'`. just to absorb path
separator difference. when Windows Subsystem for Linux, or WSL, is
available on hosted GitHub Actions runners, they can be removed. maybe,
MSYS2 has solutions, but i did not go father because i need a working
workflow first. see available software at:
https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md
  • Loading branch information
trombik committed Jul 14, 2020
1 parent b5b8e19 commit 91ee4c1
Show file tree
Hide file tree
Showing 3 changed files with 1,154 additions and 894 deletions.
175 changes: 175 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
---
name: Release CI
on:
- push
- pull_request

jobs:
build:
runs-on: ${{ matrix.RUNNER_PLATFORM }}
strategy:
matrix:
version:
- linux-amd64
- macos-amd64
- windows-amd64
# XXX probably, 32 bit Windows is not so common, but built it
# anyway to see if the workflow has portability issues.
- windows-i386
include:
- version: linux-amd64
OS: linux
ARCH: amd64
RUNNER_PLATFORM: ubuntu-latest
ELECTRON_BUILDER_FLAGS: --linux
# XXX ldd /root/.cache/electron-builder/AppImage/AppImage-09-07-16-linux/xorriso
# libreadline.so.6 => not found
BUILD_DEPEND: graphicsmagick xz-utils xorriso
BUILD_ENVIRONMENT_VAR: USE_SYSTEM_XORRISO=true
BUILD_ARTIFACT_FILE_EXT: AppImage
PKG_INSTALL_CMD: sudo apt-get install
- version: macos-amd64
OS: macos
ARCH: amd64
RUNNER_PLATFORM: macos-latest
ELECTRON_BUILDER_FLAGS: --macos
BUILD_DEPEND: ${{ false }}
BUILD_ENVIRONMENT_VAR: ""
BUILD_ARTIFACT_FILE_EXT: dmg
PKG_INSTALL_CMD: brew install
- version: windows-i386
OS: windows
ARCH: i386
RUNNER_PLATFORM: windows-latest
ELECTRON_BUILDER_FLAGS: --ia32
BUILD_DEPEND: ${{ false }}
BUILD_ENVIRONMENT_VAR: ""
BUILD_ARTIFACT_FILE_EXT: exe
PKG_INSTALL_CMD: ""
- version: windows-amd64
OS: windows
ARCH: amd64
RUNNER_PLATFORM: windows-latest
ELECTRON_BUILDER_FLAGS: --x64
BUILD_DEPEND: ${{ false }}
BUILD_ENVIRONMENT_VAR: ""
BUILD_ARTIFACT_FILE_EXT: exe
PKG_INSTALL_CMD: ""
node-version:
- 10.x
steps:
- name: Install required packages
if: matrix.BUILD_DEPEND
run: ${{ matrix.PKG_INSTALL_CMD }} ${{ matrix.BUILD_DEPEND }}

- name: Checkout lw.comm-server
uses: actions/checkout@v2
with:
path: lw.comm-server

- name: Checkout LaserWeb4
uses: actions/checkout@v2
with:
repository: trombik/LaserWeb4
path: LaserWeb4
ref: sync-package-json
# keep all history. other step needs commit logs.
fetch-depth: 0

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache npm
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Build LaserWeb4 (Unix)
if: matrix.OS != 'windows'
run: |
cd ${GITHUB_WORKSPACE}/LaserWeb4
npm ci
npm run installdev
npm run bundle-dev
- name: Build LaserWeb4 (Windows)
if: matrix.OS == 'windows'
shell: cmd
run: |
cd %GITHUB_WORKSPACE%\LaserWeb4
npm ci
npm run installdev
npm run bundle-dev
- name: Run npm ci in lw.comm-server (Unix)
if: matrix.OS != 'windows'
run: |
cd ${GITHUB_WORKSPACE}/lw.comm-server
npm ci
- name: Run npm ci in lw.comm-server (Windows)
if: matrix.OS == 'windows'
shell: cmd
run: |
cd %GITHUB_WORKSPACE%\lw.comm-server
npm ci
- name: Rebuild electron (Unix)
if: matrix.OS != 'windows'
run: |
cd ${GITHUB_WORKSPACE}/lw.comm-server
./node_modules/.bin/electron-rebuild
- name: Rebuild electron (Windows)
if: matrix.OS == 'windows'
shell: cmd
run: |
cd %GITHUB_WORKSPACE%\lw.comm-server
.\node_modules\.bin\electron-rebuild
- name: Build (Unix)
if: matrix.OS != 'windows'
run: |
cd ${GITHUB_WORKSPACE}/LaserWeb4
UI_VERSION=$(git describe --abbrev=0 --tags | tr -d 'v')
cd ${GITHUB_WORKSPACE}/lw.comm-server
SERVER_VERSION=$(cat version.txt | cut -c 3-6)
env ${{ matrix.BUILD_ENVIRONMENT_VAR }} \
./node_modules/.bin/electron-builder build --config.buildVersion=$UI_VERSION -p never ${{ matrix.ELECTRON_BUILDER_FLAGS }}
- name: Build (Windows)
if: matrix.OS == 'windows'
shell: bash
run: |
cd ${GITHUB_WORKSPACE}\\LaserWeb4
UI_VERSION=$(git describe --abbrev=0 --tags | tr -d 'v')
cd ${GITHUB_WORKSPACE}\\lw.comm-server
SERVER_VERSION=$(cat version.txt | cut -c 3-6)
env ${{ matrix.BUILD_ENVIRONMENT_VAR }} \
node_modules\\.bin\\electron-builder build --config.buildVersion=$UI_VERSION -p never ${{ matrix.ELECTRON_BUILDER_FLAGS }}
- name: Upload build artifact (Unix)
if: matrix.OS != 'windows'
uses: actions/upload-artifact@v2
with:
name: LaserWeb-${{ matrix.OS }}-${{ matrix.ARCH }}-${{ github.sha }}
path: ${{ github.workspace }}/lw.comm-server/dist/*.${{ matrix.BUILD_ARTIFACT_FILE_EXT }}

- name: Upload build artifact (Windows)
if: matrix.OS == 'windows'
uses: actions/upload-artifact@v2
with:
name: LaserWeb-${{ matrix.OS }}-${{ matrix.ARCH }}-${{ github.sha }}
path: ${{ github.workspace }}\lw.comm-server\dist\*.${{ matrix.BUILD_ARTIFACT_FILE_EXT }}
Loading

0 comments on commit 91ee4c1

Please sign in to comment.