feat(ci): CircleCI migration to Github Actions (#2516)

* Deprecated trigger-desktop-nightly repo from gitlab
* Migrated Nightly builds URLs from CircleCI to S3
* Full CI/CD is handled by Github Actions

---------

Co-authored-by: Tasos Boulis <tboulis@hotmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
Antonis Stamatiou 2023-03-06 11:51:25 +02:00 committed by GitHub
parent 8efa3480e4
commit b62b25fdda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 2271 additions and 3300 deletions

View file

@ -1,755 +0,0 @@
version: 2.1
parameters:
run_nightly:
default: false
type: boolean
orbs:
win: circleci/windows@5.0.0
aws-s3: circleci/aws-s3@2.0.0
owasp: entur/owasp@0.0.10
executors:
check-image:
working_directory: ~/mattermost-desktop
docker:
- image: electronuserland/builder:16-wine-chrome
environment:
TAR_OPTIONS: --no-same-owner
wine-chrome:
working_directory: ~/mattermost-desktop
docker:
- image: electronuserland/builder:16-wine-chrome
environment:
TAR_OPTIONS: --no-same-owner
wine-mono:
working_directory: ~/mattermost-desktop
docker:
- image: electronuserland/builder:16-wine-mono
mac:
working_directory: ~/mattermost-desktop
macos:
xcode: "13.0.0"
aws:
working_directory: ~/mattermost-desktop
docker:
- image: 'circleci/python:2.7'
github:
working_directory: ~/mattermost-desktop
docker:
- image: cimg/go:1.19.2
commands:
notify:
description: "notify on release channel"
parameters:
message:
type: string
default: "This is the default notification message, someone forgot to add info on what to notify!"
username:
type: string
default: "MattermostRelease"
icon:
type: string
default: "https://mattermost.com/wp-content/uploads/2022/02/icon.png"
steps:
- run:
command: |
export VERSION=$(jq -r .version package.json)
echo '{}' | jq "{
\"username\": \"<< parameters.username >>\",
\"icon_url\": \"<< parameters.icon >>\",
\"text\": \"[${VERSION}] << parameters.message >>\"
}" >> /tmp/webhook-data.json
- run:
command: |
curl -i -H "Content-Type: application/json" -X POST -d @/tmp/webhook-data.json $MATTERMOST_RELEASE_WEBHOOK_URL_DESKTOP || echo "NOFICATION FAILED! check logs as this will succeed intentionally"
update_base_image:
description: "Update base image"
parameters:
apt_opts:
type: string
default: ""
steps:
- run: wget -qO - https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/Release.key | apt-key add -
- run: apt-get update || true && apt-get install -y ca-certificates libxtst-dev libpng++-dev gcc-aarch64-linux-gnu g++-aarch64-linux-gnu && apt-get update && apt-get -y install << parameters.apt_opts >>
- run: wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.20.1/yq_linux_amd64 && chmod a+x /usr/local/bin/yq
update_image:
description: "Update image"
parameters:
apt_opts:
type: string
default: ""
steps:
- update_base_image:
apt_opts: << parameters.apt_opts >>
- run: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm ci
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: "./build/linux"
subpath:
type: string
default: "./linux/"
steps:
- run:
name: npn run
command: npm run package:<< parameters.os >>
no_output_timeout: 60m
- run: bash -x ./scripts/patch_updater_yml.sh
- run: mkdir -p << parameters.path >>
- run: bash -x ./scripts/cp_artifacts.sh release << parameters.path >>
- persist_to_workspace:
root: ./build
paths:
- "./<< parameters.subpath >>/"
check:
description: "Running automated tests"
steps:
- run: npm run check-types
- run:
name: i18n check
command: |
cp i18n/en.json /tmp/en.json
npm run mmjstool -- i18n extract-desktop --desktop-dir .
diff /tmp/en.json i18n/en.json
rm -rf tmp
- run: ELECTRON_DISABLE_SANDBOX=1 npm run test:unit-ci
- run: mkdir -p /tmp/test-results
- run: cp test-results.xml /tmp/test-results/
- store_test_results:
path: /tmp/test-results
check-windows:
description: "Running automated tests"
steps:
- run: npm run check-types
- run:
name: i18n check
command: |
cp .\i18n\en.json $env:TEMP\en.json
npm run mmjstool -- i18n extract-desktop --desktop-dir .
diff $env:TEMP\en.json .\i18n\en.json
rm $env:TEMP\en.json
- run: $env:ELECTRON_DISABLE_SANDBOX=1; npm run test:unit
- run: mkdir -p $env:TEMP\test-results
- run: cp test-results.xml $env:TEMP\test-results\
- store_test_results:
path: /tmp/test-results
save:
description: "Save binaries artifacts"
parameters:
filename:
type: string
steps:
- run:
name: Copying artifacts
command: |
mkdir /tmp/artifacts;
cp release/<<parameters.filename>> /tmp/artifacts;
- store_artifacts:
path: /tmp/artifacts
jobs:
build-linux:
executor: wine-mono
steps:
- checkout
- run: mkdir -p ./build
- attach_workspace:
at: ./build
- update_image:
apt_opts: "--no-install-recommends jq icnsutils graphicsmagick tzdata"
- check
- build
- persist_to_workspace:
root: ./build/
paths:
- "./linux/"
- save_cache:
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
paths:
- "node_modules"
- "~/.cache/electron"
- "~/.cache/electron-builder"
build-win-no-installer:
executor: win/server-2019
steps:
- checkout
- run: mkdir -p ./build
- attach_workspace:
at: ./build
- run: |
$InstallPath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
$WorkLoads = '--add Microsoft.VisualStudio.Component.VC.ATL.ARM64'
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"", $WorkLoads, '--quiet', '--norestart', '--nocache')
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden -WorkingDirectory "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
- run:
name: Install yq
command: choco install yq --version 4.15.1 -y
- run:
name: Install nodejs-lts
command: nvm off; choco install nodejs-lts -y
- run: npm i -g node-gyp; node-gyp install; node-gyp install --devdir="$env:USERPROFILE\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers"
- run: $env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = 1; npm ci
- check-windows
- build:
os: windows
path: ./build/win
subpath: ./win/
- save_cache:
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
paths:
- "node_modules"
- "~/.cache/electron"
- "~/.cache/electron-builder"
build-mac-no-dmg:
executor: mac
steps:
- checkout
- run: mkdir -p ./build
- attach_workspace:
at: ./build
- run: brew install yq
- run:
name: Update node to v16
command: nvm install --lts && nvm use --lts
- run: jq '.mac.target=["zip"]' electron-builder.json | jq '.mac.gatekeeperAssess=false' > /tmp/electron-builder.json && cp /tmp/electron-builder.json .
- run: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm ci
- check
- build:
os: mac
path: ./build/macos
subpath: ./macos/
- save_cache:
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
paths:
- "node_modules"
- "~/.cache/electron"
- "~/.cache/electron-builder"
msi_installer:
executor: win/server-2019
steps:
- checkout
- run: mkdir -p ./build/
- attach_workspace:
at: ./build
- run: |
$InstallPath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
$WorkLoads = '--add Microsoft.VisualStudio.Component.VC.ATL.ARM64'
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"", $WorkLoads, '--quiet', '--norestart', '--nocache')
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden -WorkingDirectory "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
- run:
name: Install yq
command: choco install yq --version 4.15.1 -y
- run:
name: Install nodejs-lts
command: nvm off; choco install nodejs-lts -y
- win_make:
operation: optimize
- win_make:
operation: "install-deps"
- check-windows
- win_make:
operation: "build"
- run: bash -x ./scripts/patch_updater_yml.sh
- run: mkdir -p ./build/win-release
- run: bash -x ./scripts/cp_artifacts.sh release ./build/win-release
- persist_to_workspace:
root: ./build/
paths:
- "./win-release/"
build-windows-pr:
executor: win/server-2019
steps:
- checkout
- run: mkdir -p ./build
- attach_workspace:
at: ./build
- run: |
$InstallPath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
$WorkLoads = '--add Microsoft.VisualStudio.Component.VC.ATL.ARM64'
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"", $WorkLoads, '--quiet', '--norestart', '--nocache')
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden -WorkingDirectory "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
- run:
name: Install yq
command: choco install yq --version 4.15.1 -y
- run:
name: Install nodejs-lts
command: nvm off; choco install nodejs-lts -y
- run: npm i -g node-gyp; node-gyp install; node-gyp install --devdir="$env:USERPROFILE\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers"
- run: $env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = 1; npm ci
- build:
os: windows
path: ./build/win
subpath: ./win/
- save_cache:
key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }}
paths:
- "node_modules"
- "~/.cache/electron"
- "~/.cache/electron-builder"
- save:
filename: "$(jq -r .version package.json)/*.zip"
build-mac-pr:
executor: mac
steps:
- checkout
- run: mkdir -p ./build
- attach_workspace:
at: ./build
- run: brew install yq
- run:
name: Update node to v16
command: nvm install --lts && nvm use --lts
- run:
name: Installing npm dependencies
command: npm ci
- build:
os: mac
path: ./build/macos-release
subpath: ./macos-release/
- run:
name: Get rename without brew as it might fail
command: curl -L https://github.com/ap/rename/archive/v1.601.tar.gz --output rename.tgz
- run:
name: extract rename
command: tar -xzf rename.tgz
- run:
name: rename arm64 to m1
command: ./rename-1.601/rename 's/arm64/m1/' ./release/$(jq -r .version package.json)/*
- save:
filename: "$(jq -r .version package.json)/*.dmg"
build-linux-pr:
executor: wine-mono
steps:
- checkout
- run: mkdir -p ./build
- attach_workspace:
at: ./build
- 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:
filename: "$(jq -r .version package.json)/*.tar.gz"
mac_installer:
executor: mac
steps:
- checkout
- run: mkdir -p ./build
- attach_workspace:
at: ./build
- run:
name: Update node to v16
command: nvm install --lts && nvm use --lts
- run:
name: Install yq
command: brew install yq
- run:
name: Installing npm dependencies
command: npm ci
- check
- build:
os: mac-with-universal
path: ./build/macos-release
subpath: ./macos-release/
- run:
name: Get rename without brew as it might fail
command: curl -L https://github.com/ap/rename/archive/v1.601.tar.gz --output rename.tgz
- run:
name: extract rename
command: tar -xzf rename.tgz
- run:
name: rename arm64 to m1
command: ./rename-1.601/rename 's/arm64/m1/' ./build/macos-release/$(jq -r .version package.json)/*
- persist_to_workspace:
root: ./build
paths:
- "./macos-release/"
mac_app_store_testflight:
executor: mac
steps:
- checkout
- run: mkdir -p ./build
- attach_workspace:
at: ./build
- run:
name: Update node to v16
command: nvm install --lts && nvm use --lts
- run:
name: Install yq
command: brew install yq
- run:
name: Installing npm dependencies
command: npm ci
- run:
name: Copy provisioning profile
command: echo $MAS_PROFILE | base64 -D > ./mas.provisionprofile
- run:
name: Patch version number for MAS
command: ./scripts/patch_mas_version.sh
- check
- run: npm run package:mas
- run:
name: Don't submit unless it's on a tag or it's the nightly build
command: |
if [ -z `git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null` ]; then
if [ `git rev-parse --abbrev-ref HEAD` != "nightly" ]; then
circleci-agent step halt
fi
fi
- run:
name: 'Upload to App Store Connect'
command: fastlane publish_test path:"$(find . -name \*.pkg -print -quit)"
store_artifacts:
executor: wine-chrome
steps:
- attach_workspace:
at: ./build
- store_artifacts:
path: ./build
destination: packages
- update_base_image:
apt_opts: "jq"
- run:
name: "store url links"
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' >> ./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: ./build
paths:
- ./linklist.txt
- ./artifactlist.txt
share_to_channel:
executor: wine-chrome
steps:
- attach_workspace:
at: ./build
- update_base_image:
apt_opts: "jq"
- run: mkdir -p ./links
- run: echo "### Nightly builds:\n" > ./links/linklist.txt
- run:
name: "Get urls for sharing"
command: |
echo "Links for $(date +"%b-%d-%Y")" >> ./links/linklist.txt
cat ./build/linklist.txt >> ./links/linklist.txt
- run:
command: |
linklist=$(<./links/linklist.txt);
echo '{}' | jq "{
\"username\": \"NightBuilder\",
\"icon_url\": \"https://upload.wikimedia.org/wikipedia/commons/1/17/Luna_symbol.png\",
\"text\": \"${linklist}\"
}" >> /tmp/webhook-data.json
- run:
command: |
curl -i -X POST -H "Content-Type: application/json" -d @/tmp/webhook-data.json $MM_TOKEN || echo "NOFICATION FAILED! check logs as this will succeed intentionally"
upload_to_s3:
executor: aws
steps:
- checkout
- attach_workspace:
at: ./build
- run:
name: "Don't upload if it's not on a tag"
command: |
if [ -z `git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null` ]; then
circleci-agent step halt
fi
- run:
name: "Setup files for aws-s3"
command: |
mkdir -p ./aws-s3-dist
cp -r --backup=numbered ./build/{macos-release,win-release,linux}/* ./aws-s3-dist
- aws-s3/copy:
from: ./aws-s3-dist/
to: s3://releases.mattermost.com/desktop/
arguments: --acl public-read --cache-control "no-cache" --recursive
upload_to_s3_daily:
executor: aws
steps:
- checkout
- attach_workspace:
at: ./build
- run:
name: "install renaming utility"
command: |
sudo apt-get install rename
- run:
name: "Normalize folder names"
command: |
mv ./build/macos-release ./build/macos && mv ./build/win-release ./build/win
- run:
name: "Rename to daily for consistency"
command: |
rename 's/\d+\.\d+\.\d+\-nightly\.\d+\/mattermost(.+)\d+\.\d+\.\d+\-nightly\.\d+/mattermost$1daily-develop/' ./build/macos/$(jq -r .version package.json)/*
rename 's/\d+\.\d+\.\d+\-nightly\.\d+\/mattermost(.+)\d+\.\d+\.\d+\-nightly\.\d+/mattermost$1daily-develop/' ./build/linux/$(jq -r .version package.json)/*
rename 's/\d+\.\d+\.\d+\-nightly\.\d+\/mattermost(.+)\d+\.\d+\.\d+\-nightly\.\d+/mattermost$1daily-develop/' ./build/win/$(jq -r .version package.json)/*
- aws-s3/copy:
from: ./build/
to: s3://mattermost-desktop-daily-builds/
arguments: --acl public-read --cache-control "no-cache" --recursive
upload_to_github:
executor: github
steps:
- checkout
- attach_workspace:
at: ./build
- run:
name: "Don't upload if it's not on a tag"
command: |
if [ -z `git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null` ]; then
circleci-agent step halt
fi
- run:
name: "Setup files for ghr"
command: |
mkdir -p ./ghr-dist
find ./build/{macos-release,win-release,linux} -type f -exec cp --backup=numbered -t ./ghr-dist {} +
- run:
name: "Publish Release on GitHub"
command: |
go install github.com/tcnksm/ghr@latest
VERSION=$(jq -r .version package.json)
RELEASE_TITLE="v${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 \
v${VERSION} ./ghr-dist
begin-notification:
executor: wine-chrome
steps:
- checkout
- update_image:
apt_opts: "--no-install-recommends jq"
- notify:
message: "Release process for the desktop app has started, it should take about 30 minutes to complete."
end-notification:
executor: wine-chrome
steps:
- checkout
- update_image:
apt_opts: "--no-install-recommends jq"
- notify:
message: "Release process for the desktop app ended, the new release can be found on [GitHub](https://github.com/mattermost/desktop/releases)."
workflows:
version: 2
build_and_test:
jobs:
- begin-notification:
context: desktop-notify
filters:
branches:
only:
# only for release and release candidates
# release-XX.YY.ZZ
# release-XX.YY.ZZ-rc-something
- /^release-\d+(\.\d+){1,2}(-rc.*)?/
- build-linux:
filters:
branches:
ignore:
- /^build-pr-.*/
- nightly
- build-win-no-installer:
filters:
branches:
ignore:
- /^release-\d+(\.\d+){1,2}(-rc.*)?/
- /^build-pr-.*/
- nightly
- build-mac-no-dmg:
filters:
branches:
ignore:
- /^release-\d+(\.\d+){1,2}(-rc.*)?/
- /^build-pr-.*/
- nightly
- msi_installer:
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+){1,2}(-rc.*)?/
- mac_installer:
context: codesign-certificates
filters:
branches:
only:
- /^release-\d+(\.\d+){1,2}(-rc.*)?/
- mac_app_store_testflight:
context: desktop-mac-app-store
filters:
branches:
only:
- /^release-\d+(\.\d+){1,2}(-rc.*)?/
- store_artifacts:
# for master/PR builds
requires:
- build-linux
- build-win-no-installer
- build-mac-no-dmg
- mac_installer
filters:
branches:
ignore:
- /^release-\d+(\.\d+){1,2}(-rc.*)?/
- /^build-pr-.*/
- nightly
- upload_to_s3:
# for release builds
requires:
- msi_installer
- mac_installer
- build-linux
context: mattermost-release-s3
filters:
branches:
only:
- /^release-\d+(\.\d+){1,2}(-rc.*)?/
- upload_to_github:
requires:
- upload_to_s3
context: matterbuild-github-token
filters:
branches:
only:
- /^release-\d+(\.\d+){1,2}(-rc.*)?/
- end-notification:
requires:
- upload_to_github
context: desktop-notify
filters:
branches:
only:
# only for release and release candidates
# release-XX.YY.ZZ
# release-XX.YY.ZZ-rc-something
- /^release-\d+(\.\d+){1,2}(-rc.*)?/
build-for-pr:
jobs:
- build-windows-pr:
context: electron-installer
filters:
branches:
only: /^build-pr-.*/
- build-mac-pr:
context: codesign-certificates
filters:
branches:
only: /^build-pr-.*/
- build-linux-pr:
filters:
branches:
only: /^build-pr-.*/
nightly_browser_view:
when: << pipeline.parameters.run_nightly >>
jobs:
- build-linux
- msi_installer:
context: windows-codesign
- mac_installer:
context: codesign-certificates
- mac_app_store_testflight:
context: desktop-mac-app-store
- store_artifacts:
context: desktop_browserview
# for master/PR builds
requires:
- build-linux
- msi_installer
- mac_installer
- upload_to_s3:
context: mattermost-release-s3
requires:
- build-linux
- msi_installer
- mac_installer
- share_to_channel:
context: desktop_browserview
requires:
- store_artifacts
nightly_rainforest:
when: << pipeline.parameters.run_nightly >>
jobs:
- msi_installer:
context:
- windows-codesign
- desktop-rainforest-build
- mac_installer:
context:
- codesign-certificates
- desktop-rainforest-build
- upload_to_s3_daily:
context: mattermost-desktop-daily-s3
requires:
- msi_installer
- mac_installer

View file

@ -0,0 +1,11 @@
# Copyright 2022 Mattermost, Inc.
name: "patch-version"
description: This action is used to patch package.json version with the nightly build
runs:
using: "composite"
steps:
- name: ci/generate-version
id: generate-version
shell: bash
run: go run ${{ github.action_path }}/patch-version.go .

View file

@ -0,0 +1,42 @@
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
"strings"
"time"
)
func main() {
args := os.Args[1:]
packageFileName := fmt.Sprintf("%s/package.json", args[0])
packageJson, err := os.Open(packageFileName)
if err != nil {
log.Fatal(err)
}
packageBytes, err := ioutil.ReadAll(packageJson)
if err != nil {
log.Fatal(err)
}
var packageInfo map[string]interface{}
json.Unmarshal(packageBytes, &packageInfo)
originalVersion := fmt.Sprintf("%s", packageInfo["version"])
nightlyVersion := fmt.Sprintf("%s-nightly.%s", strings.Split(originalVersion, "-")[0], time.Now().Format("20060102"))
packageInfo["version"] = nightlyVersion
newPackageJson := strings.Replace(string(packageBytes), originalVersion, nightlyVersion, 1)
err = ioutil.WriteFile(packageFileName, []byte(newPackageJson), 0644)
if err != nil {
log.Fatal(err)
}
packageJson.Close()
fmt.Println("Update package.json with version:", nightlyVersion)
}

27
.github/actions/test/action.yaml vendored Normal file
View file

@ -0,0 +1,27 @@
# Copyright 2022 Mattermost, Inc.
name: "test-ci"
description: This action used to run universal tests for all OS
inputs:
shell:
description: The shell to run the test
required: true
default: bash
runs:
using: "composite"
steps:
- name: ci/run-check-types
run: npm run check-types
shell: ${{ inputs.shell }}
- name: ci/run-i18n-check
shell: ${{ inputs.shell }}
run: |
npm run mmjstool -- i18n extract-desktop --desktop-dir .
git --no-pager diff --exit-code i18n/en.json
- name: ci/run-unit-ci
shell: ${{ inputs.shell }}
env:
ELECTRON_DISABLE_SANDBOX: "1"
run: |
npm run test:unit-ci

169
.github/workflows/build-for-pr.yml vendored Normal file
View file

@ -0,0 +1,169 @@
name: build-for-pr
on:
push:
# only for build-pr branches
# build-pr-*
branches:
- build-pr-*
defaults:
run:
shell: bash
env:
TERM: xterm
jobs:
build-linux-for-pr:
runs-on: ubuntu-latest-4-cores
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: ci/install-dependencies
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
wget -qO - https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/Release.key | sudo apt-key add -
wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.20.1/yq_linux_amd64 && chmod a+x /usr/local/bin/yq
sudo apt-get update || true && sudo apt-get install -y ca-certificates libxtst-dev libpng++-dev gcc-aarch64-linux-gnu g++-aarch64-linux-gnu jq icnsutils graphicsmagick tzdata
npm ci
- name: ci/build
run: |
mkdir -p ./build/linux
npm run package:linux
bash -x ./scripts/patch_updater_yml.sh
bash -x ./scripts/cp_artifacts.sh release ./build/linux
- name: ci/upload-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: build-linux
path: ./build/linux
retention-days: 10 ## No need to keep CI builds more than 10 days
windows-install-deps:
runs-on: windows-2022
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: ci/cache-node-modules
id: cache-node-modules
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
with:
path: node_modules
key: ${{ runner.os }}-build-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-node-modules
${{ runner.os }}-build-
${{ runner.os }}-
- name: ci/install-dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
choco install yq --version 4.15.1 -y
npm i -g node-gyp
node-gyp install
node-gyp install --devdir="C:\Users\runneradmin\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers"
npm ci --openssl_fips=''
build-win-for-pr:
runs-on: windows-2022
needs:
- windows-install-deps
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: ci/cache-node-modules
id: cache-node-modules
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
with:
path: node_modules
key: ${{ runner.os }}-build-node-modules-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-node-modules
${{ runner.os }}-build-
${{ runner.os }}-
- name: ci/install-node-gyp
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
choco install yq --version 4.15.1 -y
npm i -g node-gyp
node-gyp install
node-gyp install --devdir="C:\Users\runneradmin\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers"
- name: ci/install-dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
npm ci --openssl_fips=''
- name: ci/build
env:
MM_WIN_INSTALLERS: 1
run: |
mkdir -p ./build/win
npm run package:windows
bash -x ./scripts/patch_updater_yml.sh
bash -x ./scripts/cp_artifacts.sh release ./build/win
- name: ci/upload-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: build-windows
path: ./build/win
retention-days: 10 ## No need to keep CI builds more than 10 days
build-mac-for-pr:
runs-on: macos-12
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: ci/install-dependencies
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
brew install yq
jq '.mac.target=["zip"]' electron-builder.json | jq '.mac.gatekeeperAssess=false' > /tmp/electron-builder.json && cp /tmp/electron-builder.json .
npm ci
- name: ci/build
env:
APPLEID: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_APPLE_ID }}
APPLEIDPASS: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_APPLE_ID_PASS }}
CSC_FOR_PULL_REQUEST: true
CSC_KEY_PASSWORD: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_KEY_PASSWORD }}
CSC_LINK: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_LINK }}
run: |
mkdir -p ./build/macos
npm run package:mac
bash -x ./scripts/patch_updater_yml.sh
bash -x ./scripts/cp_artifacts.sh release ./build/macos/
- name: ci/upload-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: build-macos
path: ./build/macos/
retention-days: 10 ## No need to keep CI builds more than 10 days

213
.github/workflows/ci.yaml vendored Normal file
View file

@ -0,0 +1,213 @@
name: ci
on:
pull_request:
defaults:
run:
shell: bash
env:
TERM: xterm
jobs:
build-linux:
runs-on: ubuntu-latest-4-cores
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: ci/install-dependencies
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
wget -qO - https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/Release.key | sudo apt-key add -
wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.20.1/yq_linux_amd64 && chmod a+x /usr/local/bin/yq
sudo apt-get update || true && sudo apt-get install -y ca-certificates libxtst-dev libpng++-dev gcc-aarch64-linux-gnu g++-aarch64-linux-gnu jq icnsutils graphicsmagick tzdata
npm ci
- name: ci/test
uses: ./.github/actions/test
- name: ci/build
run: |
mkdir -p ./build/linux
npm run package:linux
bash -x ./scripts/patch_updater_yml.sh
bash -x ./scripts/cp_artifacts.sh release ./build/linux
- name: ci/upload-test-results
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: linux-test-results
path: test-results.xml
retention-days: 5
- name: ci/upload-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: build-linux
path: ./build/linux
retention-days: 10 ## No need to keep CI builds more than 10 days
windows-install-deps:
runs-on: windows-2022
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: ci/cache-node-modules
id: cache-node-modules
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
with:
path: node_modules
key: ${{ runner.os }}-build-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-node-modules
${{ runner.os }}-build-
${{ runner.os }}-
- name: ci/install-dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
choco install yq --version 4.15.1 -y
npm i -g node-gyp
node-gyp install
node-gyp install --devdir="C:\Users\runneradmin\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers"
npm ci --openssl_fips=''
build-win-no-installer:
runs-on: windows-2022
needs:
- windows-install-deps
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: ci/cache-node-modules
id: cache-node-modules
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
with:
path: node_modules
key: ${{ runner.os }}-build-node-modules-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-node-modules
${{ runner.os }}-build-
${{ runner.os }}-
- name: ci/install-node-gyp
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
choco install yq --version 4.15.1 -y
npm i -g node-gyp
node-gyp install
node-gyp install --devdir="C:\Users\runneradmin\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers"
- name: ci/install-dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
npm ci --openssl_fips=''
- name: ci/test
uses: ./.github/actions/test
- name: ci/build
run: |
mkdir -p ./build/win
npm run package:windows
bash -x ./scripts/patch_updater_yml.sh
bash -x ./scripts/cp_artifacts.sh release ./build/win
- name: ci/upload-test-results
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: windows-test-results
path: test-results.xml
retention-days: 5
- name: ci/upload-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: build-windows
path: ./build/win
retention-days: 10 ## No need to keep CI builds more than 10 days
build-mac-no-dmg:
runs-on: macos-12
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: ci/install-dependencies
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
brew install yq
jq '.mac.target=["zip"]' electron-builder.json | jq '.mac.gatekeeperAssess=false' > /tmp/electron-builder.json && cp /tmp/electron-builder.json .
npm ci
- name: ci/test
uses: ./.github/actions/test
- name: ci/build
run: |
mkdir -p ./build/macos
npm run package:mac
bash -x ./scripts/patch_updater_yml.sh
bash -x ./scripts/cp_artifacts.sh release ./build/macos/
- name: ci/upload-test-results
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: macos-test-results
path: test-results.xml
retention-days: 5
- name: ci/upload-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: build-macos
path: ./build/macos/
retention-days: 10 ## No need to keep CI builds more than 10 days
report-test-results:
if: always()
needs:
- build-mac-no-dmg
- build-win-no-installer
- build-linux
runs-on: ubuntu-22.04
permissions:
checks: write
pull-requests: write
steps:
- name: ci/download-macos-test-results
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: macos-test-results
path: macos-test-results
- name: ci/download-windows-test-results
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: windows-test-results
path: windows-test-results
- name: ci/download-linux-test-results
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: linux-test-results
path: linux-test-results
- name: ci/publish-results
uses: EnricoMi/publish-unit-test-result-action@a3caf02865c0604ad3dc1ecfcc5cdec9c41b7936 # v2.3.0
with:
comment_mode: failures
compare_to_earlier_commit: false
junit_files: "**/*.xml"

View file

@ -0,0 +1,232 @@
name: nightly-browser-view
on:
schedule:
- cron: 0 4 * * 0-5
defaults:
run:
shell: bash
env:
TERM: xterm
jobs:
build-linux:
runs-on: ubuntu-22.04
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: ci/install-dependencies
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
wget -qO - https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/Release.key | sudo apt-key add -
wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.20.1/yq_linux_amd64 && chmod a+x /usr/local/bin/yq
sudo apt-get update || true && sudo apt-get install -y ca-certificates libxtst-dev libpng++-dev gcc-aarch64-linux-gnu g++-aarch64-linux-gnu jq icnsutils graphicsmagick tzdata
npm ci
- name: nightly/patch-version
uses: ./.github/actions/patch-nightly-version
- name: ci/build
run: |
mkdir -p ./build/linux
npm run package:linux
bash -x ./scripts/patch_updater_yml.sh
bash -x ./scripts/cp_artifacts.sh release ./build/linux
- name: ci/upload-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: build
path: ./build
retention-days: 5 ## No need to keep them since they are uploaded on S3
build-msi-installer:
runs-on: windows-2022
steps:
- name: nightly/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: nightly/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: nightly/create-build-folder
run: mkdir -p ./build
- name: nightly/optimize
shell: powershell
run: |
./scripts/Makefile.ps1 optimize
- name: nightly/install-deps
shell: powershell
run: |
./scripts/Makefile.ps1 install-deps
- name: nightly/test
uses: ./.github/actions/test
- name: nightly/patch-version
uses: ./.github/actions/patch-nightly-version
- name: nightly/build
shell: powershell
env:
MM_WIN_INSTALLERS: 1
PFX_KEY: ${{ secrets.MM_DESKTOP_MSI_INSTALLER_PFX_KEY }}
CSC_KEY_PASSWORD: ${{ secrets.MM_DESKTOP_MSI_INSTALLER_CSC_KEY_PASSWORD }}
PFX: ${{ secrets.MM_DESKTOP_MSI_INSTALLER_PFX }}
CSC_LINK: ${{ secrets.MM_DESKTOP_MSI_INSTALLER_CSC_LINK }}
run: |
./scripts/Makefile.ps1 build
- name: nightly/package
run: |
bash -x ./scripts/patch_updater_yml.sh
mkdir -p ./build/win-release
bash -x ./scripts/cp_artifacts.sh release ./build/win-release
- name: nightly/upload-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: build
path: ./build
retention-days: 5 ## No need to keep them since they are uploaded on S3
mac-app-store-preflight:
runs-on: macos-12
env:
MAS_PROFILE: ${{ secrets.MM_DESKTOP_MAC_APP_STORE_MAS_PROFILE }}
MACOS_API_KEY_ID: ${{ secrets.MM_DESKTOP_MAC_APP_STORE_MACOS_API_KEY_ID }}
MACOS_API_KEY: ${{ secrets.MM_DESKTOP_MAC_APP_STORE_MACOS_API_KEY }}
MACOS_API_ISSUER_ID: ${{ secrets.MM_DESKTOP_MAC_APP_STORE_MACOS_API_ISSUER_ID }}
CSC_FOR_PULL_REQUEST: true
CSC_KEY_PASSWORD: ${{ secrets.MM_DESKTOP_MAC_APP_STORE_CSC_KEY_PASSWORD}}
CSC_LINK: ${{ secrets.MM_DESKTOP_MAC_APP_STORE_CSC_LINK }}
needs:
- begin-notification
steps:
- name: nightly/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: nightly/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: nightly/create-build-folder
run: mkdir -p ./build
- name: nightly/install-dependencies
run: |
brew install yq
npm ci
- name: nightly/copy-provisioning-profile
run: echo $MAS_PROFILE | base64 -D > ./mas.provisionprofile
- name: nightly/patch-version-number-for-MAS
run: ./scripts/patch_mas_version.sh
- name: nightly/test
uses: ./.github/actions/test
- name: nightly/package
run: npm run package:mas
- name: nightly/publish
run: fastlane publish_test path:"$(find . -name \*.pkg -print -quit)"
build-mac-installer:
runs-on: macos-12
needs:
- mac-app-store-preflight
steps:
- name: nightly/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: nightly/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: nightly/create-build-folder
run: mkdir -p ./build
- name: nightly/install-dependencies
run: |
brew install yq rename
npm ci
- name: nightly/test
uses: ./.github/actions/test
- name: nightly/patch-version
uses: ./.github/actions/patch-nightly-version
- name: nightly/build
env:
APPLEID: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_APPLE_ID }}
APPLEIDPASS: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_APPLE_ID_PASS }}
CSC_FOR_PULL_REQUEST: true
CSC_KEY_PASSWORD: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_KEY_PASSWORD }}
CSC_LINK: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_LINK }}
run: |
mkdir -p ./build/macos-release
npm run package:mac-with-universal
bash -x ./scripts/patch_updater_yml.sh
bash -x ./scripts/cp_artifacts.sh release ./build/macos-release
- name: nightly/rename-arm64-to-m1
run: rename 's/arm64/m1/' ./build/macos-release/$(jq -r .version package.json)/*
- name: nightly/upload-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: build
path: ./build
retention-days: 5 ## No need to keep them since they are uploaded on S3
upload-to-s3:
runs-on: ubuntu-22.04
outputs:
links: ${{ steps.generate-linklist.outputs.linklist }}
needs:
- build-mac-installer
- build-msi-installer
- build-linux
steps:
- name: nightly/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: nightly/patch-version
uses: ./.github/actions/patch-nightly-version
- name: nightly/setup-aws-credentials
uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 # v1.7.0
with:
aws-region: us-east-1
aws-access-key-id: ${{ secrets.MM_DESKTOP_RELEASE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.MM_DESKTOP_RELEASE_AWS_SECRET_ACCESS_KEY }}
- name: nightly/download-builds
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
- name: nightly/setup-files-for-aws
run: |
mkdir -p ./aws-s3-dist
cp -r --backup=numbered ./build/{macos-release,win-release,linux}/* ./aws-s3-dist
- name: nightly/upload-to-s3
run: aws s3 cp ./aws-s3-dist/ s3://releases.mattermost.com/desktop/ --acl public-read --cache-control "no-cache" --recursive
- name: nightly/generate-linklist
id: generate-linklist
run: |
mkdir -p ./links
echo "### Nightly builds:" > ./links/linklist.txt
echo "Links for $(date +"%b-%d-%Y")" >> ./links/linklist.txt
echo "##### :tux: Linux" > ./links/linklist.txt
for i in `ls ./build/linux/$(jq -r .version package.json)/` ; do echo "- [$i](https://s3.amazonaws.com/releases.mattermost.com/desktop/$(jq -r .version package.json)/$i)" ; done >> ./links/linklist.txt
echo "##### :apple_logo: macOS" >> ./links/linklist.txt
for i in `ls ./build/macos-release/$(jq -r .version package.json)/` ; do echo "- [$i](https://s3.amazonaws.com/releases.mattermost.com/desktop/$(jq -r .version package.json)/$i)" ; done >> ./links/linklist.txt
echo "##### :windows: Windows" >> ./links/linklist.txt
for i in `ls ./build/win-release/$(jq -r .version package.json)/` ; do echo "- [$i](https://s3.amazonaws.com/releases.mattermost.com/desktop/$(jq -r .version package.json)/$i)" ; done >> ./links/linklist.txt
cat ./links/linklist.txt
echo "linklist=$(<./links/linklist.txt)" >> "$GITHUB_OUTPUT"
share-links-to-channel:
runs-on: ubuntu-22.04
needs:
- upload-to-s3
steps:
- name: nightly/share-links-to-channel
run: |
jq --null-input \
--arg icon_url "https://upload.wikimedia.org/wikipedia/commons/1/17/Luna_symbol.png" \
--arg username "NightBuilder" \
--arg text "${{ needs.upload-to-s3.outputs.links }}" \
'{"username":$username,"icon_url": $icon_url, "text": $text }' > /tmp/webhook-data.json
curl -i -X POST -H "Content-Type: application/json" -d @/tmp/webhook-data.json ${{ secrets.MM_DESKTOP_NIGHTLY_WEBHOOK_URL }} || echo "NOFICATION FAILED! check logs as this will succeed intentionally"

122
.github/workflows/nightly-rainforest.yml vendored Normal file
View file

@ -0,0 +1,122 @@
name: nightly-rainforest
on:
schedule:
- cron: 0 4 * * 0-5
defaults:
run:
shell: bash
env:
TERM: xterm
MM_DESKTOP_BUILD_DISABLEGPU: true
MM_DESKTOP_BUILD_SKIPONBOARDINGSCREENS: true
jobs:
build-msi-installer:
runs-on: windows-2022
steps:
- name: nightly/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: nightly/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: nightly/optimize
shell: powershell
run: ./scripts/Makefile.ps1 optimize
- name: nightly/install-deps
shell: powershell
run: ./scripts/Makefile.ps1 install-deps
- name: nightly/test
uses: ./.github/actions/test
- name: nightly/patch-version
uses: ./.github/actions/patch-nightly-version
- name: nightly/build
shell: powershell
env:
MM_WIN_INSTALLERS: 1
PFX_KEY: ${{ secrets.MM_DESKTOP_MSI_INSTALLER_PFX_KEY }}
CSC_KEY_PASSWORD: ${{ secrets.MM_DESKTOP_MSI_INSTALLER_CSC_KEY_PASSWORD }}
PFX: ${{ secrets.MM_DESKTOP_MSI_INSTALLER_PFX }}
CSC_LINK: ${{ secrets.MM_DESKTOP_MSI_INSTALLER_CSC_LINK }}
run: ./scripts/Makefile.ps1 build
- name: nightly/package
run: |
mkdir -p ./build/win
bash -x ./scripts/patch_updater_yml.sh
bash -x ./scripts/cp_artifacts.sh release ./build/win
- name: nightly/upload-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: build
path: ./build
retention-days: 5 ## No need to keep them since they are uploaded on S3
build-mac-installer:
runs-on: macos-12
steps:
- name: nightly/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: nightly/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: nightly/install-dependencies
run: |
brew install yq rename
npm ci
- name: nightly/test
uses: ./.github/actions/test
- name: nightly/patch-version
uses: ./.github/actions/patch-nightly-version
- name: nightly/build
env:
APPLEID: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_APPLE_ID }}
APPLEIDPASS: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_APPLE_ID_PASS }}
CSC_FOR_PULL_REQUEST: true
CSC_KEY_PASSWORD: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_KEY_PASSWORD }}
CSC_LINK: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_LINK }}
run: |
mkdir -p ./build/macos
npm run package:mac-with-universal
bash -x ./scripts/patch_updater_yml.sh
bash -x ./scripts/cp_artifacts.sh release ./build/macos
- name: nightly/rename-arm64-to-m1
run: rename 's/arm64/m1/' ./build/macos-nightly/$(jq -r .version package.json)/*
- name: nightly/upload-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: build
path: ./build
retention-days: 5 ## No need to keep them since they are uploaded on S3
upload-to-s3-daily:
runs-on: ubuntu-22.04
needs:
- build-mac-installer
- build-msi-installer
steps:
- name: nightly/setup-aws-credentials
uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 # v1.7.0
with:
aws-region: us-east-1
aws-access-key-id: ${{ secrets.MM_DESKTOP_DAILY_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.MM_DESKTOP_DAILY_AWS_SECRET_ACCESS_KEY }}
- name: nightly/download-builds
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
- name: nightly/install-missing-deps
run: |
sudo apt-get update
sudo apt-get install rename jq -y
- name: nightly/setup-files-for-aws
run: |
rename 's/\d+\.\d+\.\d+\-nightly\.\d+\/mattermost(.+)\d+\.\d+\.\d+\-nightly\.\d+/mattermost$1daily-develop/' ./build/macos/$(jq -r .version package.json)/*
rename 's/\d+\.\d+\.\d+\-nightly\.\d+\/mattermost(.+)\d+\.\d+\.\d+\-nightly\.\d+/mattermost$1daily-develop/' ./build/win/$(jq -r .version package.json)/*
- name: nightly/upload-to-s3
run: aws s3 cp ./build/ s3://mattermost-desktop-daily-builds/ --acl public-read --cache-control "no-cache" --recursive

252
.github/workflows/release.yaml vendored Normal file
View file

@ -0,0 +1,252 @@
name: release
on:
push:
# only for release and release candidates
# release-XX.YY.ZZ
# release-XX.YY.ZZ-rc-something
branches:
- release-[0-9]+.[0-9]+
- release-[0-9]+.[0-9]+.[0-9]+
- release-[0-9]+.[0-9]+-rc-[0-9]+
- release-[0-9]+.[0-9]+.[0-9]+-rc-[0-9]+
defaults:
run:
shell: bash
env:
TERM: xterm
jobs:
begin-notification:
runs-on: ubuntu-22.04
steps:
- name: release/notify-channel
run: |
jq --null-input \
--arg icon_url "https://mattermost.com/wp-content/uploads/2022/02/icon.png" \
--arg username "MattermostRelease" \
--arg text "[$(jq -r .version package.json)] Release process for the desktop app has started, it should take about 30 minutes to complete." \
'{"username":$username,"icon_url": $icon_url, "text": $text }' > /tmp/webhook-data.json
curl -i -H "Content-Type: application/json" -X POST -d @/tmp/webhook-data.json ${{ secrets.MM_DESKTOP_RELEASE_WEBHOOK_URL }} || echo "NOFICATION FAILED! check logs as this will succeed intentionally"
build-linux:
runs-on: ubuntu-latest-4-cores
needs:
- begin-notification
steps:
- name: release/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: release/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: release/install-dependencies
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
wget -qO - https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/Release.key | sudo apt-key add -
wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.20.1/yq_linux_amd64 && chmod a+x /usr/local/bin/yq
sudo apt-get update || true && sudo apt-get install -y ca-certificates libxtst-dev libpng++-dev gcc-aarch64-linux-gnu g++-aarch64-linux-gnu jq icnsutils graphicsmagick tzdata
npm ci
- name: release/test
uses: ./.github/actions/test
- name: release/build
run: |
mkdir -p ./build/linux
npm run package:linux
bash -x ./scripts/patch_updater_yml.sh
bash -x ./scripts/cp_artifacts.sh release ./build/linux
- name: release/upload-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: build
path: ./build
retention-days: 14 ## No need to keep CI builds more than 14 days
build-msi-installer:
runs-on: windows-2022
needs:
- begin-notification
steps:
- name: release/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: release/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: release/optimize
shell: powershell
run: ./scripts/Makefile.ps1 optimize
- name: release/install-deps
shell: powershell
run: ./scripts/Makefile.ps1 install-deps
- name: release/test
uses: ./.github/actions/test
- name: release/build
shell: powershell
env:
MM_WIN_INSTALLERS: 1
PFX_KEY: ${{ secrets.MM_DESKTOP_MSI_INSTALLER_PFX_KEY }}
CSC_KEY_PASSWORD: ${{ secrets.MM_DESKTOP_MSI_INSTALLER_CSC_KEY_PASSWORD }}
PFX: ${{ secrets.MM_DESKTOP_MSI_INSTALLER_PFX }}
CSC_LINK: ${{ secrets.MM_DESKTOP_MSI_INSTALLER_CSC_LINK }}
run: |
./scripts/Makefile.ps1 build
- name: release/package
run: |
mkdir -p ./build/win-release
bash -x ./scripts/patch_updater_yml.sh
bash -x ./scripts/cp_artifacts.sh release ./build/win-release
- name: release/upload-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: build
path: ./build
retention-days: 14
build-mac-installer:
runs-on: macos-12
needs:
- mac-app-store-preflight
steps:
- name: release/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: release/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: release/create-build-folder
run: mkdir -p ./build
- name: release/install-dependencies
run: |
brew install yq rename
npm ci
- name: release/test
uses: ./.github/actions/test
- name: release/build
env:
APPLEID: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_APPLE_ID }}
APPLEIDPASS: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_APPLE_ID_PASS }}
CSC_FOR_PULL_REQUEST: true
CSC_KEY_PASSWORD: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_KEY_PASSWORD }}
CSC_LINK: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_LINK }}
run: |
mkdir -p ./build/macos-release
npm run package:mac-with-universal
bash -x ./scripts/patch_updater_yml.sh
bash -x ./scripts/cp_artifacts.sh release ./build/macos-release
- name: release/rename-arm64-to-m1
run: rename 's/arm64/m1/' ./build/macos-release/$(jq -r .version package.json)/*
- name: release/upload-build
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: build
path: ./build
retention-days: 14
mac-app-store-preflight:
runs-on: macos-12
env:
MAS_PROFILE: ${{ secrets.MM_DESKTOP_MAC_APP_STORE_MAS_PROFILE }}
MACOS_API_KEY_ID: ${{ secrets.MM_DESKTOP_MAC_APP_STORE_MACOS_API_KEY_ID }}
MACOS_API_KEY: ${{ secrets.MM_DESKTOP_MAC_APP_STORE_MACOS_API_KEY }}
MACOS_API_ISSUER_ID: ${{ secrets.MM_DESKTOP_MAC_APP_STORE_MACOS_API_ISSUER_ID }}
CSC_FOR_PULL_REQUEST: true
CSC_KEY_PASSWORD: ${{ secrets.MM_DESKTOP_MAC_APP_STORE_CSC_KEY_PASSWORD}}
CSC_LINK: ${{ secrets.MM_DESKTOP_MAC_APP_STORE_CSC_LINK }}
needs:
- begin-notification
steps:
- name: release/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: release/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: "package.json"
cache: "npm"
cache-dependency-path: package-lock.json
- name: release/install-dependencies
run: |
brew install yq
npm ci
- name: release/copy-provisioning-profile
run: echo $MAS_PROFILE | base64 -D > ./mas.provisionprofile
- name: release/patch-version-number-for-MAS
run: ./scripts/patch_mas_version.sh
- name: release/test
uses: ./.github/actions/test
- name: release/package
run: npm run package:mas
- name: release/publish
run: fastlane publish_test path:"$(find . -name \*.pkg -print -quit)"
upload-to-s3:
runs-on: ubuntu-22.04
needs:
- build-mac-installer
- build-msi-installer
- build-linux
steps:
- name: release/setup-aws-credentials
uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 # v1.7.0
with:
aws-region: us-east-1
aws-access-key-id: ${{ secrets.MM_DESKTOP_RELEASE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.MM_DESKTOP_RELEASE_AWS_SECRET_ACCESS_KEY }}
- name: release/download-builds
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
- name: release/setup-files-for-aws
run: |
mkdir -p ./aws-s3-dist
cp -r --backup=numbered ./build/{macos-release,win-release,linux}/* ./aws-s3-dist
- name: release/upload-to-s3
run: aws s3 cp ./aws-s3-dist/ s3://releases.mattermost.com/desktop/ --acl public-read --cache-control "no-cache" --recursive
github-release:
runs-on: ubuntu-22.04
needs:
- upload-to-s3
steps:
- name: release/download-builds
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
- name: release/setup-files-for-github-release
run: |
mkdir -p ./ghr-dist
find ./build/{macos-release,win-release,linux} -type f -exec cp --backup=numbered -t ./ghr-dist {} +
- name: release/publish-release
run: |
go install github.com/tcnksm/ghr@latest
VERSION=$(jq -r .version package.json)
RELEASE_TITLE="v${VERSION} ($(date -u "+%Y-%m-%d"))"
ghr \
-t ${GITHUB_TOKEN} \
-u ${GITHUB_ACTOR} \
-draft \
--body="$(./scripts/generate_release_markdown.sh $VERSION)" \
--name="${RELEASE_TITLE}" $( [[ $VERSION =~ "-rc" ]] && printf %s "-prerelease") \
-r ${GITHUB_REPOSITORY} \
-c ${GITHUB_SHA} \
-delete \
v${VERSION} ./ghr-dist
end-notification:
runs-on: ubuntu-22.04
needs:
- github-release
steps:
- name: release/notify-channel
run: |
jq --null-input \
--arg icon_url "https://mattermost.com/wp-content/uploads/2022/02/icon.png" \
--arg username "MattermostRelease" \
--arg text "[$(jq -r .version package.json)] Release process for the desktop app ended, the new release can be found on [GitHub](https://github.com/mattermost/desktop/releases)." \
'{"username":$username,"icon_url": $icon_url, "text": $text }' > /tmp/webhook-data.json
curl -i -H "Content-Type: application/json" -X POST -d @/tmp/webhook-data.json ${{ secrets.MM_DESKTOP_RELEASE_WEBHOOK_URL }} || echo "NOFICATION FAILED! check logs as this will succeed intentionally"

3681
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -50,7 +50,7 @@
"test:e2e:run": "electron-mocha -r @babel/register --reporter mochawesome dist/tests/e2e_bundle.js",
"test:e2e:send-report": "node ./e2e/save_report.js",
"test:unit": "cross-env NODE_ENV=jest jest",
"test:unit-ci": "cross-env NODE_ENV=jest jest --runInBand",
"test:unit-ci": "cross-env NODE_ENV=jest jest",
"test:coverage": "jest --coverage",
"package:all": "cross-env NODE_ENV=production npm-run-all package:windows package:windows-nsis package:mac package:mac-with-universal package:linux",
"package:windows": "npm-run-all build-prod && electron-builder --win zip --x64 --ia32 --arm64 --publish=never",
@ -81,7 +81,7 @@
"jest": {
"clearMocks": true,
"moduleDirectories": [
"",
"src",
"node_modules"
],
"moduleFileExtensions": [
@ -190,7 +190,7 @@
"eslint-plugin-react": "7.29.4",
"eslint-plugin-react-hooks": "4.4.0",
"fs-extra": "10.0.1",
"jest": "27.5.1",
"jest": "29.4.1",
"jest-junit": "13.1.0",
"joi": "17.6.0",
"mini-css-extract-plugin": "2.6.0",

View file

@ -15,17 +15,21 @@ import {initialize} from './initialize';
import {clearAppCache, getDeeplinkingURL, wasUpdated} from './utils';
jest.mock('fs', () => ({
unlinkSync: jest.fn(),
accessSync: jest.fn(),
existsSync: jest.fn().mockReturnValue(false),
mkdirSync: jest.fn(),
readFile: jest.fn(),
readFileSync: jest.fn().mockImplementation((text) => text),
unlinkSync: jest.fn(),
writeFile: jest.fn(),
writeFileSync: jest.fn(),
}));
jest.mock('path', () => {
const original = jest.requireActual('path');
return {
...original,
dirname: jest.fn().mockImplementation((p) => p),
resolve: jest.fn(),
};
});
@ -33,6 +37,7 @@ jest.mock('path', () => {
jest.mock('electron', () => ({
app: {
on: jest.fn(),
handle: jest.fn(),
exit: jest.fn(),
getPath: jest.fn(),
setPath: jest.fn(),
@ -118,6 +123,9 @@ jest.mock('main/app/utils', () => ({
wasUpdated: jest.fn(),
initCookieManager: jest.fn(),
}));
jest.mock('main/appState', () => ({
on: jest.fn(),
}));
jest.mock('main/AppVersionManager', () => ({}));
jest.mock('main/authManager', () => ({}));
jest.mock('main/AutoLauncher', () => ({
@ -155,7 +163,16 @@ jest.mock('main/windows/windowManager', () => ({
getServerNameByWebContentsId: jest.fn(),
getServerURLFromWebContentsId: jest.fn(),
}));
const originalProcess = process;
describe('main/app/initialize', () => {
beforeAll(() => {
global.process = {
...originalProcess,
on: jest.fn(),
chdir: jest.fn(),
cwd: jest.fn().mockImplementation((text) => text),
};
});
beforeEach(() => {
parseArgs.mockReturnValue({});
Config.once.mockImplementation((event, cb) => {
@ -175,6 +192,10 @@ describe('main/app/initialize', () => {
delete Config.data;
});
afterAll(() => {
global.process = originalProcess;
});
it('should initialize without errors', async () => {
await initialize();
});

View file

@ -116,6 +116,8 @@ describe('main/autoUpdater', () => {
afterEach(() => {
jest.runAllTimers();
jest.runOnlyPendingTimers();
jest.useRealTimers();
});
it('should add a new timeout', () => {
@ -153,6 +155,12 @@ describe('main/autoUpdater', () => {
jest.resetAllMocks();
});
afterAll(() => {
jest.runOnlyPendingTimers();
jest.clearAllTimers();
jest.useRealTimers();
});
it('should show dialog if update is not available', () => {
autoUpdater.once.mockImplementation((event, callback) => {
if (event === 'update-not-available') {

View file

@ -124,6 +124,12 @@ describe('main/views/MattermostView', () => {
mattermostView.retryInBackground = () => retryInBackgroundFn;
});
afterAll(() => {
jest.runOnlyPendingTimers();
jest.clearAllTimers();
jest.useRealTimers();
});
it('should do nothing when webcontents are destroyed', () => {
const webContents = mattermostView.view.webContents;
mattermostView.view.webContents = null;
@ -180,6 +186,12 @@ describe('main/views/MattermostView', () => {
mattermostView.findUnreadState = jest.fn();
});
afterAll(() => {
jest.runOnlyPendingTimers();
jest.clearAllTimers();
jest.useRealTimers();
});
it('should reset max retries', () => {
mattermostView.maxRetries = 1;
mattermostView.loadSuccess('http://server-1.com')();
@ -198,6 +210,12 @@ describe('main/views/MattermostView', () => {
mattermostView.focus = jest.fn();
});
afterAll(() => {
jest.runOnlyPendingTimers();
jest.clearAllTimers();
jest.useRealTimers();
});
it('should add browser view to window and set bounds when request is true and view not currently visible', () => {
mattermostView.isVisible = false;
mattermostView.show(true);

View file

@ -72,6 +72,7 @@ export default class CallsWidgetWindow extends EventEmitter {
this.win.once('ready-to-show', () => this.win.show());
this.win.once('show', this.onShow);
this.win.on('closed', this.onClosed);
ipcMain.on(CALLS_WIDGET_RESIZE, this.onResize);
ipcMain.on(CALLS_WIDGET_SHARE_SCREEN, this.onShareScreen);

View file

@ -234,6 +234,9 @@ describe('main/windows/windowManager', () => {
afterEach(() => {
jest.runAllTimers();
jest.resetAllMocks();
jest.runOnlyPendingTimers();
jest.clearAllTimers();
jest.useRealTimers();
});
it('should update loading screen and team dropdown bounds', () => {
@ -670,6 +673,12 @@ describe('main/windows/windowManager', () => {
Config.teams = [];
});
afterAll(() => {
jest.runOnlyPendingTimers();
jest.clearAllTimers();
jest.useRealTimers();
});
it('should do nothing if cannot find the server', () => {
windowManager.switchServer('server-3');
expect(getTabViewName).not.toBeCalled();