Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Electron and associated dependencies #1771

Merged
merged 2 commits into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
belcherj marked this conversation as resolved.
Show resolved Hide resolved
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 desktop/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ module.exports = function main() {
titleBarStyle: 'hidden',
show: false,
webPreferences: {
nodeIntegration: true,
preload: path.join(__dirname, './preload.js'),
},
});
Expand Down
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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there an explanation for why we're removing this? I didn't see any webpack version changes or implications from the rest of the PR why this would need to go.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From Slack:

init.ts:204 Unable to load preload script: ~/simplenote-electron/desktop/preload.js

I was unable to reproduce this error but I have seen similar ones before. It seems like this is probably fine to leave in but it's also the only invocation of it in the repository. The directive will preload the script during CPU idle time, meaning that imports start a hair earlier.

All that being said, while I think it's going to be better either leaving this in or taking it out in a separate PR with an explanation for the removal, it seems like such a small enough issue and already that it's an outlier that I don't think we need to block this PR to undo the change.

*/ './source-importer'
)
import(/* webpackChunkName: 'source-importer' */ './source-importer')
);

class ImportDialog extends React.Component {
Expand Down
Loading