2019-09-06 13:44:52 -07:00
|
|
|
version: 2.1
|
2019-10-01 05:10:25 -07:00
|
|
|
orbs:
|
|
|
|
win: circleci/windows@1.0.0
|
2019-10-28 04:05:05 -07:00
|
|
|
aws-s3: circleci/aws-s3@1.0.11
|
|
|
|
|
2019-09-06 13:44:52 -07:00
|
|
|
executors:
|
|
|
|
wine-chrome:
|
|
|
|
working_directory: ~/mattermost-desktop
|
|
|
|
docker:
|
|
|
|
- image: electronuserland/builder:wine-chrome
|
2019-10-01 05:10:25 -07:00
|
|
|
environment:
|
|
|
|
TAR_OPTIONS: --no-same-owner
|
2019-09-06 13:44:52 -07:00
|
|
|
wine-mono:
|
2017-07-11 08:01:23 -07:00
|
|
|
working_directory: ~/mattermost-desktop
|
|
|
|
docker:
|
|
|
|
- image: electronuserland/builder:wine-mono
|
2019-10-01 05:10:25 -07:00
|
|
|
mac:
|
|
|
|
working_directory: ~/mattermost-desktop
|
|
|
|
macos:
|
|
|
|
xcode: "10.3.0"
|
2019-10-28 04:05:05 -07:00
|
|
|
aws:
|
|
|
|
working_directory: ~/mattermost-desktop
|
|
|
|
docker:
|
|
|
|
- image: 'circleci/python:2.7'
|
|
|
|
github:
|
|
|
|
working_directory: ~/mattermost-desktop
|
|
|
|
docker:
|
|
|
|
- image: circleci/golang:1.12
|
2019-09-06 13:44:52 -07:00
|
|
|
commands:
|
|
|
|
update_image:
|
|
|
|
description: "Update base image"
|
|
|
|
parameters:
|
|
|
|
apt_opts:
|
|
|
|
type: string
|
|
|
|
default: ""
|
|
|
|
steps:
|
|
|
|
- run: apt-get update && apt-get -y install << parameters.apt_opts >>
|
|
|
|
- run: npm install
|
|
|
|
|
2019-10-01 05:10:25 -07:00
|
|
|
win_make:
|
|
|
|
description: "Run mattermost's makefile.ps1 on ./scripts/"
|
|
|
|
parameters:
|
|
|
|
operation:
|
|
|
|
type: string
|
|
|
|
default: ""
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
command: ./scripts/Makefile.ps1 << parameters.operation >>
|
|
|
|
name: << parameters.operation >>
|
|
|
|
shell: powershell
|
|
|
|
build:
|
|
|
|
description: "Building << parameters.os >> app"
|
|
|
|
parameters:
|
|
|
|
os:
|
|
|
|
type: string
|
|
|
|
default: "linux"
|
|
|
|
path:
|
|
|
|
type: string
|
|
|
|
default: "./dist/linux"
|
|
|
|
subpath:
|
|
|
|
type: string
|
|
|
|
default: "./linux/"
|
|
|
|
steps:
|
|
|
|
- run: npm run build
|
|
|
|
- run: npm run package:<< parameters.os >>
|
|
|
|
- run: mkdir -p << parameters.path >>
|
|
|
|
- run: bash -x ./scripts/cp_artifacts.sh release << parameters.path >>
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: ./dist
|
|
|
|
paths:
|
|
|
|
- "./<< parameters.subpath >>/"
|
2019-09-06 13:44:52 -07:00
|
|
|
jobs:
|
|
|
|
check:
|
2019-10-01 05:10:25 -07:00
|
|
|
executor: wine-chrome
|
2019-09-06 13:44:52 -07:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- update_image:
|
|
|
|
apt_opts: "--no-install-recommends"
|
|
|
|
- restore_cache:
|
|
|
|
key: lint-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
|
|
|
|
- run: npm run lint:js-quiet
|
|
|
|
- run: ELECTRON_DISABLE_SANDBOX=1 xvfb-run npm run test:app
|
|
|
|
- run: mkdir -p /tmp/test-results
|
|
|
|
- run: cp test-results.xml /tmp/test-results/
|
|
|
|
- store_test_results:
|
|
|
|
path: /tmp/test-results
|
|
|
|
- save_cache:
|
|
|
|
key: lint-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
|
|
|
|
paths:
|
|
|
|
- "node_modules"
|
|
|
|
- "src/node_modules"
|
|
|
|
|
2019-10-01 05:10:25 -07:00
|
|
|
build-linux:
|
2019-09-06 13:44:52 -07:00
|
|
|
executor: wine-mono
|
2017-07-11 08:01:23 -07:00
|
|
|
steps:
|
|
|
|
- checkout
|
2019-10-01 05:10:25 -07:00
|
|
|
- run: mkdir -p ./dist
|
|
|
|
- attach_workspace:
|
|
|
|
at: ./dist
|
|
|
|
- restore_cache:
|
|
|
|
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
|
|
|
|
- restore_cache:
|
|
|
|
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "src/package-lock.json" }}
|
|
|
|
- update_image:
|
|
|
|
apt_opts: "--no-install-recommends jq icnsutils graphicsmagick tzdata"
|
|
|
|
- build
|
|
|
|
- save_cache:
|
|
|
|
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
|
|
|
|
paths:
|
|
|
|
- "node_modules"
|
|
|
|
- "~/.cache/electron"
|
|
|
|
- "~/.cache/electron-builder"
|
|
|
|
- save_cache:
|
|
|
|
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "src/package-lock.json" }}
|
|
|
|
paths:
|
|
|
|
- "src/node_modules"
|
|
|
|
|
|
|
|
build-win-no-installer:
|
|
|
|
executor: wine-mono
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run: mkdir -p ./dist
|
|
|
|
- attach_workspace:
|
|
|
|
at: ./dist
|
|
|
|
- restore_cache:
|
|
|
|
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
|
|
|
|
- restore_cache:
|
|
|
|
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "src/package-lock.json" }}
|
|
|
|
- update_image:
|
|
|
|
apt_opts: "--no-install-recommends jq icnsutils graphicsmagick tzdata"
|
|
|
|
- build:
|
|
|
|
os: windows
|
|
|
|
path: ./dist/win
|
|
|
|
subpath: ./win/
|
|
|
|
- save_cache:
|
|
|
|
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
|
|
|
|
paths:
|
|
|
|
- "node_modules"
|
|
|
|
- "~/.cache/electron"
|
|
|
|
- "~/.cache/electron-builder"
|
|
|
|
- save_cache:
|
|
|
|
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "src/package-lock.json" }}
|
|
|
|
paths:
|
|
|
|
- "src/node_modules"
|
|
|
|
|
|
|
|
build-mac-no-dmg:
|
|
|
|
executor: wine-mono
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run: mkdir -p ./dist
|
|
|
|
- attach_workspace:
|
|
|
|
at: ./dist
|
2017-07-11 08:01:23 -07:00
|
|
|
- restore_cache:
|
2019-01-07 06:22:35 -08:00
|
|
|
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
|
2017-07-11 08:01:23 -07:00
|
|
|
- restore_cache:
|
2019-01-07 06:22:35 -08:00
|
|
|
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "src/package-lock.json" }}
|
2019-09-06 13:44:52 -07:00
|
|
|
- update_image:
|
|
|
|
apt_opts: "--no-install-recommends jq icnsutils graphicsmagick tzdata"
|
2019-10-21 23:48:00 -07:00
|
|
|
- run: jq '.mac.target=["zip"]' electron-builder.json | jq '.mac.gatekeeperAssess=false' > /tmp/electron-builder.json && cp /tmp/electron-builder.json .
|
|
|
|
|
2019-10-01 05:10:25 -07:00
|
|
|
- build:
|
|
|
|
os: mac
|
|
|
|
path: ./dist/macos
|
|
|
|
subpath: ./macos/
|
2017-07-11 08:01:23 -07:00
|
|
|
- save_cache:
|
2019-01-07 06:22:35 -08:00
|
|
|
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
|
2017-07-11 08:01:23 -07:00
|
|
|
paths:
|
|
|
|
- "node_modules"
|
|
|
|
- "~/.cache/electron"
|
|
|
|
- "~/.cache/electron-builder"
|
|
|
|
- save_cache:
|
2019-01-07 06:22:35 -08:00
|
|
|
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "src/package-lock.json" }}
|
2017-07-11 08:01:23 -07:00
|
|
|
paths:
|
|
|
|
- "src/node_modules"
|
2019-10-01 05:10:25 -07:00
|
|
|
|
|
|
|
msi_installer:
|
|
|
|
executor: win/vs2019
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run: mkdir -p ./dist/
|
|
|
|
- attach_workspace:
|
|
|
|
at: ./dist
|
|
|
|
- win_make:
|
|
|
|
operation: optimize
|
|
|
|
- win_make:
|
|
|
|
operation: "install-deps"
|
|
|
|
- win_make:
|
|
|
|
operation: "build"
|
|
|
|
- run: mkdir -p ./dist/win-release
|
2019-10-28 04:05:05 -07:00
|
|
|
#- run: cp -r release/*.exe ./dist/win-release
|
2019-10-01 05:10:25 -07:00
|
|
|
- run: cp -r release/*.zip ./dist/win-release
|
|
|
|
- run: cp -r release/*.msi ./dist/win-release
|
2019-10-28 04:05:05 -07:00
|
|
|
#- run: cp -r release/*.blockmap ./dist/win-release
|
2019-10-01 05:10:25 -07:00
|
|
|
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: ./dist/
|
|
|
|
paths:
|
|
|
|
- "./win-release/"
|
|
|
|
|
|
|
|
mac_installer:
|
|
|
|
executor: mac
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run: mkdir -p ./dist
|
|
|
|
- attach_workspace:
|
|
|
|
at: ./dist
|
|
|
|
- run:
|
|
|
|
name: Installing npm dependencies
|
|
|
|
command: npm install
|
|
|
|
- build:
|
|
|
|
os: mac
|
|
|
|
path: ./dist/macos-release
|
|
|
|
subpath: ./macos-release/
|
|
|
|
|
|
|
|
store_artifacts:
|
|
|
|
executor: wine-chrome
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: ./dist
|
2017-07-11 08:01:23 -07:00
|
|
|
- store_artifacts:
|
2019-10-01 05:10:25 -07:00
|
|
|
path: ./dist
|
2017-07-11 08:01:23 -07:00
|
|
|
destination: packages
|
|
|
|
|
2019-10-28 04:05:05 -07:00
|
|
|
upload_to_s3:
|
|
|
|
executor: aws
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- attach_workspace:
|
|
|
|
at: ./dist
|
|
|
|
- aws-s3/copy:
|
|
|
|
from: ./dist/
|
|
|
|
to: s3://releases.mattermost.com/desktop/$(jq -r .version package.json)/
|
|
|
|
arguments: --acl public-read --cache-control "no-cache" --recursive
|
|
|
|
upload_to_github:
|
|
|
|
executor: github
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- attach_workspace:
|
|
|
|
at: ./dist
|
|
|
|
- run:
|
|
|
|
name: "Setup files for ghr"
|
|
|
|
command: |
|
|
|
|
mkdir -p ./ghr-dist
|
|
|
|
cp ./dist/{macos-release,win-release,linux}/* ./ghr-dist
|
|
|
|
- run:
|
|
|
|
name: "Publish Release on GitHub"
|
|
|
|
command: |
|
|
|
|
go get github.com/tcnksm/ghr
|
|
|
|
VERSION=$(jq -r .version package.json)
|
|
|
|
RELEASE_TITLE="${VERSION} ($(date -u "+%Y-%m-%d"))"
|
|
|
|
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -draft \
|
|
|
|
--body="$(./scripts/generate_release_markdown.sh $VERSION)" \
|
|
|
|
--name="${RELEASE_TITLE}" $( [[ $VERSION =~ "-rc" ]] && printf %s "-prerelease") \
|
|
|
|
-r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} \
|
|
|
|
-delete ${VERSION} ./ghr-dist
|
|
|
|
|
2017-07-11 08:01:23 -07:00
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build_and_test:
|
|
|
|
jobs:
|
2019-09-06 13:44:52 -07:00
|
|
|
- check
|
2019-10-01 05:10:25 -07:00
|
|
|
- build-linux:
|
2019-09-06 13:44:52 -07:00
|
|
|
requires:
|
|
|
|
- check
|
2019-10-01 05:10:25 -07:00
|
|
|
- build-win-no-installer:
|
|
|
|
requires:
|
|
|
|
- check
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore:
|
|
|
|
- /^release-\d+\.\d+\.\d+?(-rc.*)?/
|
|
|
|
- build-mac-no-dmg:
|
|
|
|
requires:
|
|
|
|
- check
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore:
|
|
|
|
- /^release-\d+\.\d+(\.\d+)?(-rc.*)?/
|
|
|
|
- msi_installer:
|
|
|
|
requires:
|
|
|
|
- check
|
|
|
|
context: windows-codesign
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
# only for release and release candidates
|
|
|
|
# release-XX.YY.ZZ
|
|
|
|
# release-XX.YY.ZZ-rc-something
|
|
|
|
- /^release-\d+\.\d+\.\d+?(-rc.*)?/
|
2019-10-28 04:05:05 -07:00
|
|
|
- release-helpers # remove me
|
2019-10-01 05:10:25 -07:00
|
|
|
- mac_installer:
|
|
|
|
requires:
|
|
|
|
- check
|
|
|
|
context: codesign-certificates
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- /^release-\d+\.\d+\.\d+?(-rc.*)?/
|
2019-10-28 04:05:05 -07:00
|
|
|
- release-helpers # remove-me
|
2019-10-01 05:10:25 -07:00
|
|
|
- store_artifacts:
|
|
|
|
# for master/PR builds
|
|
|
|
requires:
|
|
|
|
- build-linux
|
|
|
|
- build-win-no-installer
|
|
|
|
- build-mac-no-dmg
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore:
|
|
|
|
- /^release-\d+\.\d+\.\d+?(-rc.*)?/
|
2019-10-28 04:05:05 -07:00
|
|
|
- upload_to_s3:
|
|
|
|
# for release builds
|
|
|
|
requires:
|
|
|
|
- msi_installer
|
|
|
|
- mac_installer
|
|
|
|
- build-linux
|
2019-12-04 06:42:52 -08:00
|
|
|
context: mattermost-release-s3
|
2019-10-28 04:05:05 -07:00
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only:
|
|
|
|
- /^v\d+\.\d+\.\d+?$/
|
|
|
|
- release-helpers # remove me
|
|
|
|
|
|
|
|
- upload_to_github:
|
2019-10-01 05:10:25 -07:00
|
|
|
requires:
|
|
|
|
- msi_installer
|
|
|
|
- mac_installer
|
|
|
|
- build-linux
|
2019-10-28 04:05:05 -07:00
|
|
|
context: matterbuild-github-token
|
2019-10-01 05:10:25 -07:00
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- /^release-\d+\.\d+\.\d+?(-rc.*)?/
|
2019-10-28 04:05:05 -07:00
|
|
|
- release-helpers # remove me
|