forked from mongodb/mongo-cxx-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.mci.yml
1365 lines (1239 loc) · 52 KB
/
.mci.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#######################################
# CXX Driver Config for MCI #
#######################################
#######################################
# Variables #
#######################################
variables:
mongodb_version:
version_latest: &version_latest latest
version_50: &version_50 5.0
version_44: &version_44 4.4
version_42: &version_42 4.2
version_40: &version_40 4.0
## cmake path variables
extra_path:
linux_extra_path: &linux_extra_path /opt/cmake/bin
macos_extra_path: &macos_extra_path /Applications/Cmake.app/Contents/bin
msvc2015_extra_path: &msvc2015_extra_path "/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/MSBuild/14.0/Bin"
msvc2017_extra_path: &msvc2017_extra_path "/cygdrive/c/cmake/bin:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin"
## tar options variables
tar_options:
linux_tar_options: &linux_tar_options --wildcards --no-anchored
## cmake flag variables
cmake_flags:
linux_cmake_flags: &linux_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wconversion -Wnarrowing -Wno-expansion-to-defined -pedantic -Werror -Wno-missing-field-initializers -Wno-aligned-new"
macos_cmake_flags: &macos_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers" -DCMAKE_CXX_FLAGS="-stdlib=libc++ -Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror"
asan_cmake_flags: &asan_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers" -DCMAKE_CXX_COMPILER="/usr/bin/clang++" -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=address -O1 -g -fno-omit-frame-pointer -Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror"
ubsan_cmake_flags: &ubsan_cmake_flags -DCMAKE_C_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-missing-field-initializers" -DCMAKE_CXX_COMPILER="/usr/bin/clang++" -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=undefined -fsanitize-blacklist=$(pwd)/etc/ubsan.blacklist -fno-sanitize-recover=undefined -O1 -g -fno-omit-frame-pointer -Wall -Wextra -Wconversion -Wnarrowing -pedantic -Werror"
msvc2015_cmake_flags: &msvc2015_cmake_flags -DBOOST_ROOT=c:/local/boost_1_60_0
msvc2015_generator: &msvc2015_generator Visual Studio 14 2015 Win64
# The VS option /Zc:__cplusplus is necessary to build with VS2017's
# native C++17 support. __cplusplus should indicate the standard of C++
# the compiler supports. VS2017 erroneously reports it as 199711L
# (instead of 201703L) without this option.
# The VS option /EHsc is necessary to opt into C++ standard exception unwinding.
# Without this option, some destructors may not be called in tests (CXX-2054).
msvc2017_cmake_flags: &msvc2017_cmake_flags -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_FLAGS="/Zc:__cplusplus /EHsc"
msvc2017_generator: &msvc2017_generator Visual Studio 15 2017 Win64
code_coverage_cmake_flags: &code_coverage_cmake_flags -DENABLE_CODE_COVERAGE=ON
example_projects_cc:
asan_cc_path: &asan_cc_path /usr/bin/clang
ubsan_cc_path: &ubsan_cc_path /usr/bin/clang
example_projects_cxx:
asan_cxx_path: &asan_cxx_path /usr/bin/clang++
ubsan_cxx_path: &ubsan_cxx_path /usr/bin/clang++
example_projects_cxxflags:
asan_cxxflags: &asan_cxxflags -D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=address -fno-omit-frame-pointer
ubsan_cxxflags: &ubsan_cxxflags -D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer
example_projects_ldflags:
asan_ldflags: &asan_ldflags -fsanitize=address
ubsan_ldflags: &ubsan_ldflags -fsanitize=undefined -fno-sanitize-recover=undefined
example_projects_cxx_standard:
std_experimental_cxx_standard: &std_experimental_cxx_standard 14
poly_flags:
poly_boost_flags: &poly_boost_flags -DBSONCXX_POLY_USE_BOOST=ON
poly_std_experimental_flags: &poly_std_experimental_flags -DBSONCXX_POLY_USE_STD_EXPERIMENTAL=ON -DCMAKE_CXX_STANDARD=14
poly_mnmlstc: &poly_mnmlstc -DBSONCXX_POLY_USE_MNMLSTC=ON
## test parameters
test_params:
asan_test_params: &asan_test_params PATH="/usr/lib/llvm-3.8/bin" ASAN_OPTIONS="detect_leaks=1"
ubsan_test_params: &ubsan_test_params PATH="/usr/lib/llvm-3.8/bin" UBSAN_OPTIONS="print_stacktrace=1"
valgrind_test_params: &valgrind_test_params valgrind --leak-check=full --track-origins=yes --num-callers=50 --error-exitcode=1 --error-limit=no --read-var-info=yes --suppressions=../etc/memcheck.suppressions
#######################################
# Functions #
#######################################
functions:
"setup":
- command: shell.exec
params:
shell: bash
script: |
set -o errexit
set -o pipefail
rm -rf "mongo-cxx-driver"
rm -fr "mongo-c-driver"
rm -fr mongod
rm -fr drivers-evergreen-tools
- command: git.get_project
params:
directory: "mongo-cxx-driver"
- command: shell.exec
params:
shell: bash
working_dir: "."
script: |
set -o errexit
set -o pipefail
cc --version || true
c++ --version || true
gcc --version || true
g++ --version || true
clang --version || true
cmake --version || true
openssl version || true
"build_mongohouse":
command: shell.exec
params:
shell: bash
script: |
if [ ! -d "drivers-evergreen-tools" ]; then
git clone [email protected]:mongodb-labs/drivers-evergreen-tools.git
fi
cd drivers-evergreen-tools
export DRIVERS_TOOLS=$(pwd)
sh .evergreen/atlas_data_lake/build-mongohouse-local.sh
"run_mongohouse":
command: shell.exec
params:
shell: bash
background: true
script: |
cd drivers-evergreen-tools
export DRIVERS_TOOLS=$(pwd)
sh .evergreen/atlas_data_lake/run-mongohouse-local.sh
"test_mongohouse":
command: shell.exec
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |
echo "testing that mongohouse is running..."
ps aux | grep mongohouse
cd build
export PREFIX=$(pwd)/../../mongoc
# Use LD_LIBRARY_PATH to inform the tests where to find dependencies on Linux.
# This task only runs on Linux.
if [ -n "${lib_dir}" ]; then
export LD_LIBRARY_PATH=.:$PREFIX/${lib_dir}/
else
export LD_LIBRARY_PATH=.:$PREFIX/lib/
fi
export MONGOHOUSE_TESTS_PATH="$(pwd)/../data/mongohouse"
ulimit -c unlimited || true
./src/mongocxx/test/test_mongohouse_specs
"start_mongod":
command: shell.exec
params:
shell: bash
working_dir: "."
script: |
set -o errexit
set -o pipefail
if [ ! -d "drivers-evergreen-tools" ]; then
git clone [email protected]:mongodb-labs/drivers-evergreen-tools.git
fi
cd drivers-evergreen-tools
export DRIVERS_TOOLS=$(pwd)
if [ "Windows_NT" == "$OS" ]; then
export DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS)
fi
export MONGODB_BINARIES=$DRIVERS_TOOLS/mongodb/bin
export MONGO_ORCHESTRATION_HOME=$DRIVERS_TOOLS/.evergreen/orchestration
export MONGODB_VERSION=${mongodb_version}
export AUTH=${AUTH}
export TOPOLOGY=${TOPOLOGY|server}
export REQUIRE_API_VERSION=${REQUIRE_API_VERSION}
export ORCHESTRATION_FILE=${ORCHESTRATION_FILE}
export PATH="$MONGODB_BINARIES:$PATH"
echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" > $MONGO_ORCHESTRATION_HOME/orchestration.config
./.evergreen/run-orchestration.sh
# Copy mongocryptd up so other functions can find it later, since we can't share PATHs
if [ -f $MONGODB_BINARIES/mongocryptd ]; then
cp $MONGODB_BINARIES/mongocryptd ../mongocryptd
fi
cd ../
pwd
"stop_mongod":
command: shell.exec
params:
shell: bash
working_dir: "."
script: |
set -o errexit
set -o pipefail
cd drivers-evergreen-tools/.evergreen/orchestration
if [ -f venv/bin/activate ]; then
. venv/bin/activate
elif [ -f venv/Scripts/activate ]; then
. venv/Scripts/activate
fi
mongo-orchestration stop
"install_c_driver":
command: shell.exec
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |
set -o errexit
set -o pipefail
export PREFIX=$(pwd)/../mongoc/
if [ "Windows_NT" == "$OS" ]; then
PREFIX=$(cygpath -m "$PREFIX")
fi
export CMAKE=${cmake}
export GENERATOR="${generator}"
if [ "1" == "${BSON_EXTRA_ALIGNMENT}" ]; then
echo "Building C driver with BSON extra alignment"
fi
BSON_EXTRA_ALIGNMENT=${BSON_EXTRA_ALIGNMENT} ./.evergreen/install_c_driver.sh ${mongoc_version|master}
"lint":
- command: shell.exec
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |
set -o errexit
set -o pipefail
python etc/clang_format.py lint
"clang-tidy":
- command: shell.exec
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |
set -o errexit
set -o pipefail
./etc/run-clang-tidy.sh
"compile":
- command: shell.exec
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |
set -o errexit
set -o pipefail
export BUILD_TYPE=${build_type}
export PATH="${extra_path}:$PATH"
export RUN_DISTCHECK=${RUN_DISTCHECK}
ADDL_OPTS=${code_coverage_cmake_flags}
if [ "${USE_STATIC_LIBS}" ]; then
ADDL_OPTS="$ADDL_OPTS -DBUILD_SHARED_LIBS=OFF"
fi
if [ "${ENABLE_TESTS}" = "OFF" ]; then
ADDL_OPTS="$ADDL_OPTS -DENABLE_TESTS=OFF"
fi
MONGOC_PREFIX="$(pwd)/../mongoc"
echo "MONGOC_PREFIX=$MONGOC_PREFIX"
ls -l $MONGOC_PREFIX
if [ "Windows_NT" == "$OS" ]; then
MONGOC_PREFIX=$(cygpath -m "$MONGOC_PREFIX")
fi
export CMAKE=${cmake}
if ! python -m virtualenv venv 2>/dev/null; then
/opt/mongodbtoolchain/v3/bin/python3 -m venv venv
fi
cd venv
if [ -f bin/activate ]; then
. bin/activate
./bin/pip install GitPython
elif [ -f Scripts/activate ]; then
. Scripts/activate
./Scripts/pip install GitPython
fi
cd ..
export GENERATOR="${generator}"
.evergreen/compile.sh -DCMAKE_PREFIX_PATH="$MONGOC_PREFIX" ${cmake_flags} ${poly_flags} $ADDL_OPTS -DCMAKE_INSTALL_PREFIX=install
"test":
- command: shell.exec
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |
set -o errexit
set -o pipefail
# Grabs the mongocryptd path
cd ../
export MONGOCRYPTD_PATH=$(pwd)/
if [ "Windows_NT" == "$OS" ]; then
export MONGOCRYPTD_PATH=$(cygpath -m $MONGOCRYPTD_PATH)
fi
cd mongo-cxx-driver
export PATH="${extra_path}:$PATH"
cd build
export PREFIX=$(pwd)/../../mongoc
# Use PATH / LD_LIBRARY_PATH / DYLD_LIBRARY_PATH to inform the tests where to find
# mongoc library dependencies on Windows / Linux / Mac OS, respectively.
# Additionally, on Windows, we also need to inform the tests where to find
# mongocxx library dependencies.
if [ -n "${lib_dir}" ]; then
export LD_LIBRARY_PATH=.:$PREFIX/${lib_dir}/
export DYLD_LIBRARY_PATH=.:$PREFIX/${lib_dir}/
else
export LD_LIBRARY_PATH=.:$PREFIX/lib/
export DYLD_LIBRARY_PATH=.:$PREFIX/lib/
fi
export PATH=$(pwd)/src/bsoncxx/${build_type}:$(pwd)/src/mongocxx/${build_type}:$PREFIX/bin:$(pwd)/install/bin:$PATH
export CRUD_LEGACY_TESTS_PATH="$(pwd)/../data/crud/legacy"
export CRUD_UNIFIED_TESTS_PATH="$(pwd)/../data/crud/unified"
export CHANGE_STREAM_TESTS_PATH="$(pwd)/../data/change_stream"
export ENCRYPTION_TESTS_PATH="$(pwd)/../data/client_side_encryption"
export GRIDFS_TESTS_PATH="$(pwd)/../data/gridfs"
export COMMAND_MONITORING_TESTS_PATH="$(pwd)/../data/command-monitoring"
export TRANSACTIONS_TESTS_PATH="$(pwd)/../data/transactions"
export WITH_TRANSACTION_TESTS_PATH="$(pwd)/../data/with_transaction"
export RETRYABLE_READS_TESTS_PATH="$(pwd)/../data/retryable-reads"
export READ_WRITE_CONCERN_OPERATION_TESTS_PATH="$(pwd)/../data/read-write-concern/operation"
export UNIFIED_FORMAT_TESTS_PATH=$(pwd)/../data/unified-format
export VERSIONED_API_TESTS_PATH=$(pwd)/../data/versioned-api
export MONGODB_API_VERSION="${MONGODB_API_VERSION}"
# export environment variables for encryption tests
set +o errexit
export MONGOCXX_TEST_AWS_SECRET_ACCESS_KEY="${cse_aws_secret_access_key}"
export MONGOCXX_TEST_AWS_ACCESS_KEY_ID="${cse_aws_access_key_id}"
set -o errexit
if [ "Windows_NT" == "$OS" ]; then
CTEST_OUTPUT_ON_FAILURE=1 MSBuild.exe /p:Configuration=${build_type} RUN_TESTS.vcxproj
# Only run examples if MONGODB_API_VERSION is unset. We do not append
# API version to example clients, so examples will fail when requireApiVersion
# is true.
if [[ -z "$MONGODB_API_VERSION" ]]; then
CTEST_OUTPUT_ON_FAILURE=1 MSBuild.exe /p:Configuration=${build_type} examples/run-examples.vcxproj
fi
else
# ENABLE_SLOW_TESTS is required to run the slow tests that are disabled by default. The slow tests should not be run if explicitly disabled.
if [ -z "${disable_slow_tests}" ]; then
export MONGOCXX_ENABLE_SLOW_TESTS=1
fi
ulimit -c unlimited || true
# Run tests and examples 1-by-1 with "test_params" so we can run them with valgrind.
${test_params} ./src/bsoncxx/test/test_bson
${test_params} ./src/mongocxx/test/test_driver
${test_params} ./src/mongocxx/test/test_change_stream_specs
${test_params} ./src/mongocxx/test/test_client_side_encryption_specs
${test_params} ./src/mongocxx/test/test_crud_specs
${test_params} ./src/mongocxx/test/test_gridfs_specs
${test_params} ./src/mongocxx/test/test_command_monitoring_specs
${test_params} ./src/mongocxx/test/test_instance
${test_params} ./src/mongocxx/test/test_transactions_specs
${test_params} ./src/mongocxx/test/test_logging
${test_params} ./src/mongocxx/test/test_retryable_reads_specs
${test_params} ./src/mongocxx/test/test_read_write_concern_specs
${test_params} ./src/mongocxx/test/test_unified_format_spec
# Some platforms like OS X don't support the /mode syntax to the -perm option
# of find(1), and some platforms like Ubuntu 16.04 don't support the +mode
# syntax, so we use Perl to help us find executable files.
EXAMPLES=$(find examples -type f | sort | perl -nlwe 'print if -x')
# Only run examples if MONGODB_API_VERSION is unset. We do not append
# API version to example clients, so examples will fail when requireApiVersion
# is true.
if [[ -z "$MONGODB_API_VERSION" ]]; then
for test in $EXAMPLES; do
case "$test" in
*encryption*)
echo "Skipping client side encryption example"
;;
*change_stream*)
echo "TODO CXX-1201, enable for servers that support change streams"
;;
*client_session*)
echo "TODO CXX-1201, enable for servers that support change streams"
;;
*with_transaction*)
echo "TODO CXX-1201, enable for servers that support transactions"
;;
*causal_consistency*)
echo "TODO CXX-1201, enable for servers that support transactions"
;;
*)
${test_params} $test
;;
esac
done
fi
fi
cd ..
export CMAKE_PREFIX_PATH=$PREFIX:$(pwd)/build/install
if [ -n "${lib_dir}" ]; then
export PKG_CONFIG_PATH=$PREFIX/${lib_dir}/pkgconfig:$(pwd)/build/install/${lib_dir}/pkgconfig
else
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$(pwd)/build/install/lib/pkgconfig
fi
export USE_STATIC_LIBS="${USE_STATIC_LIBS}"
export BUILD_TYPE="${build_type}"
export CXXFLAGS="${example_projects_cxxflags}"
export LDFLAGS="${example_projects_ldflags}"
export CC="${example_projects_cc}"
export CXX="${example_projects_cxx}"
export CXX_STANDARD="${example_projects_cxx_standard}"
export CMAKE=${cmake}
if [ "Windows_NT" == "$OS" ]; then
export MSVC=1
elif [ "$(uname -s | tr '[:upper:]' '[:lower:]')" == "darwin" ]; then
export DYLD_LIBRARY_PATH="$(pwd)/build/install/lib:$DYLD_LIBRARY_PATH"
else
if [ -n "${lib_dir}" ]; then # only needed on Linux
export LD_LIBRARY_PATH="$(pwd)/build/install/${lib_dir}:$LD_LIBRARY_PATH"
else
export LD_LIBRARY_PATH="$(pwd)/build/install/lib:$LD_LIBRARY_PATH"
fi
fi
# The example projects never run under valgrind, since we haven't added execution
# logic to handle ${test_params}.
#
# Only run example projects if MONGODB_API_VERSION is unset. We do not append
# API version to example clients, so example projects will fail when requireApiVersion
# is true.
if [[ -z "$MONGODB_API_VERSION" ]]; then
MONGOC_VERSION=${mongoc_version|master} .evergreen/build_example_projects.sh
fi
unset MONGODB_API_VERSION
"test auth":
- command: shell.exec
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |
set -o errexit
set -o pipefail
export PATH="${extra_path}:$PATH"
cd build
export PREFIX=$(pwd)/../../mongoc
# Use PATH / LD_LIBRARY_PATH / DYLD_LIBRARY_PATH to inform the tests where to find
# mongoc library dependencies on Windows / Linux / Mac OS, respectively.
# Additionally, on Windows, we also need to inform the tests where to find
# mongocxx library dependencies.
if [ -n "${lib_dir}" ]; then
export LD_LIBRARY_PATH=.:$PREFIX/${lib_dir}/
export DYLD_LIBRARY_PATH=.:$PREFIX/${lib_dir}/
else
export LD_LIBRARY_PATH=.:$PREFIX/lib/
export DYLD_LIBRARY_PATH=.:$PREFIX/lib/
fi
export PATH=$(pwd)/src/bsoncxx/${build_type}:$(pwd)/src/mongocxx/${build_type}:$PREFIX/bin:$(pwd)/install/bin:$PATH
URI="mongodb://bob:pwd123@localhost"
if [ "Windows_NT" == "$OS" ]; then
./examples/mongocxx/${build_type}/connect.exe "$URI"
else
./examples/mongocxx/connect "$URI"
fi
"backtrace":
- command: shell.exec
params:
working_dir: "mongo-cxx-driver"
script: |
./etc/debug-core-evergreen.sh
"upload working dir":
- command: archive.targz_pack
params:
target: "working-dir.tar.gz"
source_dir: "mongo-cxx-driver"
include:
- "./**"
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: working-dir.tar.gz
remote_file: mongo-cxx-driver/${build_variant}/${revision}/${version_id}/${build_id}/artifacts/${task_id}-${execution}-working-dir.tar.gz
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/x-gzip}
display_name: "working-dir.tar.gz"
"upload mongo orchestration artifacts":
- command: shell.exec
params:
working_dir: "."
script: |
find . -name \*.log | xargs tar czf mongodb-logs.tar.gz
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongodb-logs.tar.gz
remote_file: mongo-cxx-driver/${build_variant}/${revision}/${version_id}/${build_id}/logs/${task_id}-${execution}-mongodb-logs.tar.gz
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/x-gzip}
display_name: "mongodb-logs.tar.gz"
"upload code coverage":
- command: shell.exec
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |
# redacted code coverage token
export CODECOV_TOKEN="${codecov_token}"
set -o errexit
set -o pipefail
bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
#######################################
# Post Task #
#######################################
post:
- func: "stop_mongod"
- func: "backtrace"
# Workaround for CXX-2040
# - func: "upload working dir"
- func: "upload mongo orchestration artifacts"
- func: "upload code coverage"
#######################################
# Tasks #
#######################################
tasks:
- name: lint
commands:
- func: "setup"
- func: "lint"
- name: clang-tidy
commands:
- func: "setup"
- func: "install_c_driver"
- func: "compile"
- func: "clang-tidy"
- name: compile_and_test_with_shared_libs
commands:
- func: "setup"
- func: "start_mongod"
- func: "install_c_driver"
- func: "compile"
vars:
RUN_DISTCHECK: 1
- func: "test"
- name: compile_and_test_with_shared_libs_extra_alignment
commands:
- func: "setup"
- func: "start_mongod"
- func: "install_c_driver"
vars:
BSON_EXTRA_ALIGNMENT: 1
- func: "compile"
- func: "test"
- name: compile_with_shared_libs
commands:
- func: "setup"
- func: "start_mongod"
- func: "install_c_driver"
- func: "compile"
- name: compile_without_tests
commands:
- func: "setup"
- func: "install_c_driver"
- func: "compile"
vars:
ENABLE_TESTS: OFF
- name: compile_and_test_auth_with_shared_libs
commands:
- func: "setup"
- func: "start_mongod"
vars:
AUTH: auth
- func: "install_c_driver"
- func: "compile"
- func: "test auth"
- name: compile_and_test_with_static_libs
commands:
- func: "setup"
- func: "start_mongod"
- func: "install_c_driver"
- func: "compile"
vars:
USE_STATIC_LIBS: 1
RUN_DISTCHECK: 1
- func: "test"
vars:
USE_STATIC_LIBS: 1
- name: compile_and_test_with_static_libs_extra_alignment
commands:
- func: "setup"
- func: "start_mongod"
- func: "install_c_driver"
vars:
BSON_EXTRA_ALIGNMENT: 1
- func: "compile"
vars:
USE_STATIC_LIBS: 1
- func: "test"
vars:
USE_STATIC_LIBS: 1
- name: compile_and_test_with_shared_libs_replica_set
commands:
- func: "setup"
- func: "start_mongod"
vars:
TOPOLOGY: "replica_set"
- func: "install_c_driver"
- func: "compile"
vars:
RUN_DISTCHECK: 1
- func: "test"
- name: uninstall_check
commands:
- func: "setup"
- func: "install_c_driver"
- func: "compile"
- command: expansions.update
params:
updates:
- key: mongocxx_version_finder_sh
value: $(sed -nE 's/^#define MONGOCXX_VERSION_STRING "([^"]+)".*/\1/p' build/src/mongocxx/config/version.hpp)
- command: shell.exec
type: test
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |-
set -o errexit
export INSTALL_VERSION=${mongocxx_version_finder_sh}
sh ./.evergreen/uninstall_check.sh
- name: uninstall_check_windows
commands:
- func: "setup"
- func: "install_c_driver"
- func: "compile"
- command: expansions.update
params:
updates:
- key: mongocxx_version_finder_sh
value: $(sed -nE 's/^#define MONGOCXX_VERSION_STRING "([^"]+)".*/\1/p' build/src/mongocxx/config/version.hpp)
- command: shell.exec
type: test
params:
shell: bash
working_dir: "mongo-cxx-driver"
script: |-
set -o errexit
export INSTALL_VERSION=${mongocxx_version_finder_sh}
cmd.exe /c .\\.evergreen\\uninstall_check_windows.cmd
- name: build_example_with_add_subdirectory
commands:
- func: "setup"
- func: "start_mongod"
- command: shell.exec
type: test
params:
working_dir: "mongo-cxx-driver"
shell: bash
script: |-
set -o errexit
. .evergreen/find_cmake.sh
cd examples/add_subdirectory
[ -d mongo-c-driver ] || git clone --depth 1 https://github.com/mongodb/mongo-c-driver
rsync -aq --exclude='examples/add_subdirectory' $(readlink -f ../..) .
[ -d build ] || mkdir build
cd build
$CMAKE -DCMAKE_VERBOSE_MAKEFILE=ON ..
$CMAKE --build . -- -j 8
./hello_mongocxx
- name: debian-package-build
commands:
- func: "setup"
- command: shell.exec
type: test
params:
working_dir: "mongo-cxx-driver"
shell: bash
script: |-
set -o errexit
export IS_PATCH="${is_patch}"
sh .evergreen/debian_package_build.sh
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: deb.tar.gz
remote_file: mongo-cxx-driver/${branch_name}/${revision}/${version_id}/${build_id}/${execution}/debian-packages.tar.gz
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/x-gzip}
display_name: "deb.tar.gz"
- name: debian-package-build-mnmlstc
commands:
- func: "setup"
- command: shell.exec
type: test
params:
working_dir: "mongo-cxx-driver"
shell: bash
script: |-
set -o errexit
export IS_PATCH="${is_patch}"
export DEB_BUILD_PROFILES="pkg.mongo-cxx-driver.mnmlstc"
sh .evergreen/debian_package_build.sh
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: deb.tar.gz
remote_file: mongo-cxx-driver/${branch_name}/${revision}/${version_id}/${build_id}/${execution}/debian-packages-mnmlstc.tar.gz
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/x-gzip}
display_name: "deb.tar.gz"
- name: rpm-package-build
commands:
- func: "setup"
- command: shell.exec
type: test
params:
working_dir: "mongo-cxx-driver"
shell: bash
script: |-
set -o errexit
sh .evergreen/build_snapshot_rpm.sh
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: mongo-cxx-driver/${branch_name}/${revision}/${version_id}/${build_id}/${execution}/rpm-packages.tar.gz
bucket: mciuploads
permissions: public-read
local_file: rpm.tar.gz
content_type: ${content_type|application/x-gzip}
- name: test_mongohouse
commands:
- func: "setup"
- func: "install_c_driver"
- func: "compile"
- func: "build_mongohouse"
- func: "run_mongohouse"
- func: "test_mongohouse"
- name: test_versioned_api
commands:
- func: "setup"
- func: "start_mongod"
vars:
REQUIRE_API_VERSION: true
# Authentication with versioned API should already be tested
# in the C driver.
AUTH: noauth
- func: "install_c_driver"
- func: "compile"
- func: "test"
vars:
MONGODB_API_VERSION: 1
- name: test_versioned_api_accept_version_two
commands:
- func: "setup"
- func: "start_mongod"
vars:
ORCHESTRATION_FILE: versioned-api-testing.json
AUTH: noauth
- func: "install_c_driver"
- func: "compile"
- func: "test"
#######################################
# MongoDB Version Matrix #
#######################################
axes:
- id: os
display_name: "OS"
values:
- id: "ubuntu-1804"
display_name: "Ubuntu 18.04 Debug"
variables:
extra_path: *linux_extra_path
cmake_flags: *linux_cmake_flags
build_type: "Debug"
tar_options: *linux_tar_options
code_coverage_cmake_flags: *code_coverage_cmake_flags
run_on:
- ubuntu1804-build
- id: "windows-2k8"
display_name: "Windows (VS 2017) Debug"
variables:
extra_path: *msvc2017_extra_path
cmake_flags: *msvc2017_cmake_flags
build_type: "Debug"
tar_options: *linux_tar_options # Same for Windows and Linux
generator: *msvc2017_generator
example_projects_cxx_standard: 17
run_on:
- windows-64-vs2017-compile
- id: mongodb_version
display_name: "MongoDB Version"
values:
- id: "latest"
display_name: "Latest"
variables:
mongodb_version: *version_latest
- id: "5.0"
display_name: "5.0"
variables:
mongodb_version: *version_50
- id: "4.4"
display_name: "4.4"
variables:
mongodb_version: *version_44
- id: "4.2"
display_name: "4.2"
variables:
mongodb_version: *version_42
- id: "4.0"
display_name: "4.0"
variables:
mongodb_version: *version_40
#######################################
# Buildvariants #
#######################################
buildvariants:
#######################################
# Standard MongoDB Integration Tests #
#######################################
- matrix_name: "integration"
matrix_spec: {os: "*", mongodb_version: "*"}
display_name: "${os} (MongoDB ${mongodb_version})"
tasks:
- name: compile_and_test_with_shared_libs
- name: compile_and_test_with_shared_libs_extra_alignment
- matrix_name: "integration (replica set)"
matrix_spec: {os: "ubuntu-1804", mongodb_version: "*"}
display_name: "${os} replica set (MongoDB ${mongodb_version})"
tasks:
- name: compile_and_test_with_shared_libs_replica_set
- matrix_name: "auth"
matrix_spec: {os: "*", mongodb_version: "latest"}
display_name: "${os} ${mongodb_version} Auth"
tasks:
- name: compile_and_test_auth_with_shared_libs
- matrix_name: "versioned api"
matrix_spec: {os: "*", mongodb_version: "latest"}
display_name: "${os} ${mongodb_version} Versioned API"
tasks:
- name: test_versioned_api
- name: test_versioned_api_accept_version_two
#######################################
# Linux Buildvariants #
#######################################
- name: ubuntu1804-release-latest
display_name: "Ubuntu 18.04 Release (MongoDB Latest)"
expansions:
build_type: "Release"
tar_options: *linux_tar_options
extra_path: *linux_extra_path
cmake_flags: *linux_cmake_flags
mongodb_version: *version_latest
run_on:
- ubuntu1804-build
tasks:
- name: lint
- name: compile_and_test_with_shared_libs
- name: compile_and_test_with_shared_libs_extra_alignment
- name: compile_and_test_with_static_libs
- name: compile_and_test_with_static_libs_extra_alignment
- name: compile_and_test_with_shared_libs_replica_set
- name: build_example_with_add_subdirectory
distros:
- ubuntu1804-build
- name: uninstall_check
- name: ubuntu1804-release-50
display_name: "Ubuntu 18.04 Release (MongoDB 5.0)"
expansions:
build_type: "Release"
tar_options: *linux_tar_options
extra_path: *linux_extra_path
cmake_flags: *linux_cmake_flags
mongodb_version: *version_50
run_on:
- ubuntu1804-build
tasks:
- name: compile_and_test_with_shared_libs
- name: compile_and_test_with_shared_libs_extra_alignment
- name: compile_and_test_with_static_libs
- name: compile_and_test_with_static_libs_extra_alignment
- name: compile_and_test_with_shared_libs_replica_set
- name: build_example_with_add_subdirectory
distros:
- ubuntu1804-build
- name: uninstall_check
# TODO CXX-2260 Upgrade std::experimental tasks to use Ubuntu 18.04 and mongodb_latest
# after bug fixes with newer g++ versions.
- name: ubuntu1604-debug-std-experimental
display_name: "Ubuntu 16.04 Debug (std::experimental) (MongoDB 4.4)"
expansions:
build_type: "Debug"
tar_options: *linux_tar_options
extra_path: *linux_extra_path
cmake_flags: *linux_cmake_flags
poly_flags: *poly_std_experimental_flags
mongodb_version: *version_44
example_projects_cxx_standard: *std_experimental_cxx_standard
run_on:
- ubuntu1604-build
tasks:
- name: compile_and_test_with_shared_libs
- name: compile_and_test_with_shared_libs_extra_alignment
- name: compile_and_test_with_static_libs
- name: compile_and_test_with_static_libs_extra_alignment
- name: ubuntu1804-debug-valgrind-latest
display_name: "Valgrind Ubuntu 18.04 Debug (MongoDB Latest)"
expansions:
build_type: "Debug"
tar_options: *linux_tar_options
extra_path: *linux_extra_path
cmake_flags: *linux_cmake_flags
test_params: *valgrind_test_params
mongodb_version: *version_latest
disable_slow_tests: 1
run_on:
- ubuntu1804-build
tasks:
- name: compile_and_test_with_shared_libs
- name: compile_and_test_with_shared_libs_extra_alignment
- name: compile_and_test_with_static_libs
- name: compile_and_test_with_static_libs_extra_alignment
- name: ubuntu1804-debug-valgrind-50