Skip to content

Commit

Permalink
GODRIVER-3008 Use mongodb-drivers-comment-bot for API reports (#1424)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Oct 17, 2023
1 parent 6d7a981 commit 38ed5bb
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 56 deletions.
15 changes: 14 additions & 1 deletion .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ functions:
export GOCACHE="$(pwd)/.cache"
# Set other relevant variables for Evergreen processes.
export DRIVERS_TOOLS="$(pwd)/../drivers-tools"
export DRIVERS_TOOLS="$(dirname $(dirname $(dirname `pwd`)))/drivers-tools"
export PROJECT_DIRECTORY="$(pwd)"
export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration"
export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin"
Expand Down Expand Up @@ -329,6 +329,18 @@ functions:
${PREPARE_SHELL}
sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
create-api-report:
- command: shell.exec
type: test
params:
shell: "bash"
working_dir: src/go.mongodb.org/mongo-driver
script: |
${PREPARE_SHELL}
export BASE_SHA=${revision}
export HEAD_SHA=${github_commit}
bash etc/api_report.sh
send-perf-data:
- command: perf.send
params:
Expand Down Expand Up @@ -1194,6 +1206,7 @@ tasks:
- func: run-make
vars:
targets: "check-fmt check-license check-modules lint"
- func: "create-api-report"

- name: perf
tags: ["performance"]
Expand Down
2 changes: 1 addition & 1 deletion .evergreen/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export GOCACHE="$(pwd)/.cache"
export DRIVERS_TOOLS=${DRIVERS_TOOLS:-""}

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

if [ "Windows_NT" = "$OS" ]; then
Expand Down
42 changes: 0 additions & 42 deletions .github/workflows/comment.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ perf
.DS_Store
install
main.so
.cache
install
libmongocrypt
venv
test.suite

# AWS SAM-generated files
Expand Down
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ build: cross-compile build-tests build-compile-check
build-tests:
go test -short $(BUILD_TAGS) -run ^$$ ./...

.PHONY: api-report
api-report:
etc/api_report.sh

.PHONY: build-compile-check
build-compile-check:
etc/compile_check.sh
Expand Down
27 changes: 19 additions & 8 deletions etc/api_report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,29 @@
# Generates a report of Go Driver API changes for the current branch.
set -eux

cmd=$(command -v gorelease || true)
# Skip the report of it isn't a PR run.
if [ "$BASE_SHA" == "$HEAD_SHA" ]; then
echo "Skipping API Report"
exit 0
fi

# Ensure a clean checkout.
git checkout -b test-api-report
git add .
git commit -m "local changes"

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

branch=${GITHUB_BASE_REF:-master}
git fetch origin $branch:$branch
sha=$(git merge-base $branch HEAD)

gorelease -base=$sha > api-report.txt || true

# Generate and parse the report.
gorelease -base=$BASE_SHA > api-report.txt || true
cat api-report.txt
go run ./cmd/parse-api-report/main.go
rm api-report.txt

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

0 comments on commit 38ed5bb

Please sign in to comment.