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

chore(circleci): improve build process #1104

Merged
merged 83 commits into from
Aug 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
bd7df9e
chore(circleci): improve build process
Aug 17, 2019
d98cf78
chore(circleci): update
Aug 17, 2019
1ca285d
circleci
Aug 17, 2019
dd3892b
fix
Aug 17, 2019
e61f2ec
fix
Aug 17, 2019
76d23c4
fixx
Aug 17, 2019
862787f
fix version
Aug 17, 2019
c2a67ee
fix
Aug 17, 2019
5e586e0
fix
Aug 17, 2019
5abb5f9
fix command
Aug 17, 2019
17c5dfa
fix lib
Aug 17, 2019
3072b0f
fix permissions
Aug 17, 2019
e6687e6
fix lib
Aug 17, 2019
a5d3b94
fixtest
Aug 17, 2019
1700060
test
Aug 17, 2019
94050b1
fix
Aug 17, 2019
213c341
fix orb
Aug 17, 2019
d608e02
adjust
Aug 17, 2019
00c9350
trigger
Aug 17, 2019
2c23aa4
add windows
Aug 17, 2019
27cd748
32 support
Aug 17, 2019
d91e759
sudo
Aug 17, 2019
968befb
su
Aug 17, 2019
bffbf66
i
Aug 17, 2019
6eae625
su
Aug 17, 2019
882dc23
commands
Aug 17, 2019
0459ca4
str
Aug 17, 2019
f0e8599
fix
Aug 17, 2019
92e9bc3
f
Aug 17, 2019
e881eae
ident
Aug 17, 2019
5407330
fix
Aug 17, 2019
6864c93
add libdev
Aug 18, 2019
151d91d
fix
Aug 18, 2019
2fd9290
remove
Aug 18, 2019
2797c90
fixx
Aug 18, 2019
794cbd4
win
Aug 18, 2019
640c023
test
Aug 18, 2019
d34703c
add when step
Aug 18, 2019
b168cd6
add mac
Aug 18, 2019
3f3fbb3
mac permissions
Aug 18, 2019
b708e45
enable
Aug 18, 2019
f6fd6c6
fix tests
Aug 18, 2019
1732eaa
trigger
Aug 18, 2019
5e5094f
fix cachce
Aug 18, 2019
51ae603
remove storing arts
Aug 18, 2019
683eb8a
arts
Aug 18, 2019
a2b71fb
chore(circleci): seperate jobs
Aug 18, 2019
00465ed
add conditional deploy
Aug 18, 2019
6a7787f
update cache values
Aug 18, 2019
5421f9b
add category
Aug 18, 2019
0a45577
Merge branch 'develop' into chore/improve-circleci
Aug 19, 2019
51a6ae2
Merge branch 'develop' into chore/improve-circleci
Aug 19, 2019
fb01aa6
release test
Aug 19, 2019
0945a16
chore(app): add auto changelog/tagging/bumping and update readme
Aug 19, 2019
5634233
fix
Aug 19, 2019
5a0de5a
fix cache
Aug 19, 2019
e6025eb
cache test
Aug 19, 2019
2371512
store to workspace
Aug 19, 2019
c420cd2
fix path
Aug 19, 2019
7485b4a
fix path
Aug 19, 2019
436c226
add checksums job
Aug 19, 2019
f2a39eb
test
Aug 19, 2019
391c203
fx
Aug 19, 2019
03a8b9b
glob
Aug 19, 2019
b46f6bc
glob2
Aug 19, 2019
87eb02d
add checksum command
Aug 19, 2019
2100b57
final test
Aug 20, 2019
48510db
fix syntax
Aug 20, 2019
c6c2149
fix syntax
Aug 20, 2019
154c374
fix job name
Aug 20, 2019
7d0e88c
fix sha func
Aug 20, 2019
257ea1b
fix win
Aug 21, 2019
05a5724
adjust shasum command
Aug 21, 2019
7ac9861
fix
Aug 21, 2019
fe50dab
fix
Aug 21, 2019
73e6f83
fix
Aug 21, 2019
0ea3e6d
test
Aug 21, 2019
8b40e09
cleanup
Aug 21, 2019
a25da5f
cleanup
Aug 21, 2019
92716c5
adjust version
Aug 21, 2019
f6f5235
fix cache issue
Aug 21, 2019
fcaeecd
adjust job
Aug 21, 2019
0caff03
remove redundant command
Aug 21, 2019
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
160 changes: 101 additions & 59 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Javascript Node CircleCI 2.0 configuration file.
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
version: 2
version: 2.1

orbs:
codecov: codecov/[email protected]

references:
workspace: &workspace ~/repo
Expand All @@ -22,99 +23,140 @@ references:
xcode: '10.3.0'
working_directory: *workspace

commands:
pre:
description: 'Setting up and building environment'
parameters:
sudo:
type: string
default: ''
windows:
type: boolean
default: false
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ arch }}-{{ checksum "package.json" }}
- v1-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
- run: yarn

jobs:
build:
build_linux:
<<: *container_config
steps:
- pre:
sudo: 'sudo'
- run: yarn dist --linux
- save_cache:
key: v1-dependencies-{{ arch }}-{{ checksum "package.json" }}
paths:
- node_modules
build_win:
<<: *win_config
steps:
- pre:
windows: true
- run: yarn dist --win --x64 --ia32
- save_cache:
key: v1-dependencies-{{ arch }}-{{ checksum "package.json" }}
paths:
- node_modules
build_mac:
<<: *mac_config
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run: sudo apt-get -y update
- run: sudo apt-get -y install libudev-dev libusb-1.0-0-dev
- run: yarn install
- run: chmod -R 777 ~/repo
- v1-dependencies-{{ arch }}-{{ checksum "package.json" }}
- v1-dependencies-{{ arch }}
- run: yarn
- run: yarn dist --mac
- save_cache:
key: v1-dependencies-{{ arch }}-{{ checksum "package.json" }}
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
test:
<<: *container_config
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: sudo apt-get -y update
- run: sudo apt-get -y install libgtk-3-0 libxss1 libgconf-2-4 libnss3 libasound2
- run: yarn test
- pre:
sudo: 'sudo'
- run: yarn codecov
store_artifacts:
- path: artifacts
- destination: yarnpkg
- codecov/upload:
file: ./coverage/lcov.info

deploy_win:
<<: *win_config
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run: dpkg --add-architecture i386
- run: apt-get -y update
- run: apt-get -y install libudev-dev libudev-dev:i386 libusb-1.0-0-dev libusb-1.0-0-dev:i386
- run: yarn install
- pre:
windows: true
- run: yarn release:win
- store_artifacts:
path: dist
destination: build
- persist_to_workspace:
root: *workspace
paths:
- dist/*.*

deploy_linux:
<<: *container_config
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run: sudo apt-get -y update
- run: sudo apt-get -y install build-essential libudev-dev
- run: yarn install
- pre:
sudo: 'sudo'
- run: yarn release:linux
- store_artifacts:
path: dist
destination: build
- persist_to_workspace:
root: *workspace
paths:
- dist/*.*

deploy_mac:
<<: *mac_config
steps:
- checkout
- restore_cache:
keys:
- v3-dependencies-{{ checksum "package.json" }}
- v3-dependencies-
- run: yarn install
- v1-dependencies-{{ arch }}-{{ checksum "package.json" }}
- v1-dependencies-{{ arch }}
- run: yarn
- run: yarn release:mac
- store_artifacts:
path: dist
destination: build
- persist_to_workspace:
root: *workspace
paths:
- ./dist/*.*

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

workflows:
version: 2
build_test:
build_win:
jobs:
- build
- test:
requires:
- build

- build_win
build_linux:
jobs:
- build_linux
build_mac:
jobs:
- build_mac
unit_tests:
jobs:
- test
deploy:
jobs:
- calculate_checksums:
requires:
- deploy_win
- deploy_linux
- deploy_mac
- deploy_win:
filters:
branches:
Expand Down
13 changes: 13 additions & 0 deletions .versionrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"types": [
{"type": "feat", "section": "Features"},
{"type": "fix", "section": "Bug Fixes"},
{"type": "chore", "section": "Bug Fixes"},
{"type": "docs", "section": "Documentation"},
{"type": "style", "hidden": true},
{"type": "refactor", "hidden": true},
{"type": "perf", "hidden": true},
{"type": "test", "hidden": true},
{"type": "renovate", "hidden": true}
]
}
37 changes: 29 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,48 @@ Resources:

# Releasing

## Windows & Linux
## Automated Deployment

We use [CircleCI](https://circleci.com/gh/nos/client) to automatically create builds based upon git tags.

1. Create a tag, e.g. `v1.0.0`.
1. `git tag -a v1.0.0 -m "release"` - the `v`-prefix is required for auto updates to work
2. `git push origin v1.0.0`
2. Wait for `deploy_win64` and `deploy_linux` jobs to upload the artifacts to Github Release page as a draft.
1. run `yarn release --dry-run` - Note if the output version tag/changelog is correctly generated.
2. run `yarn release` - This will generate the changelog, update the version in package.json and create and push a tag.
3. The deploys jobs will be triggered and upload the artifacts to Github Release page as a draft.

## macOS
## Manual Deployment: macOS

1. Export the following variables:
1. `CSC_LINK` - This is the path to the .p12 certificate file
2. `CSC_KEY_PASSWORD` - This is the password of the .p12 certificate file
3. `CSC_IDENTITY_AUTO_DISCOVERY` - Set to `false` to disable usage of local keychain (By default it looks in your `login` keychain)
4. `GH_TOKEN` - This is used to upload the artifacts to Github
2. Create the distributable, i.e. `yarn dist`.
3. Locate and upload the following files as these are required for the auto-updater to work:
1. `dist/nOS-1.0.0-mac.zip`
2. `dist/nOS-1.0.0-mac.dmg`
3. `dist/nOS-1.0.0-mac.dmg.blockmap`
4. `dist/latest-mac.yml`

##### Generating hashes for the artifacts
- MacOS: `shasum -a 256 ./*` - Where the final argument is the location of the artifacts
## Manual Deployment: Linux

1. Create the distributable, i.e. `yarn dist`.
2. Locate and upload the following files as these are required for the auto-updater to work:
1. `dist/nOS-1.0.0-linux-amd64.snap`
2. `dist/nOS-1.0.0-linux-x86_64.AppImage`
3. `dist/latest-linux.yml`

## Manual Deployment: Windows

1. Export the following variables:
1. `WIN_CSC_LINK` - This is the certificate file in text format
2. `WIN_CSC_KEY_PASSWORD` - This is the password of the certificate file
3. `GH_TOKEN` - This is used to upload the artifacts to Github
2. Create the distributable, i.e. `yarn dist`.
3. Locate and upload the following files as these are required for the auto-updater to work:
1. `dist/nOS-1.0.0-win.exe`
2. `dist/nOS-1.0.0-win.exe.blockmap`
3. `dist/latest.yml`

### Generating hashes for the artifacts

- MacOS/Linux: `shasum -a 256 ./*` - Where the final argument is the location of the artifacts
23 changes: 23 additions & 0 deletions electron-builder.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"appId": "io.nos.desktop",
"forceCodeSigning": true,
"artifactName": "${productName}-${version}-${os}-${arch}.${ext}",
"win": {
"icon": "./static/icons/icon1024x1024.ico",
"timeStampServer": "http://timestamp.globalsign.com/scripts/timstamp.dll"
},
"linux": {
"icon": "./static/icons/icon1024x1024.png"
},
"mac": {
"icon": "./static/icons/icon1024x1024.icns",
"category": "public.app-category.utilities"
},
"directories": {
"buildResources": "static"
},
"files": ["static/**/*"],
"publish": {
"provider": "github"
}
}
29 changes: 5 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@
"lint:fix": "yarn lint --fix",
"clean": "rimraf build dist coverage",
"postinstall": "electron-builder install-app-deps",
"release": "yarn clean && yarn build && build",
"release:win": "yarn release --win --x64 --ia32 -p always",
"release:mac": "yarn release --mac -p always",
"release:linux": "yarn release --linux -p always",
"release": "standard-version",
"release:win": "yarn dist --win --x64 --ia32 -p onTag",
"release:mac": "yarn dist --mac -p onTag",
"release:linux": "yarn dist --linux -p onTag",
"snyk-protect": "snyk protect",
"snyk-test": "snyk test"
},
Expand Down Expand Up @@ -134,6 +134,7 @@
"redux-mock-store": "1.5.3",
"rimraf": "3.0.0",
"sass-loader": "7.2.0",
"standard-version": "7.0.0",
"style-loader": "0.23.1",
"stylelint": "10.1.0",
"stylelint-config-recommended-scss": "3.3.0",
Expand All @@ -145,26 +146,6 @@
"webpack-dev-server": "2.11.5",
"webpack-merge": "4.2.1"
},
"build": {
"appId": "io.nos.desktop",
"forceCodeSigning": true,
"artifactName": "${productName}-${version}-${os}-${arch}.${ext}",
"win": {
"icon": "./static/icons/icon1024x1024.ico"
},
"linux": {
"icon": "./static/icons/icon1024x1024.png"
},
"directories": {
"buildResources": "static"
},
"files": [
"static/**/*"
],
"publish": {
"provider": "github"
}
},
"jest": {
"testMatch": [
"**/__tests__/**/*.test.js"
Expand Down
1 change: 1 addition & 0 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"ignoreDeps": ["@ledgerhq/hw-transport-node-hid"],
"schedule": ["on monday"],
"labels": ["Renovate 🌴"],
"semanticCommitType": "renovate",
"statusCheckVerify": true,
"packageRules": [
{
Expand Down
Loading