Skip to content

perf: add a benchmark suite and remove five measured wastes #1474

perf: add a benchmark suite and remove five measured wastes

perf: add a benchmark suite and remove five measured wastes #1474

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: go.mod
- name: Build
run: go build ./...
- name: Test
run: go test -race -vet=off ./...
- name: Vet
run: go vet ./... || echo "::warning::go vet found issues (non-blocking)"
doc-examples:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: go.mod
- name: Check doc example markers
run: make check-doc-examples
- name: Install trivy
run: |
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/75c4dc0f45c5d7ffd05ae26df1e0c666787bdf2a/contrib/install.sh \
| sh -s -- -b /usr/local/bin v0.69.3
- name: Update doc examples
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
go build -o uzomuzo ./cmd/uzomuzo
go run ./scripts/update-doc-examples --skip-build
- name: Create PR with updated doc examples
env:
# PAT required — GITHUB_TOKEN push does not trigger CI on the new branch.
GH_TOKEN: ${{ secrets.GH_ACTIONS_TOKEN }}
run: |
git diff --quiet README.md docs/usage.md docs/assets/juice-shop-eol-result.txt && echo "No changes" && exit 0
BRANCH="docs/update-examples-$(date +%Y%m%d-%H%M%S)"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
git checkout -b "$BRANCH"
git add README.md docs/usage.md docs/assets/juice-shop-eol-result.txt
git commit -m "docs: update output examples"
git push -u origin "$BRANCH"
gh pr create \
--title "docs: refresh output examples" \
--body "Automated refresh of documentation output examples via \`workflow_dispatch\` (including juice-shop SBOM scan)." \
--base main
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: go.mod
- uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0