Skip to content

Commit 73afbb3

Browse files
authored
Merge pull request #58 from hellofresh/patch/gh-actions-pipeline
Run pipeline in GH Actions
2 parents d7956c1 + 5b1d5b6 commit 73afbb3

File tree

6 files changed

+80
-56
lines changed

6 files changed

+80
-56
lines changed

.github/workflows/testing.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Testing
2+
3+
on:
4+
push:
5+
branches: [ v0.3 ]
6+
pull_request:
7+
branches: [ v0.3 ]
8+
9+
jobs:
10+
lint:
11+
name: Lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check out code
15+
uses: actions/checkout@v2
16+
- name: golangci-lint
17+
uses: golangci/golangci-lint-action@v2
18+
19+
test:
20+
name: Test
21+
runs-on: ubuntu-latest
22+
needs: [ lint ]
23+
24+
services:
25+
rabbit:
26+
image: rabbitmq:3.6-management-alpine
27+
ports:
28+
- "5672"
29+
- "15672"
30+
31+
mongo:
32+
image: mongo:3
33+
ports:
34+
- "27017"
35+
36+
steps:
37+
- name: Set up Go
38+
uses: actions/setup-go@v2
39+
- name: Check out code
40+
uses: actions/checkout@v2
41+
- name: Run unit tests
42+
run: go test -cover -coverprofile=coverage.txt -covermode=atomic ./...
43+
- name: Run integration tests
44+
if: success()
45+
run: go run ./cmd/goengine/...
46+
env:
47+
BROKER_DSN: amqp://guest:guest@localhost:${{ job.services.rabbit.ports[5672] }}/
48+
STORAGE_DSN: mongodb://localhost:${{ job.services.mongo.ports[27017] }}/
49+
50+
- name: Upload coverage to Codecov
51+
uses: codecov/codecov-action@v1
52+
if: success()
53+
with:
54+
file: ./coverage.txt
55+
fail_ci_if_error: false

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ _testmain.go
2424
*.test
2525
*.prof
2626
debug
27-
gin-bin
27+
gin-bin
28+
coverage.txt

.golangci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# See https://golangci-lint.run/usage/configuration/#config-file for more information
2+
run:
3+
timeout: 5m
4+
linters:
5+
disable-all: true
6+
enable:
7+
- gofmt
8+
- golint
9+
- goimports
10+
fast: false
11+
linters-settings:
12+
gofmt:
13+
simplify: false
14+
issues:
15+
exclude-use-default: false

.travis.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

Makefile

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,14 @@
11
NO_COLOR=\033[0m
22
OK_COLOR=\033[32;01m
33

4-
PKG_SRC := github.com/hellofresh/goengine
5-
6-
deps:
7-
@echo "$(OK_COLOR)==> Installing test dependencies$(NO_COLOR)"
8-
@go get -u github.com/onsi/ginkgo/ginkgo
9-
@go get -u github.com/onsi/gomega
10-
11-
vet:
12-
@echo "$(OK_COLOR)==> checking code correctness with 'go vet' tool$(NO_COLOR)"
13-
@go vet ./...
14-
15-
lint: tools.golint
16-
@echo "$(OK_COLOR)==> checking code style with 'golint' tool$(NO_COLOR)"
17-
@go list ./... | xargs -n 1 golint -set_exit_status
18-
19-
test-integration: lint vet
4+
test-integration:
205
@echo "$(OK_COLOR)==> Running integration tests$(NO_COLOR)"
21-
@STORAGE_DSN=mongodb://localhost:27017/ BROKER_DSN=amqp://guest:guest@localhost:5672/ go run $(PKG_SRC)/cmd/goengine/...
6+
@STORAGE_DSN=mongodb://localhost:27017/ BROKER_DSN=amqp://guest:guest@localhost:5672/ go run ./cmd/goengine/...
227

23-
test-unit: lint vet
8+
test-unit:
249
@echo "$(OK_COLOR)==> Running unit tests$(NO_COLOR)"
25-
@ginkgo -r
26-
27-
#---------------
28-
#-- tools
29-
#---------------
30-
31-
tools: tools.golint
10+
@go test -cover -coverprofile=coverage.txt -covermode=atomic ./...
3211

33-
tools.golint:
34-
@command -v golint >/dev/null ; if [ $$? -ne 0 ]; then \
35-
echo "--> installing golint"; \
36-
go get golang.org/x/lint/golint; \
37-
fi
12+
lint:
13+
@echo "$(OK_COLOR)==> Linting with golangci-lint$(NO_COLOR)"
14+
@docker run -it --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.39.0 golangci-lint run -v

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ services:
88
- "5672:5672"
99

1010
mongo:
11-
image: mongo
11+
image: mongo:3
1212
ports:
1313
- "27017:27017"

0 commit comments

Comments
 (0)