Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Commit

Permalink
👷 Feat: Replace Travis w/ GitHub Actions CI (#912)
Browse files Browse the repository at this point in the history
* Feat: add GH Actions

* forgot a sudo lol

* don't need to update

* upload dist once done

* rename to linux.yml

* rename name too

* add other platforms

* rename platforms

* fix windows maybe?

* spelled install wrong lol

* add code cov

* add snyk env

* fix env

* install npm

* delete snyk workflow

* don't install runtime dependencies before build script on win32

* win32 build script: respect README instructions

* Fix: fix travis cli for manos & linux (#911)

* fix: cache npm

* better artifact naming attempt

* cache electron binaries used by electron-builder

* better AppImage artifact naming

* banish travis

* test which platforms need python

* add publishing code

* move it to the right place

* always publish new draft

* load token

* let electron-builder figure out whether to publish artifacts or not

* cleanup some Snyk stuff

* remove .snyk

* Make a unified Workflow with multiple platforms as Jobs

* remove individual os-specific workflows, use unified workflow instead

Co-authored-by: Gabriel Saillard <gabriel@saillard.dev>
  • Loading branch information
Jabster28 and GitSquared authored Nov 26, 2020
1 parent aef706c commit 087b9eb
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 69 deletions.
155 changes: 155 additions & 0 deletions .github/workflows/build-binaries.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
name: Build packaged binaries

on: [push, pull_request, create]

jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache Electron binaries
uses: actions/cache@v2
env:
cache-name: cache-electron-bins
with:
# cache location is described here:
# https://github.com/electron/get#how-it-works
path: ~/.cache/electron
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: install linux deps
run: |
sudo apt install rsync libc6-dev-i386 gcc-multilib g++-multilib -y
- name: set up env
run: |
npm install
- name: npm build
run: |
npm run build-linux
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v2
with:
name: Linux-AppImages
path: dist/*.AppImage
if-no-files-found: error

build-windows:
runs-on: windows-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- 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: Cache Electron binaries
uses: actions/cache@v2
env:
cache-name: cache-electron-bins
with:
# cache location is described here:
# https://github.com/electron/get#how-it-works
path: ~/AppData/Local/electron/Cache
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: |
npm install
- name: npm build
run: |
npm run build-windows
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v2
with:
name: Windows-Installer
path: dist/*.exe
if-no-files-found: error

build-darwin:
runs-on: macos-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache Electron binaries
uses: actions/cache@v2
env:
cache-name: cache-electron-bins
with:
# cache location is described here:
# https://github.com/electron/get#how-it-works
path: ~/Library/Caches/electron
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: set up env
run: |
npm install
- name: npm build
run: |
npm run build-darwin
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v2
with:
name: MacOS-Image
path: dist/*.dmg
if-no-files-found: error
13 changes: 0 additions & 13 deletions .snyk

This file was deleted.

46 changes: 0 additions & 46 deletions .travis.yml

This file was deleted.

17 changes: 7 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,16 @@
"install-windows": "npm install && cd src && npm install && ..\\node_modules\\.bin\\electron-rebuild -f -w node-pty && cd ..",
"prebuild-linux": "rsync -a --info=progress2 src/ prebuild-src --exclude node_modules && node prebuild-minify.js && cd prebuild-src && npm install",
"prebuild-darwin": "rsync -a src/ prebuild-src --exclude node_modules && node prebuild-minify.js && cd prebuild-src && npm install",
"prebuild-windows": "rmdir /S /Q src\\node_modules && mkdir prebuild-src && xcopy src\\* prebuild-src\\ /E /C /Q /Y && node prebuild-minify.js && cd prebuild-src && npm install",
"build-linux": "./node_modules/.bin/electron-builder build -l -p never",
"build-darwin": "./node_modules/.bin/electron-builder build -m -p never",
"build-windows": "node_modules\\.bin\\electron-builder build -w -p never",
"prebuild-windows": "mkdir prebuild-src && xcopy src\\* prebuild-src\\ /E /C /Q /Y && node prebuild-minify.js && cd prebuild-src && npm install",
"build-linux": "./node_modules/.bin/electron-builder build -l",
"build-darwin": "./node_modules/.bin/electron-builder build -m",
"build-windows": "node_modules\\.bin\\electron-builder build -w",
"postbuild-linux": "rm -R prebuild-src",
"postbuild-darwin": "rm -R prebuild-src",
"postbuild-windows": "rmdir /S /Q prebuild-src",
"test": "rsync -a --info=progress2 src/ prebuild-src --exclude node_modules && node prebuild-minify.js && cd prebuild-src && npm install && snyk test && cd .. && rm -R prebuild-src",
"init-file-icons": "git submodule update --init",
"update-file-icons": "git submodule foreach git pull origin master && node file-icons-generator.js",
"snyk-protect": "snyk protect",
"prepare": "npm run snyk-protect"
"update-file-icons": "git submodule foreach git pull origin master && node file-icons-generator.js"
},
"repository": {
"type": "git",
Expand All @@ -45,6 +43,7 @@
"build": {
"appId": "com.edex.ui",
"productName": "eDEX-UI",
"publish": "github",
"asar": true,
"compression": "normal",
"copyright": "Copyright © 2017-2020 Gabriel 'Squared' SAILLARD <gabriel@saillard.dev> (https://gaby.dev)",
Expand All @@ -69,7 +68,7 @@
"icon": "media/linuxIcons"
},
"appImage": {
"artifactName": "eDEX-UI Linux (${arch}).AppImage"
"artifactName": "eDEX-UI-Linux-${arch}.AppImage"
},
"mac": {
"target": [
Expand Down Expand Up @@ -111,12 +110,10 @@
"electron-rebuild": "^2.3.2",
"node-abi": "2.19.1",
"node-json-minify": "1.0.0",
"snyk": "^1.427.0",
"uglify-es": "3.3.9"
},
"optionalDependencies": {
"cson-parser": "4.0.5"
},
"snyk": true,
"devDependencies": {}
}

0 comments on commit 087b9eb

Please # to comment.