forked from nfsergiu/ferdi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
100 lines (97 loc) · 3.8 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
matrix:
fast_finish: true
include:
- os: linux
dist: xenial
addons:
apt:
packages:
- libx11-dev
- libxext-dev
- libxss-dev
- libxkbfile-dev
- rpm
env:
- USE_HARD_LINKS=false
- ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
- os: osx
osx_image: xcode12.4
env:
- USE_HARD_LINKS=false
- ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
language: node_js
node_js: "14.16.1"
git:
submodules: false
branches:
only:
- develop
- release
- nightly
cache:
directories:
- node_modules
- $HOME/.cache/electron
- $HOME/.cache/electron-builder
before_install:
- git submodule update --init --recursive
- |
if [ $TRAVIS_BRANCH == "nightly" ]; then
git remote add source https://${GH_TOKEN}@github.com/getferdi/ferdi.git > /dev/null 2>&1
git fetch source
git merge --no-ff --commit -m "Merge remote-tracking branch 'source/develop' into HEAD [skip ci]" source/develop
CHANGES_COUNT=$(git diff --shortstat HEAD origin/$TRAVIS_BRANCH | wc -l)
echo "Travis event type: $TRAVIS_EVENT_TYPE"
echo "Number of changes: $CHANGES_COUNT"
if [ $CHANGES_COUNT -eq 0 -a $TRAVIS_EVENT_TYPE == "cron" ]; then
export SHOULD_CONTINUE_BUILD="false"
echo "Exporting SHOULD_CONTINUE_BUILD to false for future stages"
else
echo "Found changes, proceeding with submodule updates"
git submodule update --remote --force
git commit -am "Update submodules [skip ci]" --no-verify
echo "Completed merging from develop branch and upgrading submodules"
fi
fi
install:
- |
if [ "$SHOULD_CONTINUE_BUILD" == "false" ]; then
echo "Skipping install stage since SHOULD_CONTINUE_BUILD: $SHOULD_CONTINUE_BUILD"
else
travis_retry npm cache clean -f || travis_terminate 1
travis_retry npm uninstall node-gyp || travis_terminate 1
travis_retry npm i -g node-gyp@8.0.0 || travis_terminate 1
cd recipes && npm i && npm run package && cd .. || travis_terminate 1
travis_retry npx lerna bootstrap || travis_terminate 1
fi
before_script:
- |
if [ "$SHOULD_CONTINUE_BUILD" == "false" ]; then
echo "Skipping before_script stage since SHOULD_CONTINUE_BUILD: $SHOULD_CONTINUE_BUILD"
else
npm run lint && npm run test || travis_terminate 1
fi
script:
- |
if [ "$SHOULD_CONTINUE_BUILD" == "false" ]; then
echo "Terminating the build since there are no changes in a cron-triggered build"
travis_terminate 0
exit 0 # Note: Bug fix since 'travis_terminate' doesn't seem to exit immediately
else
echo "Building for branch: $TRAVIS_BRANCH"
if [ $TRAVIS_BRANCH == "release" ]; then
travis_retry travis_wait 100 npm run build -- --publish always -c.publish.provider=github -c.publish.owner=getferdi -c.publish.repo=ferdi || travis_terminate 1
elif [ $TRAVIS_BRANCH == "nightly" ]; then
git commit -am "Apply linter fixes [skip ci]" --no-verify
npm version prerelease --preid=nightly -m "%s and trigger AppVeyor nightly build [skip travisci]" || travis_terminate 1
if [ $TRAVIS_OS_NAME == "osx" ]; then
git remote add source https://${GH_TOKEN}@github.com/getferdi/ferdi.git > /dev/null 2>&1
git push -qu source HEAD:$TRAVIS_BRANCH --no-verify >/dev/null 2>&1
fi
travis_retry travis_wait 100 npm run build -- --publish always -c.publish.provider=github -c.publish.owner=getferdi -c.publish.repo=nightlies || travis_terminate 1
elif [ "$TRAVIS_PULL_REQUEST_BRANCH" != "i18n" ]; then
travis_retry travis_wait 100 npm run build || travis_terminate 1
fi
fi