Skip to content

Commit

Permalink
ci: first draft proof-of-concept GH Actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cwillisf committed Sep 6, 2023
1 parent af8bde6 commit d7b45e8
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
File renamed without changes.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
.gitattributes text eol=lf
.gitignore text eol=lf
.npmignore text eol=lf
.nvmrc text eol=lf
LICENSE text eol=lf
Makefile text eol=lf
TRADEMARK text eol=lf
Expand Down
79 changes: 79 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: CI build
on:
workflow_dispatch:
pull_request:
push:
permissions:
contents: read
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [macos-latest] # [windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: 'npm'
node-version-file: '.nvmrc'
- run: node --version && npm --version
- run: npm ci
- run: npm run test
- if: runner.os == 'Windows'
run: echo "Import CI context"
- if: runner.os == 'Windows'
run: echo "Add CSC to machine store"
- if: runner.os == 'macOS'
run: fastlane circleci
- name: Work around electron-userland/electron-builder#4964
if: runner.os == 'macOS'
env:
HOMEBREW_NO_AUTO_UPDATE: 1
run: |
brew install go go-bindata
git -C ~ clone https://github.com/develar/app-builder.git
git -C ~/app-builder checkout b85740334fec875f5dd8dcd22eb1f729599109db
make --directory=~/app-builder build
ln -sfv ~/app-builder/dist/app-builder_darwin_amd64/app-builder ./node_modules/app-builder-bin/mac/
- name: Build
env:
# let Windows know where to get the PFX (ignored on non-Windows builds)
WIN_CSC_LINK: ~/codesign.pfx
# blank CIRCLE_BUILD_NUM to work around electron-userland/electron-builder#5016
CIRCLE_BUILD_NUM: ""
# increased Node memory needed for macOS build
NODE_OPTIONS: --max-old-space-size=4096
run: |
npm run distDev
- name: Create Artifacts directory
shell: bash
run: mkdir -p Artifacts
- name: Move DMG to Artifacts
if: runner.os == 'macOS'
run: mv -v dist/Scratch*.dmg Artifacts/
- name: Move PKG to Artifacts
if: runner.os == 'macOS' # TODO: only if signed
run: mv -v dist/Scratch*.pkg Artifacts/
- name: Zip MAS-Dev build
if: runner.os == 'macOS' # TODO: only if signed
# If you use `zip` for this it will throw away some metadata (resource forks?) and
# the app will crash on startup with "EXC_CRASH (Code Signature Invalid)".
# To preserve that metadata, use `ditto` instead.
# See also: https://stackoverflow.com/a/22370486
run: |
NPM_APP_VERSION="`node -pe "require('./package.json').version"`"
cd dist/mas-dev
ditto -v -c -k --sequesterRsrc --keepParent --zlibCompressionLevel 9 \
Scratch*.app ../../Artifacts/mas-dev-${NPM_APP_VERSION}.zip
- name: Move Windows build products to Artifacts
if: runner.os == 'Windows'
shell: bash
run: mv -v dist/{Scratch*.appx,Scratch*.exe} Artifacts/
- uses: actions/upload-artifact@v3
with:
path: Artifacts/*
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16

0 comments on commit d7b45e8

Please sign in to comment.