.github/workflows/nodejs.yml
name: Node CI
on: [push]
jobs:
test_unit:
name: Unit Tests with ${{ matrix.node }} on ${{ matrix.os.name }}
strategy:
matrix:
node: [10, 12]
os:
- id: ubuntu-latest
name: linux
- id: windows-latest
name: windows
- id: macOS-latest
name: mac
runs-on: ${{ matrix.os.id }}
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Cache dependencies
uses: actions/cache@v1
with:
path: node_modules
key: ${{ matrix.os.name }}-node-${{ matrix.node}}-build-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ matrix.os.name }}-node-${{ matrix.node}}-build-${{ hashFiles('**/yarn.lock') }}
${{ matrix.os.name }}-node-${{ matrix.node}}-
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Install packages via yarn
run: yarn --non-interactive --frozen-lockfile
- name: Unit Tests & Code Coverage (Linux & Mac)
if: matrix.os.id != 'windows-latest'
uses: paambaati/codeclimate-action@v2.3.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageCommand: yarn test:unit:coverage
- name: Unit Test & Code Coverage (Windows)
if: matrix.os.id == 'windows-latest'
run: yarn test:unit:coverage
build:
name: Building Application with ${{ matrix.node }} on ${{ matrix.os.name }}
needs: [test_unit]
strategy:
matrix:
node: [10, 12]
os:
- id: ubuntu-latest
name: linux
ext: AppImage
mime: application/x-appimage
- id: windows-latest
name: windows
ext: exe
mime: application/vnd.microsoft.portable-executable
- id: macOS-latest
name: mac
ext: pkg
mime: application/x-newton-compatible-pkg
runs-on: ${{ matrix.os.id }}
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Cache dependencies
uses: actions/cache@v1
with:
path: node_modules
key: ${{ matrix.os.name }}-node-${{ matrix.node}}-build-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ matrix.os.name }}-node-${{ matrix.node}}-build-${{ hashFiles('**/yarn.lock') }}
${{ matrix.os.name }}-node-${{ matrix.node}}-
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Install packages via yarn
run: yarn --non-interactive --frozen-lockfile
- name: Build the Application
run: yarn build --publish=never
- name: Upload builded installer
uses: actions/upload-artifact@v1
if: matrix.node == 12
with:
name: installer-${{ matrix.os.name }}.${{ matrix.os.ext }}
path: ./dist_electron/installer.${{ matrix.os.ext }}
- name: Upload builded Application Assets to Release
uses: actions/upload-release-asset@v1.0.1
if: startsWith(github.ref, 'v') && matrix.node == 12
env:
GITHUB_TOKEN: ${{ secrets.GH_PERSONAL_TOKEN }}
with:
upload_url: https://github.com/repos/${{ github.repository }}/releases/${{ github.ref }}/assets
asset_path: ./installer.${{ matrix.os.ext }}
asset_name: installer-${{ matrix.os.name }}.${{ matrix.os.ext }}
asset_content_type: ${{ matrix.os.mime }}