Skip to content

Race Detection

Race Detection #330

Workflow file for this run

# Race Detection Workflow
# Runs tests with race detector enabled (-race flag)
# This is resource-intensive (2-20x slower) so it runs on a schedule rather than on every PR
name: Race Detection
on:
schedule:
# Run nightly at 2 AM UTC
- cron: '0 2 * * *'
workflow_dispatch: # Allow manual triggering
push:
branches: [ "main" ]
paths:
- '**.go'
- 'go.mod'
- 'go.sum'
permissions:
contents: read
jobs:
race-test:
runs-on: ubuntu-latest
timeout-minutes: 30 # Race detector is slower (2-20x), allow more time
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25'
cache: true
- name: Test parser package with Race Detector
timeout-minutes: 12
run: go test -v -race -short -timeout=10m -p=1 -parallel=1 -skip='^Fuzz' ./parser
env:
GOMAXPROCS: 1 # Limit to 1 CPU to prevent resource exhaustion on GitHub Actions runners
GORACE: "halt_on_error=1" # Exit immediately on first race for faster feedback
- name: Test other packages with Race Detector
timeout-minutes: 15
run: go test -v -race -short -timeout=10m -p=1 -parallel=1 -skip='^Fuzz' $(go list ./... | grep -v '/parser$')
env:
GOMAXPROCS: 1 # Limit to 1 CPU to prevent resource exhaustion on GitHub Actions runners
GORACE: "halt_on_error=1" # Exit immediately on first race for faster feedback