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

1
.gitignore vendored
View file

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

View file

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