Skip to content

CDRIVER-4621 Replace codecov-bash with new Codecov Uploader #1257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .evergreen/.codecov.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ignore:
- "src/libmongoc/tests/mock_server"
- "src/zlib-1.2.13"
- "src/kms-message"
- "src/zlib-*"
- "src/*/tests"
2 changes: 1 addition & 1 deletion .evergreen/config_generator/etc/cse/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def compile_commands(cls, sasl=None) -> list[EvgCommand]:
expansions_update(updates=updates),
bash_exec(
command_type=EvgCommandType.TEST,
script='EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON -DENABLE_CLIENT_SIDE_ENCRYPTION=ON ${EXTRA_CONFIGURE_FLAGS}" .evergreen/scripts/compile.sh',
script='EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON ${EXTRA_CONFIGURE_FLAGS}" .evergreen/scripts/compile.sh',
working_dir='mongoc',
add_expansions_to_env=True,
env={
Expand Down
6 changes: 3 additions & 3 deletions .evergreen/generated_configs/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ functions:
COMPILE_LIBMONGOCRYPT: "ON"
args:
- -c
- EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON -DENABLE_CLIENT_SIDE_ENCRYPTION=ON ${EXTRA_CONFIGURE_FLAGS}" .evergreen/scripts/compile.sh
- EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON ${EXTRA_CONFIGURE_FLAGS}" .evergreen/scripts/compile.sh
cse-sasl-cyrus-openssl-compile:
- command: expansions.update
params:
Expand All @@ -104,7 +104,7 @@ functions:
COMPILE_LIBMONGOCRYPT: "ON"
args:
- -c
- EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON -DENABLE_CLIENT_SIDE_ENCRYPTION=ON ${EXTRA_CONFIGURE_FLAGS}" .evergreen/scripts/compile.sh
- EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON ${EXTRA_CONFIGURE_FLAGS}" .evergreen/scripts/compile.sh
cse-sasl-cyrus-winssl-compile:
- command: expansions.update
params:
Expand All @@ -121,7 +121,7 @@ functions:
COMPILE_LIBMONGOCRYPT: "ON"
args:
- -c
- EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON -DENABLE_CLIENT_SIDE_ENCRYPTION=ON ${EXTRA_CONFIGURE_FLAGS}" .evergreen/scripts/compile.sh
- EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON ${EXTRA_CONFIGURE_FLAGS}" .evergreen/scripts/compile.sh
early-termination:
- command: subprocess.exec
params:
Expand Down
49 changes: 41 additions & 8 deletions .evergreen/generated_configs/legacy-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,16 @@ functions:
shell: bash
script: |-
set -o errexit
export CODECOV_TOKEN=${codecov_token}
curl -s https://codecov.io/bash | bash
# Note: coverage is currently only enabled on the ubuntu1804 distro.
# This script does not support MacOS, Windows, or non-x86_64 distros.
# Update accordingly if code coverage is expanded to other distros.
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
# -Z: Exit with a non-zero value if error.
# -g: Run with gcov support.
# -t: Codecov upload token.
# perl: filter verbose "Found" list and "Processing" messages.
./codecov -Zgt "${codecov_token}" | perl -lne 'print if not m|^.*\.gcov(\.\.\.)?$|'
compile coverage:
- command: shell.exec
type: test
Expand Down Expand Up @@ -1044,7 +1052,7 @@ tasks:
shell: bash
script: |-
set -o errexit
env COMPILE_LIBMONGOCRYPT="ON" DEBUG="ON" EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON -DENABLE_CLIENT_SIDE_ENCRYPTION=ON" SASL="AUTO" SSL="OPENSSL" bash .evergreen/scripts/compile.sh
env COMPILE_LIBMONGOCRYPT="ON" DEBUG="ON" EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON" SASL="AUTO" SSL="OPENSSL" bash .evergreen/scripts/compile.sh
- func: upload-build
- name: debug-compile-sasl-openssl-static-cse
tags:
Expand All @@ -1062,7 +1070,7 @@ tasks:
shell: bash
script: |-
set -o errexit
env COMPILE_LIBMONGOCRYPT="ON" DEBUG="ON" EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON -DENABLE_CLIENT_SIDE_ENCRYPTION=ON" SASL="AUTO" SSL="OPENSSL_STATIC" bash .evergreen/scripts/compile.sh
env COMPILE_LIBMONGOCRYPT="ON" DEBUG="ON" EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON" SASL="AUTO" SSL="OPENSSL_STATIC" bash .evergreen/scripts/compile.sh
- func: upload-build
- name: debug-compile-sasl-darwinssl-cse
tags:
Expand All @@ -1080,7 +1088,7 @@ tasks:
shell: bash
script: |-
set -o errexit
env COMPILE_LIBMONGOCRYPT="ON" DEBUG="ON" EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON -DENABLE_CLIENT_SIDE_ENCRYPTION=ON" SASL="AUTO" SSL="DARWIN" bash .evergreen/scripts/compile.sh
env COMPILE_LIBMONGOCRYPT="ON" DEBUG="ON" EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON" SASL="AUTO" SSL="DARWIN" bash .evergreen/scripts/compile.sh
- func: upload-build
- name: debug-compile-sasl-winssl-cse
tags:
Expand All @@ -1098,7 +1106,7 @@ tasks:
shell: bash
script: |-
set -o errexit
env COMPILE_LIBMONGOCRYPT="ON" DEBUG="ON" EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON -DENABLE_CLIENT_SIDE_ENCRYPTION=ON" SASL="AUTO" SSL="WINDOWS" bash .evergreen/scripts/compile.sh
env COMPILE_LIBMONGOCRYPT="ON" DEBUG="ON" EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON" SASL="AUTO" SSL="WINDOWS" bash .evergreen/scripts/compile.sh
- func: upload-build
- name: debug-compile-asan-openssl-cse
tags:
Expand All @@ -1114,7 +1122,7 @@ tasks:
shell: bash
script: |-
set -o errexit
env CFLAGS="-fno-omit-frame-pointer" CHECK_LOG="ON" COMPILE_LIBMONGOCRYPT="ON" DEBUG="ON" EXTRA_CONFIGURE_FLAGS="-DENABLE_CLIENT_SIDE_ENCRYPTION=ON -DENABLE_EXTRA_ALIGNMENT=OFF" PATH="/usr/lib/llvm-3.8/bin:$PATH" SANITIZE="address" SSL="OPENSSL" bash .evergreen/scripts/compile.sh
env CFLAGS="-fno-omit-frame-pointer" CHECK_LOG="ON" COMPILE_LIBMONGOCRYPT="ON" DEBUG="ON" EXTRA_CONFIGURE_FLAGS="-DENABLE_EXTRA_ALIGNMENT=OFF" PATH="/usr/lib/llvm-3.8/bin:$PATH" SANITIZE="address" SSL="OPENSSL" bash .evergreen/scripts/compile.sh
- func: upload-build
- name: debug-compile-nosasl-openssl-1.0.1
commands:
Expand Down Expand Up @@ -1148,6 +1156,30 @@ tasks:
script: |-
set -o errexit
bash ./.evergreen/scripts/build-and-test-with-toolchain.sh
- name: test-coverage-latest-replica-set-auth-sasl-openssl
tags:
- latest
- test-coverage
commands:
- func: compile coverage
vars:
SASL: AUTO
SSL: OPENSSL
- func: fetch-det
- func: bootstrap-mongo-orchestration
vars:
AUTH: auth
MONGODB_VERSION: latest
SSL: openssl
TOPOLOGY: replica_set
- func: run-simple-http-server
- func: run-tests
vars:
AUTH: auth
COVERAGE: 'ON'
SSL: openssl
- func: upload coverage
- func: update codecov.io
- name: test-coverage-latest-replica-set-auth-sasl-openssl-cse
tags:
- client-side-encryption
Expand All @@ -1156,6 +1188,8 @@ tasks:
commands:
- func: compile coverage
vars:
COMPILE_LIBMONGOCRYPT: 'ON'
EXTRA_CONFIGURE_FLAGS: EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON"
SASL: AUTO
SSL: OPENSSL
- func: fetch-det
Expand All @@ -1166,7 +1200,6 @@ tasks:
SSL: openssl
TOPOLOGY: replica_set
- func: run-simple-http-server
- func: fetch-det
- func: run-mock-kms-servers
- func: run-tests
vars:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,16 @@
)),
('update codecov.io', Function(
shell_mongoc(r'''
export CODECOV_TOKEN=${codecov_token}
curl -s https://codecov.io/bash | bash
# Note: coverage is currently only enabled on the ubuntu1804 distro.
# This script does not support MacOS, Windows, or non-x86_64 distros.
# Update accordingly if code coverage is expanded to other distros.
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
# -Z: Exit with a non-zero value if error.
# -g: Run with gcov support.
# -t: Codecov upload token.
# perl: filter verbose "Found" list and "Processing" messages.
./codecov -Zgt "${codecov_token}" | perl -lne 'print if not m|^.*\.gcov(\.\.\.)?$|'
''', test=False),
)),
('compile coverage', Function(
Expand Down
31 changes: 17 additions & 14 deletions .evergreen/legacy_config_generator/evergreen_config_lib/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __init__(self, *args, **kwargs):
# Compiling with ClientSideEncryption support requires linking against the library libmongocrypt.
super(CompileWithClientSideEncryption, self).__init__(*args,
COMPILE_LIBMONGOCRYPT="ON",
EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON -DENABLE_CLIENT_SIDE_ENCRYPTION=ON",
EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON",
**kwargs)
self.add_tags('client-side-encryption', 'special')

Expand All @@ -109,7 +109,7 @@ def __init__(self, *args, **kwargs):
CHECK_LOG="ON",
sanitize=[
'address'],
EXTRA_CONFIGURE_FLAGS="-DENABLE_CLIENT_SIDE_ENCRYPTION=ON -DENABLE_EXTRA_ALIGNMENT=OFF",
EXTRA_CONFIGURE_FLAGS="-DENABLE_EXTRA_ALIGNMENT=OFF",
PATH='/usr/lib/llvm-3.8/bin:$PATH',
**kwargs)
self.add_tags('client-side-encryption')
Expand Down Expand Up @@ -389,7 +389,7 @@ class CoverageTask(MatrixTask):
('auth', [True]),
('sasl', ['sasl']),
('ssl', ['openssl']),
('cse', [True])])
('cse', [False, True])])

def __init__(self, *args, **kwargs):
super(CoverageTask, self).__init__(*args, **kwargs)
Expand Down Expand Up @@ -419,28 +419,32 @@ def name_part(axis_name):
def to_dict(self):
task = super(CoverageTask, self).to_dict()
commands = task['commands']
if self.depends_on:
commands.append(
func('fetch-build', BUILD_NAME=self.depends_on['name']))

# Limit coverage tests to test-coverage-latest-replica-set-auth-sasl-openssl-cse.
commands.append(
func('compile coverage', SASL='AUTO', SSL='OPENSSL'))
if self.cse:
commands.append(func('compile coverage',
SASL='AUTO',
SSL='OPENSSL',
COMPILE_LIBMONGOCRYPT='ON',
EXTRA_CONFIGURE_FLAGS='EXTRA_CONFIGURE_FLAGS="-DENABLE_PIC=ON"'))
else:
commands.append(func('compile coverage',
SASL='AUTO',
SSL='OPENSSL'))

commands.append(func('fetch-det'))
commands.append(func('bootstrap-mongo-orchestration',
MONGODB_VERSION=self.version,
TOPOLOGY=self.topology,
AUTH='auth' if self.auth else 'noauth',
SSL=self.display('ssl')))
extra = {}
extra = {
'COVERAGE': 'ON'
}

commands.append(func('run-simple-http-server'))
if self.cse:
extra["CLIENT_SIDE_ENCRYPTION"] = "on"
commands.append(func('fetch-det'))
commands.append(func('run-mock-kms-servers'))
extra["COVERAGE"] = 'ON'
commands.append(func('run-tests',
AUTH=self.display('auth'),
SSL=self.display('ssl'),
Expand All @@ -451,12 +455,11 @@ def to_dict(self):
return task

def _check_allowed(self):
# Limit coverage tests to test-coverage-latest-replica-set-auth-sasl-openssl-cse.
# Limit coverage tests to test-coverage-latest-replica-set-auth-sasl-openssl (+ cse).
require(self.topology == 'replica_set')
require(self.auth)
require(self.sasl == 'sasl')
require(self.ssl == 'openssl')
require(self.cse)
require(self.version == 'latest')

# Address sanitizer only with auth+SSL or no auth + no SSL.
Expand Down
22 changes: 12 additions & 10 deletions .evergreen/scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,16 @@ if [[ "${COVERAGE}" == "ON" ]]; then
"--no-external"
)

case "${CC}" in
clang)
lcov --gcov-tool "$(pwd)/.evergreen/scripts/llvm-gcov.sh" "${coverage_args[@]}"
;;
*)
lcov --gcov-tool gcov "${coverage_args[@]}"
;;
esac

genhtml .coverage.lcov --legend --title "mongoc code coverage" --output-directory coverage
{
case "${CC}" in
clang)
lcov --gcov-tool "$(pwd)/.evergreen/scripts/llvm-gcov.sh" "${coverage_args[@]}"
;;
*)
lcov --gcov-tool gcov "${coverage_args[@]}"
;;
esac

genhtml .coverage.lcov --legend --title "mongoc code coverage" --output-directory coverage
} | perl -lne 'print if not m|Processing |'
fi