summaryrefslogtreecommitdiff
path: root/.circleci/config.yml
blob: 804ab963d5365bd394aaa0b9ca69d6c1cc777f60 (plain)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
version: 2
defaults: &defaults
  docker:
    - image: debian:latest
jobs:
  sanity_check:
    docker:
      - image: circleci/android:api-29-ndk
    steps:
      - checkout
      - run:
          name: run sanity check script
          command: bash scripts/ci_sanity_checks.sh
      - run:
          name: Run CheckStyle Test
          command: ./gradlew checkstyleMain
      - store_artifacts:
          name: Store checkstyle report
          path: navit/android/checkstyle
          destination: reports
  build_linux:
    <<: *defaults
    steps:
      - checkout
      - run: |
          apt-get update && apt-get install -y git
          if scripts/check_need_build.sh; then circleci step halt; fi
      - run:
          name: Id
          command: cat /etc/*release
      - run:
          name: Setup requirements
          command: |
            bash scripts/setup_common_requirements.sh
            apt-get install -y libpng-dev libfreetype6-dev libdbus-glib-1-dev libgtk2.0-dev curl
      - run:
          name: Build for Linux
          command: bash scripts/build_linux.sh
      - store_artifacts:
          path: linux/_CPack_Packages
      - run:
          name: Update Navit-Download-Center
          command: |
            bash scripts/update_download_center.sh
  run_doxygen:
    <<: *defaults
    steps:
      - checkout
      - run: if scripts/check_need_build.sh; then circleci step halt; fi
      - run:
          name: Install doxygen and other essentials
          command: apt-get update && apt-get -y install doxygen ca-certificates git rsync
      - run:
          name: Run doxygen
          command: cd navit && doxygen
      - run:
          name: Update results to Github
          command: bash scripts/update_doxygen.sh
      - store_artifacts:
          path: /root/project/doc
  build_sailfish:
    machine: true
    steps:
      - checkout
      - run: if scripts/check_need_build.sh; then circleci step halt; fi
      - run:
          name: make build dir
          command:  mkdir ../rpmbuild && chmod 777 ../rpmbuild
      - run:
          name: run build
          command: ls -lah ../rpmbuild && docker run -e VERSION_ID=3.4.0.24 -v `pwd`/../rpmbuild:/home/nemo/rpmbuild:rw -v `pwd`:/home/nemo/navit coderus/sailfishos-platform-sdk:3.4.0.24 /bin/bash -x /home/nemo/navit/contrib/sailfish/build_sailfish_ci.sh
      - store_artifacts:
          name: Store rpm
          path: ../rpmbuild/RPMS/
          destination: rpmbuild
  build_android:
    working_directory: ~/code
    docker:
      - image: circleci/android:api-29-ndk
    environment:
      JVM_OPTS: -Xmx3200m
      GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
      KEYSTORE: '/home/circleci/.keystore'
    steps:
      - checkout
      - run: if scripts/check_need_build.sh; then circleci step halt; fi
      - run:
          name: Install requirements
          command: scripts/setup_android.sh
      - run:
          name: Setup Keystore and Playstore Keys
          command: scripts/setup_publish_keys.sh
      - run:
          name: Build and upload Android
          command: fastlane circleci
      - run:
          name: Run Lint Test
          command: |
            ln -s navit/navit.dtd navit.dtd
            mkdir /home/circleci/code/test-results
            ./gradlew lint test
      - run:
          name: Run Javadoc
          command: ./gradlew generateDebugJavadoc
      - store_artifacts:
          name: Store APK
          path: build/outputs/apk
          destination: apk
      - store_artifacts:
          name: Store logs
          path: build/outputs/logs
          destination: logs
      - store_artifacts:
          name: Store Javadoc
          path: build/outputs/docs/javadoc
          destination: doc
      - store_artifacts:
          name: Store Lint reports
          path: build/reports
          destination: reports
      - store_test_results:
          path: test-results
      - run:
          name: Update Navit-Download-Center
          command: |
            bash scripts/update_download_center.sh
  build_fdroid:
    docker:
      - image: registry.gitlab.com/fdroid/fdroidserver:buildserver-bullseye
    steps:
      - checkout
      - run:
          name: Build with F-Droid
          command: |
            # Mostly copied from fdroidserver’s own CI script (fdroid build), except for everything marked APP_CI
            apt-get update
            apt-get dist-upgrade
            apt-get clean

            test -n "$fdroidserver" || source /etc/profile.d/bsenv.sh

            # APP_CI: we need to install fdroidserver from source, directly into $fdroidserver, and set ownership accordingly
            test -d $fdroidserver || mkdir -p $fdroidserver
            git ls-remote https://gitlab.com/fdroid/fdroidserver.git master
            curl --silent https://gitlab.com/fdroid/fdroidserver/-/archive/master/fdroidserver-master.tar.gz | tar -xz --directory=$fdroidserver --strip-components=1
            chown -R vagrant $fdroidserver

            # TODO remove sdkmanager install once it is included in the buildserver image
            apt-get install sdkmanager
            rm -rf "$ANDROID_HOME/tools" # TODO remove once sdkmanager can upgrade installed packages
            sdkmanager "tools" "platform-tools" "build-tools;31.0.0"

            # APP_CI:
            # Skip fdroiddata download as we’re building from our own recipe.
            # Since we are not fetching source code but building from the project dir, we need to modify permissions:
            #   - Since we are in another user’s home dir, we grant permissions via group.
            #   - git needs read/execute on all parents of the source code dir.
            #   - fdroid creates subdirs, so the source code dir must be writable.
            # $home_vagrant/.android gets created and chowned just like on fdroidserver CI.
            chgrp -R vagrant $PWD
            chmod -R g+r $PWD
            chmod g+w $PWD
            chgrp vagrant ..
            chmod g+rx-w ..
            test -d $home_vagrant/.android || mkdir $home_vagrant/.android
            chown -R vagrant $home_vagrant/.android

            # APP_CI: for some reason fdroid complains about missing git but runs fine when the warning is suppressed
            export GRADLE_USER_HOME=$home_vagrant/.gradle
            export fdroid="sudo --preserve-env --user vagrant
              env PATH=$fdroidserver:$PATH
              env PYTHONPATH=$fdroidserver:$fdroidserver/examples
              env PYTHONUNBUFFERED=true
              env TERM=$TERM
              env HOME=$home_vagrant
              env GIT_PYTHON_REFRESH=quiet
              fdroid"

            chown -R vagrant $home_vagrant

            # APP_CI: just build our own app
            $fdroid build --verbose --on-server --no-tarball
      - store_artifacts:
           name: Store APK
           path: unsigned
           destination: apk
  build_win32:
    docker:
      - image: ubuntu:14.04
    steps:
      - checkout
      - run: |
          apt-get update && apt-get install -y git
          if scripts/check_need_build.sh; then circleci step halt; fi
      - run:
          name: Prepare the Windows build environment
          command: |
            apt-get update && xargs -a scripts/setup_14.04_requirements.list apt-get install -y
            apt-get install -y software-properties-common
            add-apt-repository -y ppa:george-edison55/cmake-3.x
            apt-get remove -y cmake
            apt-get install -y cmake3 mingw-w64 mingw-w64-tools default-jdk nsis libsaxonb-java curl
      - run:
          name: Build for Windows
          command: |
            bash scripts/build_win32.sh
      - store_artifacts:
          path: win32/navit.exe
      - run:
          name: Update Navit-Download-Center
          command: |
            bash scripts/update_download_center.sh
  build_wince:
    docker:
      - image: navit/dockerfiles:wince
    steps:
      - checkout
      - run: |
          apt-get update && apt-get install -y git-core
          if scripts/check_need_build.sh; then circleci step halt; fi
      - run:
          name: Prepare the WinCE build environment
          command: |
            bash scripts/setup_wince.sh
      - run:
          name: Build for Windows CE
          command: bash scripts/build_wince.sh
      - store_artifacts:
          path: wince/output
      #- run:
      #    name: Update Navit-Download-Center
      #    command: |
      #      bash scripts/update_download_center.sh
  build_tomtom_minimal:
    <<: *defaults
    docker:
      - image: navit/tomtom-ng
    steps:
      - checkout
      - run: if scripts/check_need_build.sh; then circleci step halt; fi
      - run:
          name: Prepare the tomtom build environment
          command: |
            bash scripts/setup_common_requirements.sh
            apt-get install -y xsltproc
      - run:
          name: Build for Tomtom (minimal)
          command: |
            bash scripts/build_tomtom_minimal.sh
      - store_artifacts:
          path: /output
      - run:
          name: Update Navit-Download-Center
          command: |
            bash scripts/update_download_center.sh
  build_tomtom_plugin:
    <<: *defaults
    docker:
      - image: navit/tomtom-ng
    steps:
      - checkout
      - run: if scripts/check_need_build.sh; then circleci step halt; fi
      - run:
          name: Prepare the tomtom build environment
          command: |
            bash scripts/setup_common_requirements.sh
            apt-get install -y xsltproc
      - run:
          name: Build for Tomtom (plugin)
          command: |
            bash scripts/build_tomtom_plugin.sh
      - store_artifacts:
          path: /output
      - run:
          name: Update Navit-Download-Center
          command: |
            bash scripts/update_download_center.sh
  merge_trunk_in_master:
    docker:
      - image: cimg/base:2020.01
    steps:
      - checkout
      - run:
          name: configure ssh git
          command: mkdir -p ~/.ssh/ && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
      - add_ssh_keys:
          fingerprints:
            - "58:42:73:90:cc:68:f7:34:7e:37:37:fa:b3:26:1f:a5"
      - run:
          name: Update results to Github
          command: export GIT_TERMINAL_PROMPT=0 && git push origin $CIRCLE_SHA1:refs/heads/master
  check_spelling:
    <<: *defaults
    steps:
      - checkout
      - run:
          name: Install curl
          command: apt-get update && apt-get -y install curl
      - run:
          name: Install misspell
          command: |
              curl -L -o ./install-misspell.sh https://git.io/misspell
              sh ./install-misspell.sh -b /usr/local/bin/
      - run:
          name: Check docs folder for misspells
          command: |
              misspell docs/ > typos.txt
              if [[ $( wc -l < typos.txt ) -gt 0 ]]; then
                echo "Typos/mispells found, please fix them";
                cat typos.txt
                exit -1
              fi


workflows:
  version: 2
  build_all:
    jobs:
      - sanity_check
      - build_linux:
          requires:
            - sanity_check
      - build_android:
          requires:
            - sanity_check
      - build_fdroid:
          requires:
            - sanity_check
      - build_sailfish:
          requires:
            - sanity_check
      - build_win32:
          requires:
            - sanity_check
      - build_wince:
          requires:
            - sanity_check
      - build_tomtom_minimal:
          requires:
            - sanity_check
      - build_tomtom_plugin:
          requires:
            - sanity_check
      - run_doxygen:
          requires:
            - build_linux
            - build_android
            - build_win32
            - build_wince
            - build_tomtom_minimal
            - build_tomtom_plugin
          filters:
            branches:
              only: /^trunk$/
      - merge_trunk_in_master:
          requires:
            - build_linux
            - build_android
            - build_win32
            - build_wince
            - build_tomtom_minimal
            - build_tomtom_plugin
          filters:
            branches:
              only: /^trunk$/
      - check_spelling:
          filters:
            branches:
              only: /^readthedocs$/