Use build/ as CircleCI workspace (#1810)

* Use build/ as CircleCI workspace

webpack compiles the application code to dist/ and electron-builder
treats it as a source of content to be packaged. As such, using this
path for CircleCI's workspace can cause unwanted scratch files to be
packaged into the app. By instead using build/, we solve the issue.
Moving the entitlements plist to the root of the repo is appropriate
because that's where all the other build config files currently live.

Fixes: #1809

* Update config.yml

Co-authored-by: Devin Binnie <devin.binnie@mattermost.com>
This commit is contained in:
Eli Young 2021-10-14 14:19:44 -07:00 committed by GitHub
parent 6ae15b0cea
commit 2194ca85ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 60 additions and 59 deletions

View file

@ -97,7 +97,7 @@ commands:
default: "linux"
path:
type: string
default: "./dist/linux"
default: "./build/linux"
subpath:
type: string
default: "./linux/"
@ -109,7 +109,7 @@ commands:
- run: mkdir -p << parameters.path >>
- run: bash -x ./scripts/cp_artifacts.sh release << parameters.path >>
- persist_to_workspace:
root: ./dist
root: ./build
paths:
- "./<< parameters.subpath >>/"
save:
@ -149,9 +149,9 @@ jobs:
executor: wine-mono
steps:
- checkout
- run: mkdir -p ./dist
- run: mkdir -p ./build
- attach_workspace:
at: ./dist
at: ./build
- restore_cache:
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
- update_image:
@ -168,16 +168,16 @@ jobs:
executor: wine-mono
steps:
- checkout
- run: mkdir -p ./dist
- run: mkdir -p ./build
- attach_workspace:
at: ./dist
at: ./build
- restore_cache:
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
- update_image:
apt_opts: "--no-install-recommends jq icnsutils graphicsmagick tzdata"
- build:
os: windows
path: ./dist/win
path: ./build/win
subpath: ./win/
- save_cache:
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
@ -190,9 +190,9 @@ jobs:
executor: wine-mono
steps:
- checkout
- run: mkdir -p ./dist
- run: mkdir -p ./build
- attach_workspace:
at: ./dist
at: ./build
- restore_cache:
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
- update_image:
@ -201,7 +201,7 @@ jobs:
- build:
os: mac
path: ./dist/macos
path: ./build/macos
subpath: ./macos/
- save_cache:
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
@ -215,9 +215,9 @@ jobs:
steps:
- checkout
- run: mkdir -p ./dist/
- run: mkdir -p ./build/
- attach_workspace:
at: ./dist
at: ./build
- run:
name: Update node to v16
command: choco install nodejs --version 16.8.0
@ -227,13 +227,13 @@ jobs:
operation: "install-deps"
- win_make:
operation: "build"
- run: mkdir -p ./dist/win-release
- run: cp -r release/*.zip ./dist/win-release
- run: cp -r release/*.msi ./dist/win-release
- run: cp -r release/*.exe ./dist/win-release
- run: mkdir -p ./build/win-release
- run: cp -r release/*.zip ./build/win-release
- run: cp -r release/*.msi ./build/win-release
- run: cp -r release/*.exe ./build/win-release
- persist_to_workspace:
root: ./dist/
root: ./build/
paths:
- "./win-release/"
@ -241,16 +241,16 @@ jobs:
executor: wine-mono
steps:
- checkout
- run: mkdir -p ./dist
- run: mkdir -p ./build
- attach_workspace:
at: ./dist
at: ./build
- restore_cache:
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
- update_image:
apt_opts: "--no-install-recommends jq icnsutils graphicsmagick tzdata"
- build:
os: windows
path: ./dist/win
path: ./build/win
subpath: ./win/
- save_cache:
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
@ -266,9 +266,9 @@ jobs:
steps:
- checkout
- run: mkdir -p ./dist
- run: mkdir -p ./build
- attach_workspace:
at: ./dist
at: ./build
- run:
name: Update node to v16
command: brew upgrade node || true
@ -277,7 +277,7 @@ jobs:
command: npm ci
- build:
os: mac
path: ./dist/macos-release
path: ./build/macos-release
subpath: ./macos-release/
- run:
name: Get rename without brew as it might fail
@ -287,9 +287,9 @@ jobs:
command: tar -xzf rename.tgz
- run:
name: rename arm64 to m1
command: ./rename-1.601/rename 's/arm64/m1/' ./dist/macos-release/*
command: ./rename-1.601/rename 's/arm64/m1/' ./build/macos-release/*
- persist_to_workspace:
root: ./dist
root: ./build
paths:
- "./macos-release/"
- save:
@ -299,9 +299,9 @@ jobs:
executor: wine-mono
steps:
- checkout
- run: mkdir -p ./dist
- run: mkdir -p ./build
- attach_workspace:
at: ./dist
at: ./build
- restore_cache:
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
- update_image:
@ -321,9 +321,9 @@ jobs:
steps:
- checkout
- run: mkdir -p ./dist
- run: mkdir -p ./build
- attach_workspace:
at: ./dist
at: ./build
- run:
name: Update node to v16
command: brew upgrade node || true
@ -332,11 +332,11 @@ jobs:
command: npm ci
- build:
os: mac-universal
path: ./dist/macos-release
path: ./build/macos-release
subpath: ./macos-release/
- build:
os: mac
path: ./dist/macos-release
path: ./build/macos-release
subpath: ./macos-release/
- run:
name: Get rename without brew as it might fail
@ -346,9 +346,9 @@ jobs:
command: tar -xzf rename.tgz
- run:
name: rename arm64 to m1
command: ./rename-1.601/rename 's/arm64/m1/' ./dist/macos-release/*
command: ./rename-1.601/rename 's/arm64/m1/' ./build/macos-release/*
- persist_to_workspace:
root: ./dist
root: ./build
paths:
- "./macos-release/"
@ -356,9 +356,9 @@ jobs:
executor: wine-chrome
steps:
- attach_workspace:
at: ./dist
at: ./build
- store_artifacts:
path: ./dist
path: ./build
destination: packages
- update_base_image:
apt_opts: "jq"
@ -367,16 +367,16 @@ jobs:
command: |
echo $(pwd)
ls .
curl -H "Circle-Token: $CIRCLE_TOKEN" -H "Accept: application/json" -X GET "https://circleci.com/api/v2/project/github/mattermost/desktop/$CIRCLE_BUILD_NUM/artifacts" | jq -r '.items[].url' >> ./dist/artifactlist.txt
grep -v ".yml" ./dist/artifactlist.txt | grep -v "\._" > ./templist.txt
echo "##### :tux: Linux" > ./dist/linklist.txt
grep "linux" ./templist.txt | awk -F/ '{print "- ["$NF"]("$0")"}' >> ./dist/linklist.txt
echo "##### :apple_logo: macOS" >> ./dist/linklist.txt
grep "macos" ./templist.txt | awk -F/ '{print "- ["$NF"]("$0")"}' >> ./dist/linklist.txt
echo "##### :windows: Windows" >> ./dist/linklist.txt
grep "win" ./templist.txt | awk -F/ '{print "- ["$NF"]("$0")"}' >> ./dist/linklist.txt
curl -H "Circle-Token: $CIRCLE_TOKEN" -H "Accept: application/json" -X GET "https://circleci.com/api/v2/project/github/mattermost/desktop/$CIRCLE_BUILD_NUM/artifacts" | jq -r '.items[].url' >> ./build/artifactlist.txt
grep -v ".yml" ./build/artifactlist.txt | grep -v "\._" > ./templist.txt
echo "##### :tux: Linux" > ./build/linklist.txt
grep "linux" ./templist.txt | awk -F/ '{print "- ["$NF"]("$0")"}' >> ./build/linklist.txt
echo "##### :apple_logo: macOS" >> ./build/linklist.txt
grep "macos" ./templist.txt | awk -F/ '{print "- ["$NF"]("$0")"}' >> ./build/linklist.txt
echo "##### :windows: Windows" >> ./build/linklist.txt
grep "win" ./templist.txt | awk -F/ '{print "- ["$NF"]("$0")"}' >> ./build/linklist.txt
- persist_to_workspace:
root: ./dist
root: ./build
paths:
- ./linklist.txt
- ./artifactlist.txt
@ -385,7 +385,7 @@ jobs:
executor: wine-chrome
steps:
- attach_workspace:
at: ./dist
at: ./build
- update_base_image:
apt_opts: "jq"
- run: mkdir -p ./links
@ -394,7 +394,7 @@ jobs:
name: "Get urls for sharing"
command: |
echo "Links for $(date +"%b-%d-%Y")" >> ./links/linklist.txt
cat ./dist/linklist.txt >> ./links/linklist.txt
cat ./build/linklist.txt >> ./links/linklist.txt
- run:
command: |
linklist=$(<./links/linklist.txt);
@ -412,7 +412,7 @@ jobs:
steps:
- checkout
- attach_workspace:
at: ./dist
at: ./build
- run:
name: "Don't upload if it's not on a tag"
command: |
@ -423,7 +423,7 @@ jobs:
name: "Setup files for aws-s3"
command: |
mkdir -p ./aws-s3-dist
cp --backup=numbered ./dist/{macos-release,win-release,linux}/* ./aws-s3-dist
cp --backup=numbered ./build/{macos-release,win-release,linux}/* ./aws-s3-dist
- aws-s3/copy:
from: ./aws-s3-dist/
to: s3://releases.mattermost.com/desktop/$(jq -r .version package.json)/
@ -434,7 +434,7 @@ jobs:
steps:
- checkout
- attach_workspace:
at: ./dist
at: ./build
- run:
name: "install renaming utility"
command: |
@ -442,15 +442,15 @@ jobs:
- run:
name: "Normalize folder names"
command: |
mv ./dist/macos-release ./dist/macos
mv ./build/macos-release ./build/macos
- run:
name: "Rename to daily for consistency"
command: |
rename 's/\d+\.\d+\.\d+/daily/' ./dist/macos/*
rename 's/\d+\.\d+\.\d+/daily/' ./dist/linux/*
rename 's/\d+\.\d+\.\d+/daily/' ./dist/win/*
rename 's/\d+\.\d+\.\d+/daily/' ./build/macos/*
rename 's/\d+\.\d+\.\d+/daily/' ./build/linux/*
rename 's/\d+\.\d+\.\d+/daily/' ./build/win/*
- aws-s3/copy:
from: ./dist/
from: ./build/
to: s3://mattermost-desktop-daily-builds/
arguments: --acl public-read --cache-control "no-cache" --recursive
@ -459,7 +459,7 @@ jobs:
steps:
- checkout
- attach_workspace:
at: ./dist
at: ./build
- run:
name: "Don't upload if it's not on a tag"
command: |
@ -470,7 +470,7 @@ jobs:
name: "Setup files for ghr"
command: |
mkdir -p ./ghr-dist
cp --backup=numbered ./dist/{macos-release,win-release,linux}/* ./ghr-dist
cp --backup=numbered ./build/{macos-release,win-release,linux}/* ./ghr-dist
- run:
name: "Publish Release on GitHub"
command: |
@ -571,7 +571,7 @@ workflows:
branches:
only:
- /^release-\d+(\.\d+){1,2}(-rc.*)?/
- pull/1790
- pull/1810
- store_artifacts:
# for master/PR builds

1
.gitignore vendored
View file

@ -7,6 +7,7 @@ node_modules/
release/
npm-debug.log*
build/
dist/
test-results.xml

View file

@ -84,8 +84,8 @@
],
"hardenedRuntime": true,
"gatekeeperAssess": true,
"entitlements": "./build/entitlements.mac.plist",
"entitlementsInherit": "./build/entitlements.mac.plist",
"entitlements": "./entitlements.mac.plist",
"entitlementsInherit": "./entitlements.mac.plist",
"extendInfo": {
"NSMicrophoneUsageDescription": "Microphone access may be used by Mattermost plugins, such as Jitsi video conferencing.",
"NSCameraUsageDescription": "Camera access may be used by Mattermost plugins, such as Jitsi video conferencing.",