Skip to content

Commit

Permalink
feat: migrating to shared benchmark workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
benjivesterby committed Feb 5, 2024
1 parent f229905 commit bdb2c61
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 76 deletions.
36 changes: 5 additions & 31 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,11 @@ permissions:
contents: write
deployments: write

env:
GH_ACCESS_TOKEN: ${{ secrets.GH_PAT }}

jobs:
benchmark:
name: Execute Benchmarks
strategy:
matrix:
go-version: [1.19.x]
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
stable: false
- name: Checkout code
uses: actions/checkout@v3
- name: Run benchmark
run: go test -bench=. ./... | tee output.txt
- name: Download previous benchmark data
uses: actions/cache@v3
with:
path: ./cache
key: ${{ runner.os }}-benchmark
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: Benchmark Results
tool: 'go'
output-file-path: output.txt
benchmark-data-dir-path: dev/bench
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
alert-threshold: '200%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@benjivesterby'
uses: devnw/workflows/.github/workflows/make-bench.yml@main
secrets: inherit # pragma: allowlist secret
49 changes: 5 additions & 44 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,11 @@ on:
push:
tags:
- "v*"
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_PAT }}

jobs:
build:
name: Make Build
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: true
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ vars.GO_VERSION }}
stable: false

- name: Build
run: make build-ci

- name: Upload Test Coverage
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage.txt

- name: Upload Fuzz Results
uses: actions/upload-artifact@v3
with:
name: fuzz-results
path: testdata/fuzz

release:
needs: [build]
name: "Tagged Release"
runs-on: "ubuntu-latest"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Github Release from Tag
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
LICENSE
name: Tagged Release
uses: devnw/workflows/.github/workflows/make-release.yml@main
secrets: inherit # pragma: allowlist secret
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ fuzz:
done; \
done


bench:
go test -bench=. -benchmem ./...

lint: tidy
golangci-lint run
Expand Down Expand Up @@ -80,6 +81,8 @@ test-ci: deps tidy lint
build-ci: test-ci
$(env) go build ./...

bench-ci: test-ci
go test -bench=. ./... | tee output.txt

release-ci: build-ci
goreleaser release --rm-dist
Expand Down

0 comments on commit bdb2c61

Please sign in to comment.