Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Prev Previous commit
Next Next commit
WIP
  • Loading branch information
sethsamuel committed Apr 21, 2025
commit fe0cd15ed9bceb328158c6d3762f27c3739cf14e
42 changes: 18 additions & 24 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ jobs:
go-version: [ '1.24' ]

steps:
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b
with:
go-version: ${{ matrix.go-version }}
- name: Display Go version
run: go version
- name: Restore main benchmark
uses: actions/cache/restore@v4
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Code Vulnerability

Workflow depends on a GitHub actions pinned by tag instead of a hash. (...read more)

Pin GitHub Actions by commit hash to ensure supply chain security.

Using a branch (@main) or tag (@v1) allows for implicit updates, which can introduce unexpected or malicious changes. Instead, always pin actions to a full length commit SHA. You can find the commit SHA for the latest tag from the action’s repository and ensure frequent updates via auto-updaters such as dependabot. Include a comment with the corresponding full-length SemVer tag for clarity:

      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

View in Datadog  Leave us feedback  Documentation

id: restore-main-benchmark
Expand All @@ -29,14 +35,6 @@ jobs:
with:
ref: main
clean: false
- name: Setup Go ${{ matrix.go-version }}
if: steps.restore-main-benchmark.outputs.cache-hit != 'true'
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b
with:
go-version: ${{ matrix.go-version }}
- name: Display Go version
run: go version
if: steps.restore-main-benchmark.outputs.cache-hit != 'true'
- name: Install dependencies
if: steps.restore-main-benchmark.outputs.cache-hit != 'true'
run: go get .
Expand All @@ -56,28 +54,24 @@ jobs:
key: main-benchmark-2
- name: Checkout branch
uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b
with:
go-version: ${{ matrix.go-version }}
- name: Display Go version
run: go version
- name: Install benchstat
run: go get -u golang.org/x/perf/cmd/benchstat
- name: Compare benchmarks
run: benchstat bench/main.txt bench/${{github.sha}}.txt | tee bench/benchstat.txt
- name: Restore main benchmark
uses: actions/cache/restore@v4
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Code Vulnerability

Workflow depends on a GitHub actions pinned by tag instead of a hash. (...read more)

Pin GitHub Actions by commit hash to ensure supply chain security.

Using a branch (@main) or tag (@v1) allows for implicit updates, which can introduce unexpected or malicious changes. Instead, always pin actions to a full length commit SHA. You can find the commit SHA for the latest tag from the action’s repository and ensure frequent updates via auto-updaters such as dependabot. Include a comment with the corresponding full-length SemVer tag for clarity:

      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

View in Datadog  Leave us feedback  Documentation

with:
path: bench/main.txt
key: main-benchmark-2
fail-on-cache-miss: true
- name: Install dependencies
run: go get .
- name: Build
run: go build -v ./...
- name: Benchmark
run: go test -timeout=9999999s -bench=. -benchmem -count=2 ./... | tee bench/${{github.sha}}.txt
# - name: Install dependencies
# run: go get .
# - name: Build
# run: go build -v ./...
# - name: Benchmark
# run: go test -timeout=9999999s -bench=. -benchmem -count=2 ./... | tee bench/${{github.sha}}.txt
- name: Install benchstat
run: go get -u golang.org/x/perf/cmd/benchstat
- run: go env
- run: echo $PATH
- name: Compare benchmarks
run: benchstat bench/main.txt bench/${{github.sha}}.txt | tee bench/benchstat.txt
- name: Store benchmark
uses: actions/upload-artifact@v4
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Code Vulnerability

Workflow depends on a GitHub actions pinned by tag instead of a hash. (...read more)

Pin GitHub Actions by commit hash to ensure supply chain security.

Using a branch (@main) or tag (@v1) allows for implicit updates, which can introduce unexpected or malicious changes. Instead, always pin actions to a full length commit SHA. You can find the commit SHA for the latest tag from the action’s repository and ensure frequent updates via auto-updaters such as dependabot. Include a comment with the corresponding full-length SemVer tag for clarity:

      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

View in Datadog  Leave us feedback  Documentation

with:
Expand Down
Loading