Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/classify-test-changes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ while IFS= read -r file; do
;;
# contract/ is here because the Go suite checks the generated constants
# against the registry.
go/*|contract/*|drivers/*|config*.yaml|Dockerfile|.dockerignore)
go/*|contract/*|drivers/*|config*.yaml|Dockerfile|.dockerignore|.github/scripts/race.sh)
core=true
;;
optimizer/*|Dockerfile.optimizer|go/internal/mpc/*|go/cmd/ftw/main.go)
Expand Down
19 changes: 19 additions & 0 deletions .github/scripts/race.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Runs the Go race detector on the packages whose goroutines share state
# with the control loop. Same command locally and in CI:
# bash .github/scripts/race.sh
# Races in #787 and #789 merged because no check ran -race; on their parent
# commits this command fails with WARNING: DATA RACE.
set -euo pipefail
cd "$(dirname "$0")/../../go"
# Wall-clock budget tests assert speed, not memory safety. The race
# detector makes code 5-10x slower, so they fail here without a bug; the
# plain test job still runs them.
skip='^TestForecastRetentionLargeOverflowWithinScoringBudget$'
exec go test -race -count=1 -timeout 900s -skip "$skip" \
./internal/control/... ./internal/loadpoint/... ./internal/telemetry/... \
./internal/drivers/... ./internal/api/... ./internal/state/... \
./internal/mpc/... ./internal/cars/... ./internal/appproto/... \
./internal/appuplink/... ./internal/ocpp/... ./internal/ha/... \
./internal/config/... ./internal/backup/... ./internal/notifications/... \
./cmd/ftw/...
4 changes: 4 additions & 0 deletions .github/scripts/test-change-classifier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ assert_paths 'drivers/example.lua' \
assert_paths 'config.example.yaml' \
'core=true' 'optimizer=false' 'web=false' 'drivers=false' 'compose=false'

# Editing the race command alone must exercise it in CI.
assert_paths '.github/scripts/race.sh' \
'core=true' 'optimizer=false' 'web=false' 'drivers=false' 'compose=false'

assert_paths '.github/workflows/test.yml' \
'core=true' 'optimizer=true' 'web=true' 'drivers=true' 'compose=true'

Expand Down
19 changes: 18 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,22 @@ jobs:
- name: FTW Cloud uplink imports nothing that controls
run: bash .github/scripts/check-cloudlink-imports.sh go

race:
name: core (Go race detector)
needs: changes
if: needs.changes.outputs.core == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: '1.26'
cache-dependency-path: go/go.sum
- name: Fetch the bundled drivers
run: make drivers
- name: Race detector on the packages the control loop shares
run: bash .github/scripts/race.sh

web:
name: web
needs: changes
Expand Down Expand Up @@ -350,11 +366,12 @@ jobs:
name: go test + vet
if: always()
needs:
[changes, core, web, drivers, compose, e2e, contract]
[changes, core, race, web, drivers, compose, e2e, contract]
runs-on: ubuntu-latest
env:
RESULTS: >-
${{ needs.changes.result }} ${{ needs.core.result }}
${{ needs.race.result }}
${{ needs.web.result }}
${{ needs.drivers.result }}
${{ needs.compose.result }}
Expand Down
Loading