Skip to content

perf: v0.12.19 — zero-alloc captures, 95% less memory #405

perf: v0.12.19 — zero-alloc captures, 95% less memory

perf: v0.12.19 — zero-alloc captures, 95% less memory #405

Workflow file for this run

name: Tests
# Testing Strategy:
# - Tests run on Linux, macOS, and Windows (cross-platform library)
# - Regex engine with SIMD assembly - must work everywhere
# - Go 1.25+ required (matches go.mod requirement)
# - Zero external dependencies (except golang.org/x/sys for CPU detection)
#
# Branch Strategy (Git Flow):
# - feature/** branches: Development work
# - release/** branches: Pre-release testing (test here BEFORE merging to main)
# - hotfix/** branches: Critical bug fixes
# - develop branch: Integration branch
# - main branch: Production-ready code only (protected)
# - Pull requests: Must pass all tests before merge
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
# Unit tests - Cross-platform
unit-tests:
name: Unit Tests - ${{ matrix.os }} - Go ${{ matrix.go-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ['1.25'] # Match go.mod requirement
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Download dependencies
run: go mod download
- name: Verify dependencies
run: go mod verify
- name: Run go vet
if: matrix.os == 'ubuntu-latest'
run: go vet ./...
- name: Run unit tests with race detector
shell: bash
run: go test -short -v -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.25'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
flags: unittests
name: codecov-unit
fail_ci_if_error: false
# 32-bit build verification (GOARCH=386)
# GoAWK tests on 386, we must support it
build-386:
name: Build - Linux 386
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true
- name: Build for 386
run: GOARCH=386 go build ./...
- name: Run tests for 386
run: GOARCH=386 go test -short ./...
lint:
name: Lint
runs-on: ubuntu-latest
continue-on-error: false # Strict for production library
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.10
args: --timeout=5m
# Formatting check
formatting:
name: Code Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true
- name: Check formatting
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "ERROR: The following files are not formatted:"
gofmt -l .
echo ""
echo "Run 'go fmt ./...' to fix formatting issues."
exit 1
fi
echo "All files are properly formatted ✓"
# Benchmarks (informational only, runs on push)
# For PR benchmark comparison, see benchmarks.yml
benchmarks:
name: Benchmarks (Smoke Test)
runs-on: ubuntu-latest
# Only run on push (not PRs - those use benchmarks.yml for comparison)
if: github.event_name == 'push'
continue-on-error: true # Don't fail CI on benchmark failures
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true
- name: Run benchmark smoke test
run: |
echo "=== Quick Benchmark Smoke Test ==="
echo "For detailed comparison, see PR benchmark workflow"
echo ""
# Quick smoke test (1 iteration)
go test -bench=BenchmarkMemchr/AVX2_4096 -benchmem -count=1 ./simd/ || true
go test -bench=BenchmarkMemmem/AVX2_4096 -benchmem -count=1 ./simd/ || true
go test -bench=BenchmarkReverseSuffix -benchmem -count=1 ./meta/ || true