未验证 提交 087b9ebf 编写于 作者: J Jabster28 提交者: GitHub

👷 Feat: Replace Travis w/ GitHub Actions CI (#912)

* 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: NGabriel Saillard <gabriel@saillard.dev>
上级 aef706c1
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
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.16.0
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
ignore:
SNYK-JS-MINIMIST-559764:
- electron > extract-zip > mkdirp > minimist:
reason: None given
expires: '2020-04-22T13:23:24.095Z'
# patches apply the minimum changes required to fix a vulnerability
patch:
SNYK-JS-LODASH-567746:
- electron > @electron/get > global-tunnel-ng > lodash:
patched: '2020-07-07T09:01:03.422Z'
language: node_js
node_js:
- "12.13.0"
os:
- linux
- osx
- windows
before_install:
- 'if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y libc6-dev-i386 gcc-multilib g++-multilib ; fi'
- 'if [[ "$TRAVIS_PULL_REQUEST" = "false" ]]; then npm install -g snyk; fi'
before_script:
- npm install
- npm install snyk
- 'if [[ "$TRAVIS_PULL_REQUEST" = "false" ]]; then snyk auth $SNYK_TOKEN; fi'
- mkdir prebuild-src
- 'if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then cp -R src/. prebuild-src/; fi'
- 'if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then xcopy src prebuild-src //E //C //Q //Y; fi'
- node prebuild-minify.js
- cd prebuild-src
- npm install
- 'if [[ "$TRAVIS_PULL_REQUEST" = "false" ]]; then snyk protect; fi'
- 'if [[ "$TRAVIS_PULL_REQUEST" = "false" ]]; then snyk test; fi'
- cd ..
script:
- 'if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./node_modules/.bin/electron-builder build -l -p never ; fi'
- 'if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./node_modules/.bin/electron-builder build -m -p never ; fi'
- 'if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then node_modules\\.bin\\electron-builder build -w -p never ; fi'
deploy:
skip_cleanup: true
provider: releases
api_key:
secure: rBDPbnv7goHiGlcy5fyYZf4Qt/rLUPk9+cz+2uQhTJx9O5rTE3p4BdukXLQoWOsd7XF8wvwOT6PPJTPeznLE/cW6TU7KobTLt5D44QH+ELYtc/vBz5iJd/waMeJXe1GF8Yh2Xqcvq9D5IMjroQMTjzCmP16RhrCrjmsWdmOKSbT+BXVcu1w79ly9ON0TN9IxCXH00YMxmnIvQq7PabEda2JBwys85gVXGFQt625kYQAHUp7ihNCfzrWdjkdsYeEWTu0axlVESAeLMWGoRUsYGVSaAnrXPRdW4OPbU8k0LhjwsAxkKk0VjmhsXvV2m6QKZJbXE99NMYNQksXVdi4mHNtgFDR6hSrJjIr2SLvS4aTfSrTxWPPPR+Kh+4Ocpnep5oH8vPD20dKMiFINzyzzqxlRL3MukUt5oI2ZFHNcnBogaMwSjdf2CDSIO/DI3VZCA+z388hDDUTT1x8UCkokXuXSg9PQCXYX/6fZd565GZhcHbwGEQ5aPGqzZ3/00T7E4B9Ip3UW0tZ8cXm+U+nvgT7KvjD4xby24Cr8YDaoJBK0eT/vbQM7cxl9VKPfkVU8NsYIfV8dmai1ieR1Lnor3iL5xWPsOcjkItahUPjRQLfBEcXNYoLoYEkr7txhLIhMM+q2w5hs2FmbLRLn0qwExYxtTS/rk3NyYZzZgJwtEBc=
file:
- "dist/eDEX-UI Linux (i386).AppImage"
- "dist/eDEX-UI Linux (x86_64).AppImage"
- "dist/eDEX-UI MacOS Image.dmg"
- "dist/eDEX-UI Windows Installer.exe"
options:
draft: true
on:
repo: GitSquared/edex-ui
branch: master
tags: true
......@@ -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",
......@@ -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)",
......@@ -69,7 +68,7 @@
"icon": "media/linuxIcons"
},
"appImage": {
"artifactName": "eDEX-UI Linux (${arch}).AppImage"
"artifactName": "eDEX-UI-Linux-${arch}.AppImage"
},
"mac": {
"target": [
......@@ -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": {}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册