diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a2b0d16 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,54 @@ +name: CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + workflow_dispatch: + +permissions: + contents: read + +jobs: + test: + name: Run Tests + runs-on: ubuntu-latest + strategy: + matrix: + go-version: [ "1.21.x", "1.22.x", "1.23.x", "1.24.x", "1.25.x", "1.26.x"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Go ${{ matrix.go-version }} + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go-version }} + + - name: Verify dependencies + run: go mod verify + + - name: Build + run: go build -v ./... + + - name: Run tests with race detector + run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./... + + lint: + name: Lint Code + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.21.x" + cache: false # golangci-lint-action handles its own caching + + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: latest + args: --timeout=5m diff --git a/README.md b/README.md index 912dc07..3e10bae 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ func main() { // 2. Worker reuse is disabled to prevent state leaks between sessions pool, _ := herd.New(factory, - herd.WithAutoScale(1, 5), + herd.WithAutoScale(1, 5), // auto-scale between 1 and 5 concurrent tenants (until expires) herd.WithTTL(15 * time.Minute), herd.WithWorkerReuse(false), // CRITICAL: Never share browsers between users ) diff --git a/pool.go b/pool.go index 3d19bb5..d1f2690 100644 --- a/pool.go +++ b/pool.go @@ -136,7 +136,6 @@ type Pool[C any] struct { workers []Worker[C] // all known workers (for Stats / Shutdown) available chan Worker[C] // free workers - wg sync.WaitGroup done chan struct{} // closed when the pool is shutting down, all the background loops will listen for this // pool context for canceling all the background loops