Skip to content
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

GODRIVER-3008 [master] Use mongodb-drivers-comment-bot for API reports #1433

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
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 @@ -1190,6 +1202,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"
Loading