forked from AdaCore/gnatcoll-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
130 lines (113 loc) · 4.14 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
variables:
ANOD_DEFAULT_SANDBOX_DIR: /it/wave
HOST: x86_64-linux
stages:
- build
- test
build:
services:
- image:sandbox
- cpu:8
- mem:16
stage: build
script:
- anod vcs --add-repo gnatcoll-core $CI_PROJECT_DIR
- anod build --latest gnatcoll-core-doc
- anod build --latest gnatcoll-core
- echo "packaging $ANOD_DEFAULT_SANDBOX_DIR/$HOST/gnatcoll-core-current/install/" ;
- tar czf $CI_PROJECT_DIR/gnatcoll-core-current.tar.gz -C $ANOD_DEFAULT_SANDBOX_DIR/$HOST/gnatcoll-core-current/ install/ ;
- cd $CI_PROJECT_DIR
- ls -l *.tar.gz
artifacts:
paths:
- gnatcoll-core-current.tar.gz
test:
services:
- image:sandbox
- cpu:8
- mem:16
stage: test
allow_failure: true
script:
# unpack the packages
- cd $ANOD_DEFAULT_SANDBOX_DIR
- mkdir -p fingerprints
- mkdir -p $HOST/gnatcoll-core-current
- tar zxf $CI_PROJECT_DIR/gnatcoll-core-current.tar.gz -C $HOST/gnatcoll-core-current
- touch fingerprints/$HOST.gnatcoll-core-current.install.json.assume-unchanged
- touch fingerprints/$HOST.gnatcoll-core-current.download-bin.json.assume-unchanged
- rm -f $CI_PROJECT_DIR/*.tar.gz
- anod vcs --add-repo gnatcoll-core $CI_PROJECT_DIR
# -Qexternal is required to use the version built outside the compiler during
# the build stage.
- anod test --latest gnatcoll-core -Qexternal
- e3-testsuite-report
--failure-exit-code 1
--xunit-output $CI_PROJECT_DIR/test.xml
--xunit-name gnatcoll-core
$ANOD_DEFAULT_SANDBOX_DIR/$HOST/gnatcoll-core_external_test/results/new/ || FAILED=true
# We previously prevented the pipeline from halting if a test failed, to make
# sure all tests were run. If a test failed now we exit with a non-zero code
- if [ ! -z ${FAILED+x} ]; then echo "There was at least one testcase failure" && exit 1; fi
needs:
- job: build
artifacts:
when:
always
paths:
- test.xml
reports:
junit: test.xml
build_and_test_coverage:
services:
- image:sandbox
- cpu:8
- mem:16
stage: build
script:
- anybadge -l Coverage -v "Under Construction" -f coverage.svg -c steelblue
- anybadge -l "Tests Passing" -v "Error" -f test-count.svg -c red
- anod vcs --add-repo gnatcoll-core $CI_PROJECT_DIR
- anod build --latest gnatcoll-core -Qcoverage
- anod test --latest gnatcoll-core -Qcoverage
- e3-testsuite-report
--failure-exit-code 1
--xunit-output $CI_PROJECT_DIR/test-coverage.xml
--xunit-name gnatcoll-core
$ANOD_DEFAULT_SANDBOX_DIR/$HOST/gnatcoll-core_coverage_test/results/new/ || FAILED=true
# Create test count badge
- cd $CI_PROJECT_DIR
- rm test-count.svg # remove placeholder error badge
- create_xunit_badge --xunit_reports test-coverage.xml
# Move coverage reports and log coverage summaries
- mkdir $CI_PROJECT_DIR/coverage
- mv $ANOD_DEFAULT_SANDBOX_DIR/$HOST/gnatcoll-core_coverage_test/results/new/coverage-xml $CI_PROJECT_DIR/coverage/xml
- mv $ANOD_DEFAULT_SANDBOX_DIR/$HOST/gnatcoll-core_coverage_test/results/new/coverage-dhtml $CI_PROJECT_DIR/coverage/dhtml
- mv $ANOD_DEFAULT_SANDBOX_DIR/$HOST/gnatcoll-core_coverage_test/results/new/coverage-cobertura $CI_PROJECT_DIR/coverage/cobertura
- echo_coverage_stats --coverage-file $CI_PROJECT_DIR/coverage/xml/index.xml
# We previously prevented the pipeline from halting if a test failed, to make
# sure all tests were run. If a test failed now we exit with a non-zero code
- if [ ! -z ${FAILED+x} ]; then echo "There was at least one testcase failure" && exit 1; fi
coverage: '/^Stmt Coverage:\s+(\d+\.\d+\%) \(\d+ \/ \d+\)$/'
allow_failure: true
artifacts:
when:
always
paths:
- $PACKAGE
- test-coverage.xml
- coverage.svg
- test-count.svg
- coverage/xml
- coverage/dhtml
- coverage/cobertura
reports:
junit: test-coverage.xml
coverage_report:
coverage_format: cobertura
path: coverage/cobertura/cobertura.xml
interruptible: true