Skip to content

Commit add8f6b

Browse files
authored
CDRIVER-5930 re-enable ABI compliance checks for r1.30 (#1978)
1 parent 56584eb commit add8f6b

File tree

5 files changed

+214
-63
lines changed

5 files changed

+214
-63
lines changed

.evergreen/config_generator/components/abi_compliance_check.py

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,49 @@
22
from shrub.v3.evg_command import s3_put
33
from shrub.v3.evg_task import EvgTask
44

5+
from config_generator.components.funcs.set_cache_dir import SetCacheDir
6+
57
from config_generator.etc.function import Function
68
from config_generator.etc.utils import bash_exec
79

810

911
class CheckABICompliance(Function):
1012
name = 'abi-compliance-check'
11-
commands = [
13+
commands = SetCacheDir.commands + [
1214
bash_exec(
1315
command_type=EvgCommandType.SETUP,
1416
working_dir='mongoc',
17+
include_expansions_in_env=['MONGO_C_DRIVER_CACHE_DIR'],
1518
script='.evergreen/scripts/abi-compliance-check-setup.sh'
1619
),
1720
bash_exec(
18-
command_type=EvgCommandType.SETUP,
21+
command_type=EvgCommandType.TEST,
1922
add_expansions_to_env=True,
2023
working_dir='mongoc',
24+
include_expansions_in_env=['MONGO_C_DRIVER_CACHE_DIR'],
2125
script='.evergreen/scripts/abi-compliance-check.sh'
2226
),
23-
bash_exec(
24-
command_type=EvgCommandType.TEST,
25-
working_dir='mongoc',
26-
env={
27-
'AWS_ACCESS_KEY_ID': '${aws_key}',
28-
'AWS_SECRET_ACCESS_KEY': '${aws_secret}',
29-
},
30-
script='''\
31-
aws s3 cp abi-compliance/compat_reports s3://mciuploads/mongo-c-driver/${build_variant}/${revision}/${version_id}/${build_id}/abi-compliance/compat_reports --recursive --acl public-read --region us-east-1
32-
[[ ! -f ./abi-compliance/abi-error.txt ]]
33-
'''
34-
),
3527
s3_put(
28+
command_type=EvgCommandType.SYSTEM,
3629
aws_key='${aws_key}',
3730
aws_secret='${aws_secret}',
3831
bucket='mciuploads',
3932
content_type='text/html',
4033
display_name='ABI Report:',
4134
local_files_include_filter='mongoc/abi-compliance/compat_reports/**/*.html',
4235
permissions='public-read',
43-
remote_file='mongo-c-driver/${build_variant}/${revision}/${version_id}/${build_id}/abi-compliance/compat_report.html',
36+
remote_file='mongo-c-driver/${branch_name}/${revision}/${version_id}/${build_id}/${task_id}/${execution}/abi-compliance-check/',
37+
),
38+
s3_put(
39+
command_type=EvgCommandType.SYSTEM,
40+
aws_key='${aws_key}',
41+
aws_secret='${aws_secret}',
42+
bucket='mciuploads',
43+
content_type='text/plain',
44+
display_name='ABI Compliance Check: ',
45+
local_files_include_filter='abi-compliance/logs/**/log.txt',
46+
permissions='public-read',
47+
remote_file='mongo-c-driver/${branch_name}/${revision}/${version_id}/${build_id}/${task_id}/${execution}/abi-compliance-check/',
4448
),
4549
]
4650

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
from config_generator.etc.function import Function
2+
from config_generator.etc.utils import bash_exec
3+
4+
from shrub.v3.evg_command import EvgCommandType, expansions_update
5+
6+
7+
class SetCacheDir(Function):
8+
name = 'set-cache-dir'
9+
commands = [
10+
bash_exec(
11+
command_type=EvgCommandType.SETUP,
12+
script='''\
13+
if [[ -n "$XDG_CACHE_DIR" ]]; then
14+
cache_dir="$XDG_CACHE_DIR" # XDG Base Directory specification.
15+
elif [[ -n "$LOCALAPPDATA" ]]; then
16+
cache_dir="$LOCALAPPDATA" # Windows.
17+
elif [[ -n "$USERPROFILE" ]]; then
18+
cache_dir="$USERPROFILE/.cache" # Windows (fallback).
19+
elif [[ -d "$HOME/Library/Caches" ]]; then
20+
cache_dir="$HOME/Library/Caches" # MacOS.
21+
elif [[ -n "$HOME" ]]; then
22+
cache_dir="$HOME/.cache" # Linux-like.
23+
elif [[ -d ~/.cache ]]; then
24+
cache_dir="~/.cache" # Linux-like (fallback).
25+
else
26+
cache_dir="$(pwd)/.cache" # EVG task directory (fallback).
27+
fi
28+
29+
mkdir -p "$cache_dir/mongo-c-driver" || exit
30+
cache_dir="$(cd "$cache_dir/mongo-c-driver" && pwd)" || exit
31+
32+
printf "MONGO_C_DRIVER_CACHE_DIR: %s\\n" "$cache_dir" >|expansions.set-cache-dir.yml
33+
''',
34+
),
35+
expansions_update(
36+
command_type=EvgCommandType.SETUP,
37+
file='expansions.set-cache-dir.yml'
38+
),
39+
]
40+
41+
42+
def functions():
43+
return SetCacheDir.defn()

.evergreen/generated_configs/functions.yml

Lines changed: 77 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,56 @@ functions:
44
type: setup
55
params:
66
binary: bash
7-
working_dir: mongoc
87
args:
98
- -c
10-
- .evergreen/scripts/abi-compliance-check-setup.sh
9+
- |
10+
if [[ -n "$XDG_CACHE_DIR" ]]; then
11+
cache_dir="$XDG_CACHE_DIR" # XDG Base Directory specification.
12+
elif [[ -n "$LOCALAPPDATA" ]]; then
13+
cache_dir="$LOCALAPPDATA" # Windows.
14+
elif [[ -n "$USERPROFILE" ]]; then
15+
cache_dir="$USERPROFILE/.cache" # Windows (fallback).
16+
elif [[ -d "$HOME/Library/Caches" ]]; then
17+
cache_dir="$HOME/Library/Caches" # MacOS.
18+
elif [[ -n "$HOME" ]]; then
19+
cache_dir="$HOME/.cache" # Linux-like.
20+
elif [[ -d ~/.cache ]]; then
21+
cache_dir="~/.cache" # Linux-like (fallback).
22+
else
23+
cache_dir="$(pwd)/.cache" # EVG task directory (fallback).
24+
fi
25+
26+
mkdir -p "$cache_dir/mongo-c-driver" || exit
27+
cache_dir="$(cd "$cache_dir/mongo-c-driver" && pwd)" || exit
28+
29+
printf "MONGO_C_DRIVER_CACHE_DIR: %s\n" "$cache_dir" >|expansions.set-cache-dir.yml
30+
- command: expansions.update
31+
type: setup
32+
params:
33+
file: expansions.set-cache-dir.yml
1134
- command: subprocess.exec
1235
type: setup
1336
params:
1437
binary: bash
1538
working_dir: mongoc
16-
add_expansions_to_env: true
39+
include_expansions_in_env:
40+
- MONGO_C_DRIVER_CACHE_DIR
1741
args:
1842
- -c
19-
- .evergreen/scripts/abi-compliance-check.sh
43+
- .evergreen/scripts/abi-compliance-check-setup.sh
2044
- command: subprocess.exec
2145
type: test
2246
params:
2347
binary: bash
2448
working_dir: mongoc
25-
env:
26-
AWS_ACCESS_KEY_ID: ${aws_key}
27-
AWS_SECRET_ACCESS_KEY: ${aws_secret}
49+
add_expansions_to_env: true
50+
include_expansions_in_env:
51+
- MONGO_C_DRIVER_CACHE_DIR
2852
args:
2953
- -c
30-
- |
31-
aws s3 cp abi-compliance/compat_reports s3://mciuploads/mongo-c-driver/${build_variant}/${revision}/${version_id}/${build_id}/abi-compliance/compat_reports --recursive --acl public-read --region us-east-1
32-
[[ ! -f ./abi-compliance/abi-error.txt ]]
54+
- .evergreen/scripts/abi-compliance-check.sh
3355
- command: s3.put
56+
type: system
3457
params:
3558
display_name: "ABI Report:"
3659
aws_key: ${aws_key}
@@ -39,7 +62,18 @@ functions:
3962
content_type: text/html
4063
local_files_include_filter: mongoc/abi-compliance/compat_reports/**/*.html
4164
permissions: public-read
42-
remote_file: mongo-c-driver/${build_variant}/${revision}/${version_id}/${build_id}/abi-compliance/compat_report.html
65+
remote_file: mongo-c-driver/${branch_name}/${revision}/${version_id}/${build_id}/${task_id}/${execution}/abi-compliance-check/
66+
- command: s3.put
67+
type: system
68+
params:
69+
display_name: "ABI Compliance Check: "
70+
aws_key: ${aws_key}
71+
aws_secret: ${aws_secret}
72+
bucket: mciuploads
73+
content_type: text/plain
74+
local_files_include_filter: abi-compliance/logs/**/log.txt
75+
permissions: public-read
76+
remote_file: mongo-c-driver/${branch_name}/${revision}/${version_id}/${build_id}/${task_id}/${execution}/abi-compliance-check/
4377
backtrace:
4478
- command: subprocess.exec
4579
params:
@@ -551,6 +585,38 @@ functions:
551585
args:
552586
- -c
553587
- .evergreen/scripts/compile-scan-build.sh
588+
set-cache-dir:
589+
- command: subprocess.exec
590+
type: setup
591+
params:
592+
binary: bash
593+
args:
594+
- -c
595+
- |
596+
if [[ -n "$XDG_CACHE_DIR" ]]; then
597+
cache_dir="$XDG_CACHE_DIR" # XDG Base Directory specification.
598+
elif [[ -n "$LOCALAPPDATA" ]]; then
599+
cache_dir="$LOCALAPPDATA" # Windows.
600+
elif [[ -n "$USERPROFILE" ]]; then
601+
cache_dir="$USERPROFILE/.cache" # Windows (fallback).
602+
elif [[ -d "$HOME/Library/Caches" ]]; then
603+
cache_dir="$HOME/Library/Caches" # MacOS.
604+
elif [[ -n "$HOME" ]]; then
605+
cache_dir="$HOME/.cache" # Linux-like.
606+
elif [[ -d ~/.cache ]]; then
607+
cache_dir="~/.cache" # Linux-like (fallback).
608+
else
609+
cache_dir="$(pwd)/.cache" # EVG task directory (fallback).
610+
fi
611+
612+
mkdir -p "$cache_dir/mongo-c-driver" || exit
613+
cache_dir="$(cd "$cache_dir/mongo-c-driver" && pwd)" || exit
614+
615+
printf "MONGO_C_DRIVER_CACHE_DIR: %s\n" "$cache_dir" >|expansions.set-cache-dir.yml
616+
- command: expansions.update
617+
type: setup
618+
params:
619+
file: expansions.set-cache-dir.yml
554620
start-load-balancer:
555621
- command: subprocess.exec
556622
type: setup

.evergreen/scripts/abi-compliance-check-setup.sh

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,30 @@ fi
1818
declare parallel_level
1919
parallel_level="$(("$(nproc)" + 1))"
2020

21+
export PATH
22+
PATH="${MONGO_C_DRIVER_CACHE_DIR:?}/bin:${PATH:-}" # abi-compliance-checker
23+
2124
# Obtain abi-compliance-checker.
2225
echo "Fetching abi-compliance-checker..."
23-
[[ -d checker ]] || {
24-
git clone -b "2.3" --depth 1 https://github.com/lvc/abi-compliance-checker.git checker
25-
pushd checker
26-
make -j "${parallel_level:?}" --no-print-directory install prefix="${working_dir:?}/install"
27-
popd # checker
26+
[[ -d "${MONGO_C_DRIVER_CACHE_DIR:?}/checker-2.3" ]] || {
27+
git clone -b "2.3" --depth 1 https://github.com/lvc/abi-compliance-checker.git "${MONGO_C_DRIVER_CACHE_DIR:?}/checker-2.3"
28+
pushd "${MONGO_C_DRIVER_CACHE_DIR:?}/checker-2.3"
29+
make -j "${parallel_level:?}" --no-print-directory install prefix="${MONGO_C_DRIVER_CACHE_DIR:?}"
30+
popd # "${MONGO_C_DRIVER_CACHE_DIR:?}/checker-2.3"
2831
} >/dev/null
2932
echo "Fetching abi-compliance-checker... done."
3033

3134
# Obtain ctags.
3235
echo "Fetching ctags..."
33-
[[ -d ctags ]] || {
34-
git clone -b "v6.0.0" --depth 1 https://github.com/universal-ctags/ctags.git ctags
35-
pushd ctags
36+
[[ -d "${MONGO_C_DRIVER_CACHE_DIR:?}/ctags-6.0.0" ]] || {
37+
git clone -b "v6.0.0" --depth 1 https://github.com/universal-ctags/ctags.git "${MONGO_C_DRIVER_CACHE_DIR:?}/ctags-6.0.0"
38+
pushd "${MONGO_C_DRIVER_CACHE_DIR:?}/ctags-6.0.0"
3639
./autogen.sh
37-
./configure --prefix="${working_dir}/install"
40+
./configure --prefix="${MONGO_C_DRIVER_CACHE_DIR:?}"
3841
make -j "${parallel_level:?}"
3942
make install
40-
popd # ctags
43+
popd # "${MONGO_C_DRIVER_CACHE_DIR:?}/ctags-6.0.0"
4144
} >/dev/null
4245
echo "Fetching ctags... done."
4346

44-
command -V abi-compliance-checker
47+
command -V abi-compliance-checker

0 commit comments

Comments
 (0)