Skip to content

Commit 8b2a994

Browse files
committed
Merge branch 'main' into chore/use-docker-compose
2 parents 717cc31 + 91d142e commit 8b2a994

File tree

4 files changed

+32
-22
lines changed

4 files changed

+32
-22
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@ permissions:
2424
contents: read
2525

2626
jobs:
27+
unit-test:
28+
name: Unit Test
29+
runs-on: ubuntu-22.04
30+
permissions:
31+
contents: read
32+
strategy:
33+
matrix:
34+
go-version: [1.19, 1.20, 1.21]
35+
steps:
36+
- name: Checkout Repository
37+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
38+
39+
- name: Setup Golang Environment
40+
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
41+
with:
42+
go-version: ${{ matrix.go-version }}
43+
44+
- name: Run Unit Tests
45+
run: make unit-test
2746
build:
2847
name: Build Client
2948
runs-on: ubuntu-22.04
@@ -61,7 +80,7 @@ jobs:
6180
- name: Test Client
6281
run: |
6382
docker compose up -d
64-
docker compose logs -f test-nginx test-client test-no-stream
83+
docker compose logs -f test-integration test-integration-no-stream-block
6584
6685
- name: Create/Update Draft
6786
uses: lucacome/draft-release@f6dc37dcdf44be100a649b72c62c628776750190 # v0.2.2

Makefile

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
test: test-all clean
1+
test: unit-test test-integration test-integration-no-stream-block clean
22

33
lint:
44
docker run --pull always --rm -v $(shell pwd):/nginx-plus-go-client -w /nginx-plus-go-client -v $(shell go env GOCACHE):/cache/go -e GOCACHE=/cache/go -e GOLANGCI_LINT_CACHE=/cache/go -v $(shell go env GOPATH)/pkg:/go/pkg golangci/golangci-lint:latest golangci-lint --color always run
55

6-
test-all:
7-
docker compose up -d --build
8-
docker compose logs -f test-nginx test-client test-no-stream
6+
unit-test:
7+
go test -v -shuffle=on -race client/*.go
98

10-
test-run:
11-
docker compose up -d --build test-nginx test-client
12-
docker compose logs -f test-nginx test-client
9+
test-integration:
10+
docker compose up -d --build test
11+
docker compose logs -f test
1312

14-
test-run-no-stream-block:
13+
test-integration-no-stream-block:
1514
docker compose up -d --build test-no-stream
1615
docker compose logs -f test-no-stream
1716

compose.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ services:
2727
extends:
2828
service: nginx
2929

30-
test-nginx:
30+
test:
3131
image: golang:1.21
3232
volumes:
3333
- type: bind
3434
source: ./
3535
target: /go/src/github.com/nginxinc/nginx-plus-go-client
3636
working_dir: /go/src/github.com/nginxinc/nginx-plus-go-client
37-
command: /bin/sh -c "go test -v -shuffle=on -race client/*"
37+
command: go test -v -shuffle=on -race tests/client_test.go
3838
depends_on:
3939
- nginx
4040
- nginx-helper
@@ -43,17 +43,9 @@ services:
4343
- TEST_API_ENDPOINT_OF_HELPER=http://nginx-helper:8080/api
4444
- TEST_UNAVAILABLE_STREAM_ADDRESS=nginx:8081
4545

46-
test-client:
47-
extends:
48-
service: test-nginx
49-
depends_on:
50-
- nginx
51-
- nginx-helper
52-
command: go test -v -shuffle=on -race tests/client_test.go
53-
5446
test-no-stream:
5547
extends:
56-
service: test-nginx
48+
service: test
5749
command: go test -v -shuffle=on -race tests/client_no_stream_test.go
5850
depends_on:
5951
- nginx-no-stream

docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# syntax=docker/dockerfile:1.4
2-
FROM debian:bullseye-slim
1+
# syntax=docker/dockerfile:1.5
2+
FROM debian:12-slim
33

44
LABEL maintainer="NGINX Docker Maintainers <integrations@nginx.com>"
55

0 commit comments

Comments
 (0)