forked from dingodb/tantivy-search
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
129 lines (121 loc) · 4.08 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
stages:
- BuildPackage
- Test
- Profiling
RelWithDebInfo:
stage: BuildPackage
image: mochix/ubuntu22.04_base:0.1.0
cache:
key: ${CI_JOB_NAME}-cargo
paths:
- cargo_cache/registry/
policy: pull-push
before_script:
- mkdir -p cargo_cache/registry/
- du -h -d 0 cargo_cache/registry/
- rsync -a --ignore-existing cargo_cache/registry/ /root/.cargo/registry/
- mkdir -p build_packages
- mkdir -p packages
script:
- git submodule sync
- git submodule update --init --recursive
- >
cmake --no-warn-unused-cli
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE
-DCMAKE_C_COMPILER:FILEPATH=$(command -v clang-15)
-DCMAKE_CXX_COMPILER:FILEPATH=$(command -v clang++-15)
-S. -B./build_packages -G Ninja
- cmake --build ./build_packages --config RelWithDebInfo --target all
- cp ./build_packages/benchmark/tantivy_search_benchmark ./packages
- cp ./build_packages/libtantivy_search.a ./packages
- cp ./build_packages/tests/throughput/throughput_test ./packages
- cp ./build_packages/tests/unit_test/unit_tests ./packages
- tar -czf packages.tar.gz ./packages
- md5sum ./packages/*
- md5sum packages.tar.gz
- ls -lh packages.tar.gz ./packages/*
after_script:
- rsync -a --ignore-existing /root/.cargo/registry/ cargo_cache/registry/
- du -h -d 0 cargo_cache/registry/
artifacts:
name: "packages"
expire_in: 2 week
paths:
- packages.tar.gz
UnitTest:
stage: Test
needs:
- job: RelWithDebInfo
artifacts: true
image: mochix/ubuntu22.04_base:0.1.0
script:
- tar -zxf packages.tar.gz
- ./packages/unit_tests --gtest_output=xml:unit_test.xml
artifacts:
when: always
paths:
- unit_test.xml
reports:
junit: unit_test.xml
CodeCoverage:
stage: Test
cache:
key: ${CI_JOB_NAME}-cargo
paths:
- cargo_cache/registry/
policy: pull-push
before_script:
- mkdir -p cargo_cache/registry/
- du -h -d 0 cargo_cache/registry/
- rsync -a --ignore-existing cargo_cache/registry/ /root/.cargo/registry/
image: mochix/ubuntu22.04_base:0.1.0
script:
- export CARGO_INCREMENTAL=0
- export RUSTFLAGS="-C instrument-coverage"
- export LLVM_PROFILE_FILE="tantivy_search-%p-%m.profraw"
- cargo +nightly-2023-12-02 clean
- cargo +nightly-2023-12-02 test
- llvm-profdata-15 merge -sparse ./*.profraw -o tantivy_search.profdata
- |
BINARY_FILE=$(file target/debug/deps/tantivy_search* | grep 'executable' | cut -d: -f1 | head -n 1)
llvm-cov-15 export -format=lcov ${BINARY_FILE} -instr-profile=tantivy_search.profdata --ignore-filename-regex='contrib/' --ignore-filename-regex='rustc.*' --ignore-filename-regex='.cargo/' > tantivy_search.lcov
- lcov_cobertura tantivy_search.lcov -o cobertura.xml
- |
LINE_RATE=$(grep 'line-rate' cobertura.xml | sed -n 's/.*line-rate="\([^"]*\)".*/\1/p' | head -n 1)
COVERAGE=$(echo "$LINE_RATE * 100" | bc -l)
echo "CodeCoverage: $COVERAGE%"
after_script:
- rm -rf *.profraw *.profdata *.lcov target
- rsync -a --ignore-existing /root/.cargo/registry/ cargo_cache/registry/
- du -h -d 0 cargo_cache/registry/
coverage: '/CodeCoverage: (\d+\.\d+)%/'
artifacts:
paths:
- cobertura.xml
reports:
cobertura: cobertura.xml
GoogleBenchmark:
stage: Profiling
needs:
- job: UnitTest
artifacts: false
- job: RelWithDebInfo
artifacts: true
image: mochix/ubuntu22.04_base:0.1.0
script:
- if [ ! -f scripts/query_terms.json ] || [ ! -f scripts/wiki_560w.json ]; then bash scripts/download_datasets.sh; fi
- tar -zxvf packages.tar.gz
- ./packages/tantivy_search_benchmark --qtp=scripts/query_terms.json --dp=scripts/wiki_560w.json --ip=./temp --sbi=false | tee GoogleBenchmark.txt
- md5sum GoogleBenchmark.txt
cache:
key: ${CI_JOB_NAME}-datasets
paths:
- scripts/query_terms.json
- scripts/wiki_560w.json
policy: pull-push
artifacts:
name: "GoogleBenchmark"
expire_in: 2 week
paths:
- GoogleBenchmark.txt