-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
44 lines (41 loc) · 1.63 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
image: alexcazacu1/hylo-base-image-cicd:1.0.5
stages:
- format
- test
format-job:
stage: format
script:
- >
output=$(swift-format lint -r --configuration .swift-format.json -p Sources Tests Package.swift);
if [ -n $output ]; then
echo "$output";
echo "Formatting issues detected.";
# exit 1
else
echo "No formatting issues found.";
fi
export-test-coverage-job:
stage: test
script:
- swift test -c debug -Xswiftc -enable-testing --explicit-target-dependency-import-check error --parallel --enable-code-coverage
- shopt -s nullglob
- dot_os=(./.build/x86_64-unknown-linux-gnu/debug/*.build/*.o ./.build/x86_64-unknown-linux-gnu/debug/*.build/**/*.o)
- bin_params=("${dot_os[0]}")
- for o in "${dot_os[@]:1}"; do bin_params+=("-object" "${o}"); done
- llvm-cov-15 --version
- llvm-cov-15 export -format="lcov" -instr-profile "$(swift test -c debug --show-codecov-path | xargs dirname)"/default.profdata "${bin_params[@]}" -ignore-filename-regex="Tests|.checkouts" > ./.build/info.lcov
- lcov_cobertura ./.build/info.lcov --output ./.build/coverage.xml
- pycobertura show --format csv ./.build/coverage.xml --delimiter ";"
- total=$(pycobertura show --format csv ./.build/coverage.xml --delimiter ";" | tail -1 | grep -oP "\d+\.\d+(?=%;)")
- echo "I LOVE TESTING $total"
- |
if awk "BEGIN {exit !($total < 80)}"; then
echo "Coverage is below 80%"
# exit 1
fi
coverage: '/I LOVE TESTING \d+(?:\.\d+)?/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: ./.build/coverage.xml