Skip to content

Commit

Permalink
Merge branch 'main' into chore/use-docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome committed Aug 16, 2023
2 parents 717cc31 + 91d142e commit 8b2a994
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 22 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@ permissions:
contents: read

jobs:
unit-test:
name: Unit Test
runs-on: ubuntu-22.04
permissions:
contents: read
strategy:
matrix:
go-version: [1.19, 1.20, 1.21]
steps:
- name: Checkout Repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Setup Golang Environment
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ matrix.go-version }}

- name: Run Unit Tests
run: make unit-test
build:
name: Build Client
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -61,7 +80,7 @@ jobs:
- name: Test Client
run: |
docker compose up -d
docker compose logs -f test-nginx test-client test-no-stream
docker compose logs -f test-integration test-integration-no-stream-block
- name: Create/Update Draft
uses: lucacome/draft-release@f6dc37dcdf44be100a649b72c62c628776750190 # v0.2.2
Expand Down
15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
test: test-all clean
test: unit-test test-integration test-integration-no-stream-block clean

lint:
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

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

test-run:
docker compose up -d --build test-nginx test-client
docker compose logs -f test-nginx test-client
test-integration:
docker compose up -d --build test
docker compose logs -f test

test-run-no-stream-block:
test-integration-no-stream-block:
docker compose up -d --build test-no-stream
docker compose logs -f test-no-stream

Expand Down
14 changes: 3 additions & 11 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ services:
extends:
service: nginx

test-nginx:
test:
image: golang:1.21
volumes:
- type: bind
source: ./
target: /go/src/github.com/nginxinc/nginx-plus-go-client
working_dir: /go/src/github.com/nginxinc/nginx-plus-go-client
command: /bin/sh -c "go test -v -shuffle=on -race client/*"
command: go test -v -shuffle=on -race tests/client_test.go
depends_on:
- nginx
- nginx-helper
Expand All @@ -43,17 +43,9 @@ services:
- TEST_API_ENDPOINT_OF_HELPER=http://nginx-helper:8080/api
- TEST_UNAVAILABLE_STREAM_ADDRESS=nginx:8081

test-client:
extends:
service: test-nginx
depends_on:
- nginx
- nginx-helper
command: go test -v -shuffle=on -race tests/client_test.go

test-no-stream:
extends:
service: test-nginx
service: test
command: go test -v -shuffle=on -race tests/client_no_stream_test.go
depends_on:
- nginx-no-stream
Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1.4
FROM debian:bullseye-slim
# syntax=docker/dockerfile:1.5
FROM debian:12-slim

LABEL maintainer="NGINX Docker Maintainers <[email protected]>"

Expand Down

0 comments on commit 8b2a994

Please sign in to comment.