Skip to content

Commit

Permalink
use docker compose environment
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaspin committed Aug 4, 2023
1 parent 183b3bf commit b30d341
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ blocks:
- name: Unit tests
commands:
- checkout
- sem-version go 1.18
- go install gotest.tools/gotestsum@latest
- make go.get
- make build
- make test
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM golang:1.18

RUN go install gotest.tools/gotestsum@latest

WORKDIR /app
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ check.deps: check.prepare
bash -c 'cd /app && $(SECURITY_TOOLBOX_TMP_DIR)/dependencies --language go -d'

go.get:
go get ./...
docker-compose run --rm cli go get ./...

go.fmt:
go fmt ./...
docker-compose run --rm cli go fmt ./...

test:
gotestsum --format short-verbose --junitfile junit-report.xml --packages="./..." -- -p 1
docker-compose run --rm cli gotestsum --format short-verbose --junitfile junit-report.xml --packages="./..." -- -p 1

build:
env GOOS=$(OS) GOARCH=$(ARCH) go build -o artifact
docker-compose run --rm cli env GOOS=$(OS) GOARCH=$(ARCH) go build -o artifact
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3.6'
services:
cli:
build:
context: .
dockerfile: Dockerfile.dev
tty: true
command: "sleep 0"
container_name: 'artifact-cli'
volumes:
- go-pkg-cache:/go
- .:/app
volumes:
go-pkg-cache:
driver: local

0 comments on commit b30d341

Please sign in to comment.