2018-01-28 13:48:29 +02:00
|
|
|
# Only build tags (Doesn't work - doesn't build anything)
|
2019-09-23 23:41:22 +02:00
|
|
|
if: tag IS present OR type = pull_request
|
2018-01-21 22:03:40 +02:00
|
|
|
|
2017-11-13 16:40:47 +02:00
|
|
|
rvm: 2.3.3
|
|
|
|
|
2018-03-16 16:32:47 +02:00
|
|
|
# It's important to only build production branches otherwise Electron Builder
|
|
|
|
# might take assets from dev branches and overwrite those of production.
|
|
|
|
# https://docs.travis-ci.com/user/customizing-the-build/#Building-Specific-Branches
|
2018-03-16 12:02:58 +02:00
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- master
|
2020-08-04 23:31:59 +02:00
|
|
|
- dev
|
2018-03-16 12:12:23 +02:00
|
|
|
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
|
2018-03-16 12:02:58 +02:00
|
|
|
|
2017-11-13 16:05:49 +02:00
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- os: osx
|
|
|
|
osx_image: xcode9.0
|
|
|
|
language: node_js
|
2020-05-17 19:07:44 +02:00
|
|
|
node_js: "10"
|
2017-11-13 16:05:49 +02:00
|
|
|
env:
|
|
|
|
- ELECTRON_CACHE=$HOME/.cache/electron
|
|
|
|
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
|
|
|
|
|
2017-11-14 00:44:41 +02:00
|
|
|
- os: linux
|
|
|
|
sudo: required
|
|
|
|
dist: trusty
|
|
|
|
language: node_js
|
2020-05-17 19:07:44 +02:00
|
|
|
node_js: "10"
|
2017-11-14 00:44:41 +02:00
|
|
|
env:
|
|
|
|
- ELECTRON_CACHE=$HOME/.cache/electron
|
|
|
|
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
|
|
|
|
|
2017-11-13 18:40:26 +02:00
|
|
|
# cache:
|
|
|
|
# directories:
|
|
|
|
# - node_modules
|
|
|
|
# - $HOME/.cache/electron
|
|
|
|
# - $HOME/.cache/electron-builder
|
2017-11-13 16:24:08 +02:00
|
|
|
|
|
|
|
before_install:
|
2017-11-13 17:43:46 +02:00
|
|
|
# HOMEBREW_NO_AUTO_UPDATE needed so that Homebrew doesn't upgrade to the next
|
|
|
|
# version, which requires Ruby 2.3, which is not available on the Travis VM.
|
2017-11-16 21:21:23 +02:00
|
|
|
|
|
|
|
# Silence apt-get update errors (for example when a module doesn't exist) since
|
|
|
|
# otherwise it will make the whole build fails, even though all we need is yarn.
|
2020-06-03 18:07:50 +02:00
|
|
|
|
|
|
|
# libsecret-1-dev is required for keytar - https://github.com/atom/node-keytar
|
2017-11-14 00:44:41 +02:00
|
|
|
- |
|
|
|
|
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
|
|
|
HOMEBREW_NO_AUTO_UPDATE=1 brew install yarn
|
|
|
|
else
|
|
|
|
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
|
|
|
|
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
2017-11-16 21:21:23 +02:00
|
|
|
sudo apt-get update || true
|
|
|
|
sudo apt-get install -y yarn
|
2019-12-13 03:16:34 +02:00
|
|
|
sudo apt-get install -y gettext
|
2020-06-03 18:07:50 +02:00
|
|
|
sudo apt-get install -y libsecret-1-dev
|
2017-11-14 00:44:41 +02:00
|
|
|
fi
|
2017-11-13 16:05:49 +02:00
|
|
|
|
|
|
|
script:
|
2017-11-13 16:08:32 +02:00
|
|
|
- |
|
2019-09-24 00:23:10 +02:00
|
|
|
# Install tools
|
2019-09-30 00:01:10 +02:00
|
|
|
npm install
|
2019-09-23 23:37:14 +02:00
|
|
|
|
2019-11-11 10:22:31 +02:00
|
|
|
# Run test units.
|
|
|
|
# Only do it for pull requests because Travis randomly fails to run them
|
|
|
|
# and that would break the desktop release.
|
|
|
|
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
2020-08-02 13:28:50 +02:00
|
|
|
npm run test-ci
|
2019-11-11 10:22:31 +02:00
|
|
|
testResult=$?
|
|
|
|
if [ $testResult -ne 0 ]; then
|
|
|
|
exit $testResult
|
|
|
|
fi
|
2019-09-23 23:37:14 +02:00
|
|
|
fi
|
2019-09-30 00:01:10 +02:00
|
|
|
|
|
|
|
# Run linter for pull requests only - this is so that
|
|
|
|
# bypassing eslint is allowed for urgent fixes.
|
|
|
|
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
|
|
|
npm run linter-ci ./
|
|
|
|
testResult=$?
|
|
|
|
if [ $testResult -ne 0 ]; then
|
|
|
|
exit $testResult
|
|
|
|
fi
|
|
|
|
fi
|
2019-09-23 23:37:14 +02:00
|
|
|
|
2019-12-13 03:16:34 +02:00
|
|
|
# Validate translations - this is needed as some users manually
|
|
|
|
# edit .po files (and often make mistakes) instead of using a proper
|
|
|
|
# tool like poedit. Doing it for Linux only is sufficient.
|
|
|
|
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
|
|
|
if [ "$TRAVIS_OS_NAME" != "osx" ]; then
|
2020-11-05 18:58:23 +02:00
|
|
|
node packages/tools/validate-translation.js
|
2019-12-13 03:16:34 +02:00
|
|
|
testResult=$?
|
|
|
|
if [ $testResult -ne 0 ]; then
|
|
|
|
exit $testResult
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-09-29 15:46:05 +02:00
|
|
|
# Find out if we should run the build or not. Electron-builder gets stuck when
|
2020-11-05 18:58:23 +02:00
|
|
|
# building PRs so we disable it in this case. The Linux build should provide
|
2019-09-29 15:46:05 +02:00
|
|
|
# enough info if the app builds or not.
|
|
|
|
# https://github.com/electron-userland/electron-builder/issues/4263
|
|
|
|
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
|
|
|
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-09-23 23:37:14 +02:00
|
|
|
# Prepare the Electron app and build it
|
2020-11-05 18:58:23 +02:00
|
|
|
cd packages/app-desktop
|
2020-05-24 16:27:30 +02:00
|
|
|
USE_HARD_LINKS=false npm run dist
|