Skip to content

Commit 38ed5bb

Browse files
authored
GODRIVER-3008 Use mongodb-drivers-comment-bot for API reports (#1424)
1 parent 6d7a981 commit 38ed5bb

File tree

6 files changed

+38
-56
lines changed

6 files changed

+38
-56
lines changed

Diff for: .evergreen/config.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ functions:
5454
export GOCACHE="$(pwd)/.cache"
5555
5656
# Set other relevant variables for Evergreen processes.
57-
export DRIVERS_TOOLS="$(pwd)/../drivers-tools"
57+
export DRIVERS_TOOLS="$(dirname $(dirname $(dirname `pwd`)))/drivers-tools"
5858
export PROJECT_DIRECTORY="$(pwd)"
5959
export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration"
6060
export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin"
@@ -329,6 +329,18 @@ functions:
329329
${PREPARE_SHELL}
330330
sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
331331
332+
create-api-report:
333+
- command: shell.exec
334+
type: test
335+
params:
336+
shell: "bash"
337+
working_dir: src/go.mongodb.org/mongo-driver
338+
script: |
339+
${PREPARE_SHELL}
340+
export BASE_SHA=${revision}
341+
export HEAD_SHA=${github_commit}
342+
bash etc/api_report.sh
343+
332344
send-perf-data:
333345
- command: perf.send
334346
params:
@@ -1194,6 +1206,7 @@ tasks:
11941206
- func: run-make
11951207
vars:
11961208
targets: "check-fmt check-license check-modules lint"
1209+
- func: "create-api-report"
11971210

11981211
- name: perf
11991212
tags: ["performance"]

Diff for: .evergreen/run-tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export GOCACHE="$(pwd)/.cache"
77
export DRIVERS_TOOLS=${DRIVERS_TOOLS:-""}
88

99
if [ -z $DRIVERS_TOOLS ]; then
10-
export DRIVERS_TOOLS="$(pwd)/../drivers-tools"
10+
export DRIVERS_TOOLS=="$(dirname $(dirname $(dirname `pwd`)))/drivers-tools"
1111
fi
1212

1313
if [ "Windows_NT" = "$OS" ]; then

Diff for: .github/workflows/comment.yml

-42
This file was deleted.

Diff for: .gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ perf
1414
.DS_Store
1515
install
1616
main.so
17+
.cache
18+
install
19+
libmongocrypt
20+
venv
1721
test.suite
1822

1923
# AWS SAM-generated files

Diff for: Makefile

-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ build: cross-compile build-tests build-compile-check
2424
build-tests:
2525
go test -short $(BUILD_TAGS) -run ^$$ ./...
2626

27-
.PHONY: api-report
28-
api-report:
29-
etc/api_report.sh
30-
3127
.PHONY: build-compile-check
3228
build-compile-check:
3329
etc/compile_check.sh

Diff for: etc/api_report.sh

+19-8
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,29 @@
33
# Generates a report of Go Driver API changes for the current branch.
44
set -eux
55

6-
cmd=$(command -v gorelease || true)
6+
# Skip the report of it isn't a PR run.
7+
if [ "$BASE_SHA" == "$HEAD_SHA" ]; then
8+
echo "Skipping API Report"
9+
exit 0
10+
fi
11+
12+
# Ensure a clean checkout.
13+
git checkout -b test-api-report
14+
git add .
15+
git commit -m "local changes"
716

17+
# Ensure gorelease is installed.
18+
cmd=$(command -v gorelease || true)
819
if [ -z $cmd ]; then
920
go install golang.org/x/exp/cmd/gorelease@latest
1021
fi
1122

12-
branch=${GITHUB_BASE_REF:-master}
13-
git fetch origin $branch:$branch
14-
sha=$(git merge-base $branch HEAD)
15-
16-
gorelease -base=$sha > api-report.txt || true
17-
23+
# Generate and parse the report.
24+
gorelease -base=$BASE_SHA > api-report.txt || true
25+
cat api-report.txt
1826
go run ./cmd/parse-api-report/main.go
27+
rm api-report.txt
1928

20-
rm api-report.txt
29+
# Make the PR comment.
30+
target=$DRIVERS_TOOLS/.evergreen/github_app/create_or_modify_comment.sh
31+
bash $target -m "## API Change Report" -c "$(pwd)/api-report.md" -h $HEAD_SHA -o "mongodb" -n "mongo-go-driver"

0 commit comments

Comments
 (0)