diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml new file mode 100644 index 0000000..065ffec --- /dev/null +++ b/.github/workflows/benchmark.yaml @@ -0,0 +1,54 @@ +name: Benchmark + +on: + push: + branches: + - master + pull_request: + branches: + - master + +permissions: + contents: read + +jobs: + benchmark: + strategy: + matrix: + os: [ubuntu-latest] + go: ["1.22"] + test-tags: ["-benchmem", "-bench ."] + test-floder: ["go list ./... | grep benchmarks"] + include: + - os: ubuntu-latest + go-build: ~/.cache/go-build + name: ${{ matrix.os }} @ Go ${{ matrix.go }} ${{ matrix.test-tags }} + runs-on: ${{ matrix.os }} + env: + GO111MODULE: on + TESTTAGS: ${{ matrix.test-tags }} + TESTFOLDER: ${{ matrix.test-floder }} + GOPROXY: https://proxy.golang.org + steps: + - name: Set up Go ${{ matrix.go }} + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go }} + cache: false + + - name: Checkout Code + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + - uses: actions/cache@v4 + with: + path: | + ${{ matrix.go-build }} + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Benchmark + run: make test diff --git a/Makefile b/Makefile index 15cb59f..bce1c8a 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ GO_VERSION=$(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2) PACKAGES ?= $(shell $(GO) list ./...) VETPACKAGES ?= $(shell $(GO) list ./... | grep -v /examples/) GOFILES := $(shell find . -name "*.go") -TESTFOLDER := $(shell $(GO) list ./... | grep -v examples | grep -v benchmarks) +TESTFOLDER := $(shell $(GO) list ./... | grep -v examples) TESTTAGS ?= "" .PHONY: test