@@ -8,28 +8,117 @@ variables:
88 HOST : x86_64-linux
99
1010stages :
11+ - build
1112 - test
1213
13- build_and_test :
14+ build :
1415 services :
1516 - image:sandbox
1617 - cpu:8
1718 - mem:16
18- stage : test
19+ stage : build
1920 script :
2021 - anod vcs --add-repo gnatcoll-core $CI_PROJECT_DIR
2122 - anod build --latest gnatcoll-core-doc
2223 - anod build --latest gnatcoll-core
23- - anod test --latest gnatcoll-core -Qexternal
24- # TODO: replace build space by something computed
24+
25+ - echo "packaging $ANOD_DEFAULT_SANDBOX_DIR/$HOST/gnatcoll-core-current/install/" ;
26+ - tar czf $CI_PROJECT_DIR/gnatcoll-core-current.tar.gz -C $ANOD_DEFAULT_SANDBOX_DIR/$HOST/gnatcoll-core-current/ install/ ;
27+ - cd $CI_PROJECT_DIR
28+ - ls -l *.tar.gz
29+
30+ artifacts :
31+ paths :
32+ - gnatcoll-core-current.tar.gz
33+
34+ test :
35+ services :
36+ - image:sandbox
37+ - cpu:8
38+ - mem:16
39+ stage : test
40+ allow_failure : true
41+ script :
42+ # unpack the packages
43+ - cd $ANOD_DEFAULT_SANDBOX_DIR
44+ - mkdir -p $HOST/gnatcoll-core-current
45+ - tar zxf $CI_PROJECT_DIR/gnatcoll-core-current.tar.gz -C $HOST/gnatcoll-core-current
46+ - rm -f $CI_PROJECT_DIR/*.tar.gz
47+
48+ - anod vcs --add-repo gnatcoll-core $CI_PROJECT_DIR
49+
50+ - anod test --latest gnatcoll-core
2551 - e3-testsuite-report
2652 --failure-exit-code 1
2753 --xunit-output $CI_PROJECT_DIR/test.xml
2854 --xunit-name gnatcoll-core
2955 $ANOD_DEFAULT_SANDBOX_DIR/$HOST/gnatcoll-core-current-test/results/new/ || exit 1
30- interruptible : true
56+
57+ # We previously prevented the pipeline from halting if a test failed, to make
58+ # sure all tests were run. If a test failed now we exit with a non-zero code
59+ - if [ ! -z ${FAILED+x} ]; then echo "There was at least one testcase failure" && exit 1; fi
60+ needs :
61+ - job : build
3162 artifacts :
63+ when :
64+ always
3265 paths :
3366 - test.xml
3467 reports :
3568 junit : test.xml
69+
70+ build_and_test_coverage :
71+ services :
72+ - image:sandbox
73+ - cpu:8
74+ - mem:16
75+ stage : build
76+ script :
77+ - anybadge -l Coverage -v "Under Construction" -f coverage.svg -c steelblue
78+ - anybadge -l "Tests Passing" -v "Error" -f test-count.svg -c red
79+
80+ - anod vcs --add-repo gnatcoll-core $CI_PROJECT_DIR
81+ - anod build --latest gnatcoll-core -Qcoverage
82+ - anod test --latest gnatcoll-core -Qcoverage
83+ # TODO: replace build space by something computed
84+ - e3-testsuite-report
85+ --failure-exit-code 1
86+ --xunit-output $CI_PROJECT_DIR/test-coverage.xml
87+ --xunit-name gnatcoll-core
88+ $ANOD_DEFAULT_SANDBOX_DIR/$HOST/gnatcoll-core-current-test-cov/results/new/ || exit 1
89+
90+ # Create test count badge
91+ - cd $CI_PROJECT_DIR
92+ - rm test-count.svg # remove placeholder error badge
93+ - create_xunit_badge --xunit_reports test-coverage.xml
94+
95+ # Move coverage reports and log coverage summaries
96+ - mkdir $CI_PROJECT_DIR/coverage
97+ - mv /it/wave/x86_64-linux/gnatcoll-core-current-test-cov/results/new/coverage-xml $CI_PROJECT_DIR/coverage/xml
98+ - mv /it/wave/x86_64-linux/gnatcoll-core-current-test-cov/results/new/coverage-dhtml $CI_PROJECT_DIR/coverage/dhtml
99+ - mv /it/wave/x86_64-linux/gnatcoll-core-current-test-cov/results/new/coverage-cobertura $CI_PROJECT_DIR/coverage/cobertura
100+ - echo_coverage_stats --coverage-file $CI_PROJECT_DIR/coverage/xml/index.xml
101+
102+ # We previously prevented the pipeline from halting if a test failed, to make
103+ # sure all tests were run. If a test failed now we exit with a non-zero code
104+ - if [ ! -z ${FAILED+x} ]; then echo "There was at least one testcase failure" && exit 1; fi
105+ coverage : ' /^Stmt Coverage:\s+(\d+\.\d+\%) \(\d+ \/ \d+\)$/'
106+ allow_failure : true
107+ artifacts :
108+ when :
109+ always
110+ paths :
111+ - $PACKAGE
112+ - test-coverage.xml
113+ - coverage.svg
114+ - test-count.svg
115+ - coverage/xml
116+ - coverage/dhtml
117+ - coverage/cobertura
118+ reports :
119+ junit : test-coverage.xml
120+ coverage_report :
121+ coverage_format : cobertura
122+ path : coverage/cobertura/cobertura.xml
123+
124+ interruptible : true
0 commit comments