Skip to content

Commit

Permalink
chore(circleci): fix incorrect cache issue of circleci builds (#1129)
Browse files Browse the repository at this point in the history
* chore(renovate): enable semantic commits

* chore(circleci): fix incorrect cache issue of circleci builds

* chore(circleci): add fallback cache path
  • Loading branch information
Maurice Dalderup authored Aug 27, 2019
1 parent ae70b29 commit 603e78b
Showing 1 changed file with 59 additions and 65 deletions.
124 changes: 59 additions & 65 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ orbs:
references:
workspace: &workspace ~/repo

container_config: &container_config
linux_config: &linux_config
docker:
- image: circleci/node:10.13.0
working_directory: *workspace

win_config: &win_config
windows_config: &windows_config
docker:
- image: legiit/electron-builder-wine:node12
environment:
Expand All @@ -24,92 +24,95 @@ references:
working_directory: *workspace

commands:
pre:
description: 'Setting up and building environment'
parameters:
sudo:
type: string
default: ''
windows:
type: boolean
default: false
pre-windows:
description: 'Setting up and building environment for windows'
steps:
- checkout
- run: chmod -R 777 ~/repo
- restore_cache:
keys:
- v2-dependencies-{{ arch }}-{{ checksum "package.json" }}
- v2-dependencies-{{ arch }}
- run: << parameters.sudo >> apt-get -y update
- run: << parameters.sudo >> apt-get -y install libusb-1.0-0
- when:
condition: <<parameters.windows>>
steps:
- run: apt-get -y install libudev-dev libudev-dev:i386 libusb-1.0-0-dev libusb-1.0-0-dev:i386
- v1-dependencies-windows-{{ checksum "package.json" }}
- v1-dependencies-windows
- run: apt-get -y update
- run: apt-get -y install libusb-1.0-0
- run: apt-get -y install libudev-dev libudev-dev:i386 libusb-1.0-0-dev libusb-1.0-0-dev:i386
- run: yarn

pre-linux:
description: 'Setting up and building environment for linux'
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-linux-{{ checksum "package.json" }}
- v1-dependencies-linux
- run: sudo apt-get -y update
- run: sudo apt-get -y install libusb-1.0-0
- run: yarn

pre-mac:
description: 'Setting up and building environment for mac'
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-mac-{{ checksum "package.json" }}
- v1-dependencies-mac
- run: yarn

jobs:
build_linux:
<<: *container_config
<<: *linux_config
steps:
- pre:
sudo: 'sudo'
- pre-linux
- run: yarn dist --linux
- run: chmod -R 777 ~/repo
- save_cache:
key: v2-dependencies-{{ arch }}-{{ checksum "package.json" }}
key: v1-dependencies-linux-{{ checksum "package.json" }}
paths:
- node_modules
build_win:
<<: *win_config

build_windows:
<<: *windows_config
steps:
- pre:
windows: true
- pre-windows
- run: yarn dist --win --x64 --ia32
- save_cache:
key: v2-dependencies-{{ arch }}-{{ checksum "package.json" }}
key: v1-dependencies-windows-{{ checksum "package.json" }}
paths:
- node_modules

build_mac:
<<: *mac_config
steps:
- checkout
- restore_cache:
keys:
- v2-dependencies-{{ arch }}-{{ checksum "package.json" }}
- v2-dependencies-{{ arch }}
- run: yarn
- pre-mac
- run: yarn dist --mac
- save_cache:
key: v2-dependencies-{{ arch }}-{{ checksum "package.json" }}
key: v1-dependencies-mac-{{ checksum "package.json" }}
paths:
- node_modules
test:
<<: *container_config

unit_tests:
<<: *linux_config
steps:
- pre:
sudo: 'sudo'
- pre-linux
- run: yarn test
- run: yarn codecov
- codecov/upload:
file: ./coverage/lcov.info

deploy_win:
<<: *win_config
deploy_windows:
<<: *windows_config
steps:
- pre:
windows: true
- pre-windows
- run: yarn release:win
- persist_to_workspace:
root: *workspace
paths:
- dist/*.*

deploy_linux:
<<: *container_config
<<: *linux_config
steps:
- pre:
sudo: 'sudo'
- pre-linux
- run: yarn release:linux
- persist_to_workspace:
root: *workspace
Expand All @@ -119,47 +122,38 @@ jobs:
deploy_mac:
<<: *mac_config
steps:
- checkout
- restore_cache:
keys:
- v2-dependencies-{{ arch }}-{{ checksum "package.json" }}
- v2-dependencies-{{ arch }}
- run: yarn
- pre-mac
- run: yarn release:mac
- persist_to_workspace:
root: *workspace
paths:
- ./dist/*.*

calculate_checksums:
<<: *container_config
<<: *linux_config
steps:
- attach_workspace:
at: *workspace
- run: cd ./dist && shasum -a 256 *.*

workflows:
version: 2
build_win:
jobs:
- build_win
build_linux:
platform_builds:
jobs:
- build_windows
- build_linux
build_mac:
jobs:
- build_mac
unit_tests:
platform_tests:
jobs:
- test
- unit_tests
deploy:
jobs:
- calculate_checksums:
requires:
- deploy_win
- deploy_windows
- deploy_linux
- deploy_mac
- deploy_win:
- deploy_windows:
filters:
branches:
ignore: /.*/
Expand Down

0 comments on commit 603e78b

Please sign in to comment.