.circleci/config.yml
workspace_root: &workspace_root
~/repo
defaults: &defaults
working_directory: ~/repo
docker:
- image: circleci/node:10-stretch
onMaster: &onMaster
branches:
only: master
onTag: &onTag
tags:
only: /v[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta)(\-[0-9]+)?)?/
onTagOnly: &onTagOnly
<<: *onTag
branches:
ignore: /.*/
onTagAndEveryBranch: &onTagAndEveryBranch
filters:
<<: *onTag
persistElectronArtifact: &persistElectronArtifact
root: *workspace_root
paths:
- ./out/make
- ./out/publish-dry-run
version: 2
jobs:
install:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- dependencies-{{ checksum "package-lock.json" }}
- run:
name: Install dependencies
command: npm ci
- save_cache:
paths:
- $HOME/.npm
key: dependencies-{{ checksum "package-lock.json" }}
- persist_to_workspace:
root: *workspace_root
paths:
- .
build-linux:
<<: *defaults
steps:
- attach_workspace:
at: *workspace_root
- run:
name: Update apt package list
command: sudo apt-get update
- run:
name: Install build deps
command: sudo apt-get install fakeroot rpm
- run:
name: Build electron app
command: npm run make -- -p linux
- persist_to_workspace:
<<: *persistElectronArtifact
build-darwin:
<<: *defaults
steps:
- attach_workspace:
at: *workspace_root
- run:
name: Build electron app
command: npm run make -- -p darwin
- persist_to_workspace:
<<: *persistElectronArtifact
build-win32:
<<: *defaults
steps:
- attach_workspace:
at: *workspace_root
- run:
name: Use 32-bit arch
command: sudo dpkg --add-architecture i386
- run:
name: Update apt package list
command: sudo apt-get update
- run:
name: Install wine
command: sudo apt-get install wine32 wine64 mono-devel
- run:
name: Create 32bit wine prefix
command: WINEARCH=win32 WINEPREFIX=/home/circleci/.wine32 wineboot
- run:
name: Create 64bit wine prefix
command: WINEARCH=win64 WINEPREFIX=/home/circleci/.wine wineboot
- run:
name: Build electron app
command: npm run make -- -p win32
- persist_to_workspace:
<<: *persistElectronArtifact
test:
<<: *defaults
steps:
- attach_workspace:
at: *workspace_root
- run:
name: Run tests
command: npm test -- --coverage --maxWorkers=1
- persist_to_workspace:
root: *workspace_root
paths:
- ./coverage
publish-test-coverage:
<<: *defaults
steps:
- attach_workspace:
at: *workspace_root
- run:
name: Install code climate reporter
command: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- run:
name: Publish coverage
command: ./cc-test-reporter after-build
publish-binaries:
<<: *defaults
steps:
- attach_workspace:
at: *workspace_root
- run:
name: Publish using electron-forge
command: npm run publish
workflows:
version: 2
build-n-package:
jobs:
- install:
<<: *onTagAndEveryBranch
- test:
requires:
- install
<<: *onTagAndEveryBranch
- publish-test-coverage:
requires:
- test
filters:
<<: *onMaster
- build-linux:
requires:
- install
<<: *onTagAndEveryBranch
- build-darwin:
requires:
- install
<<: *onTagAndEveryBranch
- build-win32:
requires:
- install
<<: *onTagAndEveryBranch
- publish-binaries:
requires:
- test
- build-darwin
- build-linux
- build-win32
filters:
<<: *onTagOnly