-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
115 lines (105 loc) · 3.11 KB
/
.gitlab-ci.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# https://gitlab.com/gableroux/gitlab_ci_flutter_example/blob/master/.gitlab-ci.yml
# Siehe auch: https://medium.com/@chima_37359/setup-gitlab-ci-in-flutter-android-project-89f6628828e8
# Caching Maven und Flutter Repositories
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .m2/repository
- /home/cirrus/.pub-cache
variables:
MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
stages:
- build_and_test
- deploy_coverage
- deploy_backend
# - vulnerability-check
# flutter test wird möglicherweise gerade erweitert, um --coverage und --machine gleichzeitig zuzulassen
# https://github.com/flutter/flutter/issues/30108
unit_tests_app:
image: cirrusci/flutter:latest
stage: build_and_test
rules:
- if: '$TIMED == null'
script:
# tojunit-Parser herunterladen und aktivieren
- cd sammel_app/build_dependencies
- flutter pub get
- flutter pub global activate junitreport
- export PATH="$PATH":"$HOME/.pub-cache/bin"
# erster run für test-ergebnisse
- cd ..
- flutter pub get
- flutter test --machine --no-sound-null-safety | tojunit --output TEST-app.xml
# zweiter run für coverage
- - flutter test --coverage --no-sound-null-safety
- lcov --list coverage/lcov.info
- lcov --remove 'coverage/lcov.info' -o coverage/lcov.info '**/BackendService.dart' '**/main.dart' # untestbares entfernen
- genhtml coverage/lcov.info --output=coverage
artifacts:
reports:
junit:
- sammel_app/TEST-app.xml
paths:
- sammel_app/coverage/
build_android_apk:
image: cirrusci/flutter:latest
stage: build_and_test
rules:
- if: '$TIMED == null'
script:
- cd sammel_app
- flutter build apk --debug --no-sound-null-safety
- mkdir ../downloads/
- mkdir ../downloads/sammel_app/
- cp build/app/outputs/apk/debug/app-debug.apk ../downloads/sammel_app/sammel-app-nightly.apk
artifacts:
paths:
- downloads/
test_server:
image: maven:latest
stage: build_and_test
rules:
- if: '$TIMED == null'
script:
- cd sammel_server
- mvn verify --fail-at-end --no-transfer-progress
artifacts:
reports:
junit:
- sammel_server/target/surefire-reports/TEST*.xml
paths:
- sammel_server/target/site/jacoco
#push_server:
# image: docker:latest
# stage: deploy_backend
# dependencies:
# - build_server
# script:
# - docker build sammel_server -t kybernetik/sammel-server:latest
# - docker push kybernetik/sammel-app:sammel-server
pages:
image: alpine
stage: deploy_coverage
rules:
- if: '$TIMED == null && $CI_COMMIT_BRANCH == "master"'
dependencies:
- unit_tests_app
- test_server
script:
- mkdir public
- mkdir public/coverage
- mv sammel_app/coverage/ public/coverage/app
- mv sammel_server/target/site/jacoco public/coverage/server
artifacts:
paths:
- public
#owasp:
# image: maven:latest
# stage: vulnerability-check
# script: mvn -Powasp-dependency-check org.owasp:dependency-check-maven:check
# rules:
# - if: '$TIMED == "owasp"'
# artifacts:
# when: always
# paths:
# - sammel_server/target/dependency-check-report.html