aboutsummaryrefslogtreecommitdiffstats
path: root/.travis.yml
blob: a52edcff58d7389db1bd28d1e57c6f9bb2349332 (plain) (blame)
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
matrix:
  fast_finish: true
  include:
    - os: linux
      dist: xenial
      addons:
        apt:
          packages:
            - libx11-dev
            - libxext-dev
            - libxss-dev
            - libxkbfile-dev
            - rpm
      env:
        - ELECTRON_CACHE=$HOME/.cache/electron
        - ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
    - os: osx
      osx_image: xcode12.4
      env:
        - 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 --stat HEAD origin/nightly | 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
        echo "Terminating the build since there are no changes in a cron-triggered build"
        travis_terminate 0
      else
        echo "Found changes, proceeding with submodule updates"
        git submodule update --remote --force
        git commit -am "Update submodules [skip ci]" || true
      fi
      echo "Completed merging from develop branch and upgrading submodules"
    fi
install:
  - npm cache clean -f || travis_terminate 1
  - travis_retry npm uninstall node-gyp node-sass || travis_terminate 1
  - travis_retry npm i -g node-gyp@8.0.0 node-sass@5.0.0 || travis_terminate 1
  - cd recipes && npm i && npm run package && cd .. || travis_terminate 1
  - travis_retry npx lerna bootstrap || travis_terminate 1
before_script:
  - npm run lint && npm run test || travis_terminate 1
script:
  - |
    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 -c.mac.identity=null || travis_terminate 1
    elif [ $TRAVIS_BRANCH == "nightly" ]; then
      git commit -am "Apply linter fixes [skip ci]"
      npm version prerelease --preid=nightly -m "%s and trigger AppVeyor nightly build [skip ci]" || travis_terminate 1
      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
      if [ $TRAVIS_OS_NAME == "osx" ]; then
        git remote add nightly https://${GH_TOKEN}@github.com/getferdi/ferdi.git > /dev/null 2>&1
        git push -qu nightly HEAD:nightly >/dev/null 2>&1
      fi
    else
      if [ $TRAVIS_PULL_REQUEST_BRANCH != "i18n" ]; then
        travis_retry travis_wait 100 npm run build || travis_terminate 1
      fi
    fi