From e22adb2b518475331859ebe9e814859cbd084e0a Mon Sep 17 00:00:00 2001 From: rob Date: Wed, 4 Feb 2026 21:21:09 +0000 Subject: [PATCH 1/4] Add GitHub test action --- .github/workflows/test.yml | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..5062485 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,41 @@ +name: Test + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + services: + valkey: + image: valkey/valkey:latest + ports: + - 6379:6379 + options: >- + --health-cmd "valkey-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + cache: true + + - name: Install dependencies + run: go mod download + + - name: Run tests + run: go test -v ./... + env: + TEST_REDIS_ADDR: localhost:6379 \ No newline at end of file From 2de15b70b55120a0e765dba52002c6c961d0008e Mon Sep 17 00:00:00 2001 From: Rob Mason Date: Mon, 16 Feb 2026 18:44:23 +0000 Subject: [PATCH 2/4] Update README.md Add test badge, language hint for code blocks --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c901bd3..11796ce 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ Distributed variants built on top of [redis/rueidis](https://github.com/redis/ru The in-memory variants use a sharded lockable map. [Godoc](https://pkg.go.dev/github.com/iamcalledrob/ruerate) +[![Test](https://github.com/iamcalledrob/ruerate/actions/workflows/test.yml/badge.svg)](https://github.com/iamcalledrob/ruerate/actions/workflows/test.yml) ## Features @@ -30,7 +31,7 @@ with occasional bursts. ### Configuration The `tokenbucket.LimiterOpts` struct defines the bucket behavior: -``` +```golang type LimiterOpts struct { RatePerSec float64 // How many tokens are added to the bucket per second Capacity int64 // Maximum tokens the bucket can hold @@ -81,7 +82,7 @@ loops, i.e. with the local in-memory variants. ### Configuration The `backoff.LimiterOpts` struct defines the bucket behavior: -``` +```golang type LimiterOpts struct { BaseWait time.Duration // Minimum wait between attempts MaxWait time.Duration // Maximum "lockout" duration From ea60bc09c88a41446335624b7806110e856f2bce Mon Sep 17 00:00:00 2001 From: Rob Mason Date: Mon, 16 Feb 2026 18:44:48 +0000 Subject: [PATCH 3/4] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 11796ce..ba89dd1 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ Distributed variants built on top of [redis/rueidis](https://github.com/redis/ru The in-memory variants use a sharded lockable map. [Godoc](https://pkg.go.dev/github.com/iamcalledrob/ruerate) + [![Test](https://github.com/iamcalledrob/ruerate/actions/workflows/test.yml/badge.svg)](https://github.com/iamcalledrob/ruerate/actions/workflows/test.yml) From d290ec318a8cbe721d52cc3fb517089d5fa59db6 Mon Sep 17 00:00:00 2001 From: Rob Mason Date: Mon, 16 Feb 2026 18:46:22 +0000 Subject: [PATCH 4/4] Update README.md Add docs badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ba89dd1..d3b9586 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ruelimit implements high-performance rate limiting algorithms with both in-memor Distributed variants built on top of [redis/rueidis](https://github.com/redis/rueidis) with auto-pipelining. The in-memory variants use a sharded lockable map. -[Godoc](https://pkg.go.dev/github.com/iamcalledrob/ruerate) +[![Go Reference](https://pkg.go.dev/badge/github.com/iamcalledrob/ruerate.svg)](https://pkg.go.dev/github.com/iamcalledrob/ruerate) [![Test](https://github.com/iamcalledrob/ruerate/actions/workflows/test.yml/badge.svg)](https://github.com/iamcalledrob/ruerate/actions/workflows/test.yml)