Skip to content

Commit d17f72c

Browse files
committed
Replace travis with github actions
1 parent f8e8b19 commit d17f72c

13 files changed

+241
-87
lines changed

.github/dependabot.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: gomod
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
- package-ecosystem: github-actions
8+
directory: /
9+
schedule:
10+
interval: weekly

.github/workflows/build.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Go
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
build:
11+
name: build
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
go-version: [1.16.x]
16+
17+
services:
18+
redis:
19+
image: redis
20+
options: >-
21+
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
22+
ports:
23+
- 6379:6379
24+
25+
steps:
26+
- name: Set up ${{ matrix.go-version }}
27+
uses: actions/setup-go@v2
28+
29+
- name: Checkout code
30+
uses: actions/checkout@v2
31+
32+
- name: Test
33+
run: go test memqueue

.github/workflows/golangci-lint.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: golangci-lint
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
branches:
8+
- master
9+
- main
10+
pull_request:
11+
12+
jobs:
13+
golangci:
14+
name: lint
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: golangci-lint
19+
uses: golangci/golangci-lint-action@v2

.github/workflows/release.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Releases
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: ncipollo/release-action@v1
14+
with:
15+
body: Check CHANGELOG.md for details

.prettierrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
proseWrap: always
2-
printWidth: 80
2+
printWidth: 100

.travis.yml

-22
This file was deleted.

README.md

+27-37
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,20 @@
66

77
# Golang asynchronous task/job queue with Redis, SQS, IronMQ, and in-memory backends
88

9-
[![Build Status](https://travis-ci.org/vmihailenco/taskq.svg)](https://travis-ci.org/vmihailenco/taskq)
10-
[![GoDoc](https://godoc.org/github.com/vmihailenco/taskq?status.svg)](https://pkg.go.dev/github.com/vmihailenco/taskq/v3?tab=doc)
9+
![build workflow](https://github.com/vmihailenco/taskq/actions/workflows/build.yml/badge.svg)
10+
[![PkgGoDev](https://pkg.go.dev/badge/github.com/vmihailenco/taskq/v3)](https://pkg.go.dev/github.com/vmihailenco/taskq/v3?tab=doc)
1111

1212
## Installation
1313

1414
taskq supports 2 last Go versions and requires a Go version with
15-
[modules](https://github.com/golang/go/wiki/Modules) support. So make sure to
16-
initialize a Go module:
15+
[modules](https://github.com/golang/go/wiki/Modules) support. So make sure to initialize a Go
16+
module:
1717

1818
```shell
1919
go mod init github.com/my/repo
2020
```
2121

22-
And then install taskq/v3 (note _v3_ in the import; omitting it is a popular
23-
mistake):
22+
And then install taskq/v3 (note _v3_ in the import; omitting it is a popular mistake):
2423

2524
```shell
2625
go get github.com/vmihailenco/taskq/v3
@@ -29,16 +28,14 @@ go get github.com/vmihailenco/taskq/v3
2928
## Features
3029

3130
- Redis, SQS, IronMQ, and in-memory backends.
32-
- Automatically scaling number of goroutines used to fetch (fetcher) and process
33-
messages (worker).
31+
- Automatically scaling number of goroutines used to fetch (fetcher) and process messages (worker).
3432
- Global rate limiting.
3533
- Global limit of workers.
3634
- Call once - deduplicating messages with same name.
3735
- Automatic retries with exponential backoffs.
3836
- Automatic pausing when all messages in queue fail.
3937
- Fallback handler for processing failed messages.
40-
- Message batching. It is used in SQS and IronMQ backends to add/delete messages
41-
in batches.
38+
- Message batching. It is used in SQS and IronMQ backends to add/delete messages in batches.
4239
- Automatic message compression using snappy / s2.
4340

4441
## Quickstart
@@ -54,8 +51,8 @@ This way you can:
5451
- Scale API and worker separately.
5552
- Have different configs for API and worker (like timeouts).
5653

57-
There is an [api_worker example](example/api_worker) that demonstrates this
58-
approach using Redis as a backend:
54+
There is an [api_worker example](example/api_worker) that demonstrates this approach using Redis as
55+
a backend:
5956

6057
```bash
6158
cd example/api_worker
@@ -166,33 +163,28 @@ for i := 0; i < 100; i++ {
166163

167164
## Message deduplication
168165

169-
If a `Message` has a `Name` then this will be used as unique identifier and
170-
messages with the same name will be deduplicated (i.e. not processed again)
171-
within a 24 hour period (or possibly longer if not evicted from local cache
172-
after that period). Where `Name` is omitted then non deduplication occurs and
173-
each message will be processed. `Task`'s `WithMessage` and `WithArgs` both
174-
produces messages with no `Name` so will not be deduplicated. `OnceWithArgs`
175-
sets a name based off a consistent hash of the arguments and a quantised period
176-
of time (i.e. 'this hour', 'today') passed to `OnceWithArgs` a `period`. This
177-
guarantees that the same function will not be called with the same arguments
178-
during `period'.
166+
If a `Message` has a `Name` then this will be used as unique identifier and messages with the same
167+
name will be deduplicated (i.e. not processed again) within a 24 hour period (or possibly longer if
168+
not evicted from local cache after that period). Where `Name` is omitted then non deduplication
169+
occurs and each message will be processed. `Task`'s `WithMessage` and `WithArgs` both produces
170+
messages with no `Name` so will not be deduplicated. `OnceWithArgs` sets a name based off a
171+
consistent hash of the arguments and a quantised period of time (i.e. 'this hour', 'today') passed
172+
to `OnceWithArgs` a `period`. This guarantees that the same function will not be called with the
173+
same arguments during `period'.
179174

180175
## Handlers
181176

182-
A `Handler` and `FallbackHandler` are supplied to `RegisterTask` in the
183-
`TaskOptions`.
177+
A `Handler` and `FallbackHandler` are supplied to `RegisterTask` in the `TaskOptions`.
184178

185179
There are three permitted types of signature:
186180

187181
1. A zero-argument function
188-
2. A function whose arguments are assignable in type from those which are passed
189-
in the message
182+
2. A function whose arguments are assignable in type from those which are passed in the message
190183
3. A function which takes a single `*Message` argument
191184

192-
If a task is registered with a handler that takes a Go `context.Context` as its
193-
first argument then when that handler is invoked it will be passed the same
194-
`Context` that was passed to `Consumer.Start(ctx)`. This can be used to transmit
195-
a signal to abort to all tasks being processed:
185+
If a task is registered with a handler that takes a Go `context.Context` as its first argument then
186+
when that handler is invoked it will be passed the same `Context` that was passed to
187+
`Consumer.Start(ctx)`. This can be used to transmit a signal to abort to all tasks being processed:
196188

197189
```go
198190
var AbortableTask = MainQueue.RegisterTask(&taskq.TaskOptions{
@@ -214,8 +206,8 @@ var AbortableTask = MainQueue.RegisterTask(&taskq.TaskOptions{
214206

215207
## Custom message delay
216208

217-
If error returned by handler implements `Delay() time.Duration` interface then
218-
that delay is used to postpone message processing.
209+
If error returned by handler implements `Delay() time.Duration` interface then that delay is used to
210+
postpone message processing.
219211

220212
```go
221213
type RateLimitError string
@@ -235,9 +227,8 @@ func handler() error {
235227

236228
## Tracing
237229

238-
taskq supports tracing out-of-the-box using
239-
[OpenTelemetry](https://opentelemetry.io/) API. To instrument a queue, use the
240-
following code:
230+
taskq supports tracing out-of-the-box using [OpenTelemetry](https://opentelemetry.io/) API. To
231+
instrument a queue, use the following code:
241232

242233
```go
243234
import "github.com/vmihailenco/taskq/extra/taskqotel/v3"
@@ -257,5 +248,4 @@ factory.Range(func(q taskq.Queue) bool {
257248
})
258249
```
259250

260-
We recommend using [Uptrace.dev](https://github.com/uptrace/uptrace-go) as a
261-
tracing backend.
251+
We recommend using [Uptrace.dev](https://github.com/uptrace/uptrace-go) as a tracing backend.

RELEASING.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Releasing
2+
3+
1. Run `release.sh` script which updates versions in go.mod files and pushes a new branch to GitHub:
4+
5+
```shell
6+
TAG=v1.0.0 ./scripts/release.sh
7+
```
8+
9+
2. Open a pull request and wait for the build to finish.
10+
11+
3. Merge the pull request and run `tag.sh` to create tags for packages:
12+
13+
```shell
14+
TAG=v1.0.0 ./scripts/tag.sh
15+
```

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ require (
99
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13
1010
github.com/go-redis/redis/v8 v8.11.2
1111
github.com/go-redis/redis_rate/v9 v9.1.1
12-
github.com/go-redis/redis/v8 v8.11.2
1312
github.com/golang/protobuf v1.4.3 // indirect
1413
github.com/google/uuid v1.1.2
1514
github.com/hashicorp/golang-lru v0.5.4
1615
github.com/iron-io/iron_go3 v0.0.0-20190916120531-a4a7f74b73ac
1716
github.com/jeffh/go.bdd v0.0.0-20120717032931-88f798ee0c74 // indirect
1817
github.com/klauspost/compress v1.12.2
18+
github.com/kr/pretty v0.2.1 // indirect
1919
github.com/onsi/ginkgo v1.15.0
2020
github.com/onsi/gomega v1.10.5
2121
github.com/satori/go.uuid v1.2.0

0 commit comments

Comments
 (0)