diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 5931ba188..e74d8fd48 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -267,3 +267,34 @@ jobs: exit 1 fi done + + benchmark: + permissions: + contents: read + checks: write + pull-requests: write + runs-on: windows-latest + needs: + - build + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + - name: Benchmark + run: | + ./make bench | Tee-Object -FilePath output.txt + - name: Download previous benchmark data + uses: actions/cache@v4 + with: + path: ./cache + key: ${{ runner.os }}-benchmark + - name: Store benchmark result + uses: benchmark-action/github-action-benchmark@v1 + with: + tool: 'go' + output-file-path: output.txt + external-data-json-path: ./cache/benchmark-data.json + fail-on-alert: true diff --git a/make.bat b/make.bat index 452ca0cae..93196d2c4 100644 --- a/make.bat +++ b/make.bat @@ -21,6 +21,7 @@ set GOBIN=%USERPROFILE%\go\bin set GOTEST=go test -timeout=10m -v -gcflags=all=-d=checkptr=0 set GOFMT=gofmt -e -s -l -w set GOLINT=%GOBIN%\golangci-lint +set GOBENCH=go test ./... -run='^$' -bench=Benchmark -benchmem if NOT DEFINED VERSION ( set VERSION="0.0.0" @@ -56,6 +57,7 @@ if "%~1"=="install" goto install if "%~1"=="deps" goto deps if "%~1"=="rsrc" goto rsrc if "%~1"=="mc" goto mc +if "%~1"=="bench" goto bench :build :: set PKG_CONFIG_PATH=pkg-config @@ -101,6 +103,11 @@ gcc pkg/outputs/eventlog/mc/fibratus.res -o pkg/outputs/eventlog/mc/fibratus.dll if errorlevel 1 goto fail goto :EOF +:bench +%GOBENCH% +if errorlevel 1 goto fail +goto :EOF + :pkg set RELEASE_DIR=.\build\msi\fibratus-%VERSION%