Skip to content

Commit 5a0a4a4

Browse files
authored
Merge pull request #1 from golang-queue/github
chore(CI): Add github actions
2 parents 187ba96 + 1c43cf9 commit 5a0a4a4

File tree

3 files changed

+78
-6
lines changed

3 files changed

+78
-6
lines changed

.github/workflows/lint.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Run CI Lint
2+
on: push
3+
4+
jobs:
5+
test:
6+
strategy:
7+
matrix:
8+
os: [ubuntu-latest, macos-latest]
9+
go: [1.16, 1.17]
10+
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
11+
runs-on: ${{ matrix.os }}
12+
13+
env:
14+
GO111MODULE: on
15+
TESTTAGS: ${{ matrix.test-tags }}
16+
GOPROXY: https://proxy.golang.org
17+
steps:
18+
- name: Set up Go ${{ matrix.go }}
19+
uses: actions/setup-go@v2
20+
with:
21+
go-version: ${{ matrix.go }}
22+
23+
- name: Checkout Code
24+
uses: actions/checkout@v2
25+
with:
26+
ref: ${{ github.ref }}
27+
28+
- name: golangci-lint
29+
uses: golangci/golangci-lint-action@v2
30+
with:
31+
version: v1.42.0

.github/workflows/testing.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Run Testing
2+
on: push
3+
4+
jobs:
5+
# Label of the container job
6+
runner-job:
7+
# You must use a Linux environment when using service containers or container jobs
8+
runs-on: ubuntu-latest
9+
10+
# Service containers to run with `container-job`
11+
services:
12+
# Label used to access the service container
13+
redis:
14+
# Docker Hub image
15+
image: redis
16+
# Set health checks to wait until redis has started
17+
options: >-
18+
--health-cmd "redis-cli ping"
19+
--health-interval 10s
20+
--health-timeout 5s
21+
--health-retries 5
22+
ports:
23+
- 6379:6379
24+
25+
env:
26+
GO111MODULE: on
27+
GOPROXY: https://proxy.golang.org
28+
steps:
29+
- name: Set up Go ${{ matrix.go }}
30+
uses: actions/setup-go@v2
31+
32+
- name: Checkout Code
33+
uses: actions/checkout@v2
34+
with:
35+
ref: ${{ github.ref }}
36+
37+
- name: Run Tests
38+
run: |
39+
go test -v -covermode=atomic -coverprofile=coverage.out .
40+
41+
- name: Upload coverage to Codecov
42+
uses: codecov/codecov-action@v1

redis.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ type Worker struct {
3030
channel string
3131
channelSize int
3232

33-
stopOnce sync.Once
34-
stop chan struct{}
35-
runFunc func(context.Context, queue.QueuedMessage) error
36-
logger queue.Logger
37-
stopFlag int32
38-
startFlag int32
33+
stopOnce sync.Once
34+
stop chan struct{}
35+
runFunc func(context.Context, queue.QueuedMessage) error
36+
logger queue.Logger
37+
stopFlag int32
3938
}
4039

4140
// WithAddr setup the addr of NSQ

0 commit comments

Comments
 (0)