Weekly Benchmark #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Weekly Benchmark | |
| on: | |
| schedule: | |
| - cron: '0 0 * * 0' # Every Sunday at midnight UTC | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| benchmark: | |
| 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 | |
| - name: Update dependencies to latest | |
| run: | | |
| # Update actively-maintained direct dependencies individually so a | |
| # failure on any one package is logged but does not block the rest. | |
| # pkujhd/goloader is excluded: it references cmd/objfile/* internal | |
| # packages that cannot be resolved outside the Docker build environment, | |
| # so `go get -u` would fail. The Dockerfile's `cp -r cmd/internal …` | |
| # workaround handles it at build time instead. | |
| PKGS=( | |
| github.com/GoCodeAlone/go-plugin | |
| github.com/GoCodeAlone/yaegi | |
| github.com/hashicorp/go-hclog | |
| github.com/hashicorp/go-plugin | |
| github.com/tetratelabs/wazero | |
| github.com/traefik/yaegi | |
| google.golang.org/grpc | |
| google.golang.org/protobuf | |
| ) | |
| for pkg in "${PKGS[@]}"; do | |
| go get -u "$pkg" || echo "Warning: could not update $pkg" | |
| done | |
| go mod tidy | |
| - name: Build Docker image | |
| run: docker build --tag go-plugin-benchmark:local . | |
| - name: Run benchmarks | |
| run: | | |
| docker run go-plugin-benchmark:local \ | |
| go test -bench=. -benchtime=5s -count=1 \ | |
| 2>&1 | tee /tmp/bench.txt | |
| - name: Update README with benchmark results | |
| run: python3 scripts/update_readme.py < /tmp/bench.txt | |
| - name: Commit and push changes | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add go.mod go.sum README.md | |
| if ! git diff --cached --quiet; then | |
| git commit -m "chore: update dependencies and benchmark results [skip ci]" | |
| git push | |
| else | |
| echo "No changes to commit" | |
| fi |