Skip to content

Commit

Permalink
Merge branch 'main' into alisha/neos-1619-run-page
Browse files Browse the repository at this point in the history
  • Loading branch information
alishakawaguchi committed Jan 22, 2025
2 parents 1bdaba4 + d2315fc commit 565c9d0
Show file tree
Hide file tree
Showing 111 changed files with 5,418 additions and 2,883 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,88 @@ jobs:
echo "Please run 'go mod tidy' in the tools directory and commit the changes."
exit 1
fi
benchmark:
name: benchmarks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache-dependency-path: go.sum

- name: Install benchstat
run: go install golang.org/x/perf/cmd/benchstat@latest

- name: Restore benchmark cache
id: cache-restore
uses: actions/cache/restore@v4
with:
path: main-benchmark.txt
key: benchmarks-main
restore-keys: benchmarks-main

- name: Run benchmarks on main if cache miss
if: steps.cache-restore.outputs.cache-hit != 'true'
run: |
git fetch origin main
git checkout origin/main
go test -run=^$ -bench=. -benchmem ./... | grep -E "Benchmark" | tee main-benchmark.txt
git checkout -
- name: Cache main branch benchmark results
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: main-benchmark.txt
key: benchmarks-main

- name: Run branch benchmark
run: go test -run=^$ -bench=. -benchmem ./... | grep -E "Benchmark" | tee branch-benchmark.txt

- name: Compare benchmarks
run: |
# Run benchstat and save output
benchstat main-benchmark.txt branch-benchmark.txt | tee benchstat-output.txt
echo "### Benchstat Geomean Results" > benchstat-results.txt
if grep -q "geomean" benchstat-output.txt; then
changes=( $(grep "geomean" benchstat-output.txt | awk '{
for(i=1; i<=NF; i++) {
if($i ~ /%/) {
gsub(/[+%]/, "", $i)
print $i
}
}
}') )
if [ ${#changes[@]} -ge 3 ]; then
result="${changes[0]}% sec/op, ${changes[1]}% B/op, ${changes[2]}% allocs/op"
echo -e "\n$result" >> benchstat-results.txt
else
echo -e "\nError: Not enough metrics found in benchstat output" >> benchstat-results.txt
fi
else
echo -e "\nNo geomean found in benchstat output" >> benchstat-results.txt
fi
echo -e "\n<details>\n<summary>Benchstat results</summary>\n\n\`\`\`\n$(cat benchstat-output.txt)\n\`\`\`\n</details>\n" >> benchstat-results.txt
- name: Comment Benchstat Results on PR
if: github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v3
with:
file-path: benchstat-results.txt
comment-tag: benchmark-results
github-token: ${{ secrets.GITHUB_TOKEN }}

# if this is main branch, cache the results
- name: Cache main branch benchmark results
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@v4
with:
path: branch-benchmark.txt
key: benchmarks-main

2 changes: 1 addition & 1 deletion .mockery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,6 @@ packages:
github.com/nucleuscloud/neosync/internal/ee/transformers/functions:
interfaces:
NeosyncOperatorApi:
github.com/nucleuscloud/neosync/worker/pkg/benthos/transformers:
github.com/nucleuscloud/neosync/worker/pkg/benthos/transformer_executor:
interfaces:
UserDefinedTransformerResolver:
59 changes: 59 additions & 0 deletions backend/gen/go/db/dbschemas/postgresql/mock_Querier.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 565c9d0

Please sign in to comment.