Skip to content

Commit

Permalink
Update Electron and associated dependencies
Browse files Browse the repository at this point in the history
This updates the Electron dependencies to the latest. In doing so we need to
have a minimum of Node 12 which is required by Electron 7. We also need to move
the Windows build from AppVeyor to CircleCi.
  • Loading branch information
belcherj committed Feb 7, 2020
1 parent 9c14685 commit acd8ea6
Show file tree
Hide file tree
Showing 11 changed files with 2,302 additions and 5,298 deletions.
118 changes: 105 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
version: 2
version: 2.1

orbs:
win: circleci/[email protected]

references:
restore_nvm: &restore_nvm
restore_cache:
name: Restoring NVM cache
keys:
- v1-nvm-0-33-11-{{ arch }}-{{ checksum ".nvmrc" }}
- v1-nvm-0-33-11-{{ arch }}
setup_nvm: &setup_nvm
run:
name: Install nvm and node version
command: |
set +e
set +u
set +x
NODE_VERSION=$(cat .nvmrc)
export NVM_DIR="${HOME}/.nvm"
mkdir -p "$NVM_DIR"
if [ ! -f "${NVM_DIR}/nvm.sh" ]; then
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
fi
[ -s "${NVM_DIR}/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install "$NODE_VERSION"
nvm alias default "$NODE_VERSION"
nvm use "$NODE_VERSION"
save_nvm: &save_nvm
save_cache:
name: Saving NVM cache
key: v1-nvm-0-33-11-{{ arch }}-{{ checksum ".nvmrc" }}
paths:
- ~/.nvm
npm_install: &npm_install
run:
name: Npm install
command: |
source $HOME/.nvm/nvm.sh
nvm use
npm ci
npm_restore_cache: &npm_restore_cache
restore_cache:
name: Restore npm cache
Expand All @@ -23,12 +62,12 @@ references:
command: |
sudo dpkg --add-architecture i386
sudo apt update
sudo apt -y install libxkbfile-dev libxkbfile-dev:i386 libx11-dev libx11-dev:i386 libxss-dev gcc-multilib g++-multilib rpm
sudo apt -y install libxkbfile-dev libxkbfile-dev:i386 libxext-dev libx11-dev libx11-dev:i386 libxss-dev gcc-multilib g++-multilib rpm
jobs:
build:
docker:
- image: circleci/node:10.15.0
- image: circleci/node:12.14.0
shell: /bin/bash --login
working_directory: ~/simplenote
steps:
Expand All @@ -37,12 +76,14 @@ jobs:
- run:
name: Decrypt assets
command: |
openssl aes-256-cbc -md md5 -d -in ./resources/certificates/win.p12.enc -out ./resources/certificates/win.p12 -k ${SECRETS_ENCRYPTION_KEY}
openssl aes-256-cbc -md md5 -d -in ./resources/certificates/mac.p12.enc -out ./resources/certificates/mac.p12 -k ${SECRETS_ENCRYPTION_KEY}
openssl aes-256-cbc -md md5 -d -in ./resources/secrets/config.json.enc -out ./config.json -k ${SECRETS_ENCRYPTION_KEY}
- *restore_nvm
- *setup_nvm
- *save_nvm
- *npm_restore_cache
- run: npm ci
- run: patch -p1 < ./resources/macos/macPackager-patch.diff
- run: patch -p1 < ./resources/macos/scheme-patch.diff
- *npm_install
- run: make build
- run: make lint
- run: make test
Expand All @@ -52,17 +93,18 @@ jobs:

linux:
docker:
- image: circleci/node:10.15.0
- image: circleci/node:12.14.0
working_directory: ~/simplenote
steps:
- checkout
- attach_workspace:
at: ~/simplenote
- *restore_nvm
- *setup_nvm
- *save_nvm
- *npm_restore_cache
- *install_linux_deps
- run: npm ci
- run: patch -p1 < ./resources/macos/macPackager-patch.diff
- run: patch -p1 < ./resources/macos/scheme-patch.diff
- *npm_install
- *npm_save_cache
- run: make package-linux SKIP_BUILD=true
- run:
Expand All @@ -85,10 +127,11 @@ jobs:
- checkout
- attach_workspace:
at: /Users/distiller/simplenote
- *restore_nvm
- *setup_nvm
- *save_nvm
- *npm_restore_cache
- run: npm ci
- run: patch -p1 < ./resources/macos/macPackager-patch.diff
- run: patch -p1 < ./resources/macos/scheme-patch.diff
- *npm_install
- *npm_save_cache
- run:
name: Build Mac
Expand All @@ -108,6 +151,46 @@ jobs:
paths:
- release

windows:
executor:
name: win/default
working_directory: C:\Users\circleci\simplenote-electron
environment:
CSC_FOR_PULL_REQUEST: true
steps:
- checkout
- attach_workspace:
at: C:\Users\circleci\simplenote-electron
- run:
name: Install make
command: cinst make
- run:
name: Install node version
command: |
$NODE_VERSION = Get-Content .\.nvmrc
nvm install $NODE_VERSION
nvm use $NODE_VERSION
- run:
name: Npm install
command: |
npm ci
- run:
name: Build windows
command: |
# Workaround for Sign Tool "private key filter" bug in Circle's Windows image.
# Ref: https://travis-ci.community/t/codesigning-on-windows/
#
# Fix: Import .p12 into the local certificate store. Sign Tool will use
# package.json's `certificateSubjectName` to find the imported cert.
Import-PfxCertificate -FilePath C:\Users\circleci\simplenote-electron\resources\certificates\win.p12 -CertStoreLocation Cert:\LocalMachine\Root -Password (ConvertTo-SecureString -String $env:WIN_CSC_KEY_PASSWORD -AsPlainText -Force)
make package-win32 IS_WINDOWS=true
npx electron-builder --win -p onTag
- persist_to_workspace:
root: C:\Users\circleci\simplenote-electron
paths:
- release\*.exe
- release\*.appx
- release\*.yml
artifacts:
docker:
- image: buildpack-deps:trusty
Expand Down Expand Up @@ -144,10 +227,19 @@ workflows:
ignore: webapp
tags:
only: /.*/
- windows:
requires:
- build
filters:
branches:
ignore: webapp
tags:
only: /.*/
- artifacts:
requires:
- linux
- mac
- windows
filters:
branches:
ignore: webapp
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12.14.0
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ THIS_DIR := $(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
NPM ?= $(NODE) $(shell which npm)
NPM_BIN = $(shell npm bin)

ELECTRON_VERSION := $(shell node -e "console.log(require('./package.json').devDependencies.electron)")

RED=`tput setaf 1`
RESET=`tput sgr0`

Expand Down Expand Up @@ -159,7 +161,7 @@ config-release: config.json install

.PHONY: rebuild-deps
rebuild-deps:
@npx electron-rebuild
@npx electron-rebuild -v $(ELECTRON_VERSION)

.PHONY: format
format:
Expand Down
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- Added types to state/ui/actions [#1849](https://github.com/Automattic/simplenote-electron/pull/1849)
- Updated Dependencies [#1848](https://github.com/Automattic/simplenote-electron/pull/1848)
- Refactored selected note state [1851](https://github.com/Automattic/simplenote-electron/pull/1851)
- Update Electron and associated dependencies [1771](https://github.com/Automattic/simplenote-electron/pull/1771)

## [v1.14.0]

Expand Down
77 changes: 0 additions & 77 deletions appveyor.yml

This file was deleted.

1 change: 1 addition & 0 deletions electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
},
"win": {
"icon": "resources/images/simplenote.ico",
"certificateSubjectName": "Automattic, Inc.",
"artifactName": "Simplenote-win-${version}-${arch}.${ext}",
"target": [
{
Expand Down
7 changes: 1 addition & 6 deletions lib/dialogs/import/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ import TransitionDelayEnter from '../../components/transition-delay-enter';
import Spinner from '../../components/spinner';

const SourceImporter = React.lazy(() =>
import(
/*
webpackChunkName: 'source-importer',
webpackPrefetch: true,
*/ './source-importer'
)
import(/* webpackChunkName: 'source-importer' */ './source-importer')
);

class ImportDialog extends React.Component {
Expand Down
Loading

0 comments on commit acd8ea6

Please sign in to comment.