feat(ci): add test task
This commit is contained in:
parent
a52d13e1a0
commit
8044542044
3 changed files with 59 additions and 17 deletions
|
@ -15,3 +15,7 @@ jobs:
|
||||||
- task: lint
|
- task: lint
|
||||||
file: nurse.git/.concourse/tasks/lint.yml
|
file: nurse.git/.concourse/tasks/lint.yml
|
||||||
input_mapping: {repo: nurse.git}
|
input_mapping: {repo: nurse.git}
|
||||||
|
- task: test
|
||||||
|
file: nurse.git/.concourse/tasks/test.yml
|
||||||
|
privileged: true
|
||||||
|
input_mapping: {repo: nurse.git}
|
|
@ -4,7 +4,7 @@ platform: linux
|
||||||
image_resource:
|
image_resource:
|
||||||
type: registry-image
|
type: registry-image
|
||||||
source:
|
source:
|
||||||
repository: docker.io/golang:1.19-bullseye
|
repository: docker.io/golangci/golangci-lint
|
||||||
tag: latest
|
tag: latest
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
|
@ -15,13 +15,10 @@ params:
|
||||||
GO111MODULE: "on"
|
GO111MODULE: "on"
|
||||||
CGO_ENABLED: "0"
|
CGO_ENABLED: "0"
|
||||||
GITEA_TOKEN: ((gitea-credentials.token))
|
GITEA_TOKEN: ((gitea-credentials.token))
|
||||||
DOCKER_HOST: tcp://127.0.0.1:2375
|
|
||||||
|
|
||||||
run:
|
run:
|
||||||
path: sh
|
path: bash
|
||||||
args:
|
args:
|
||||||
- -ce
|
- -ce
|
||||||
- |
|
- |
|
||||||
apk add -U --no-cache curl
|
|
||||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin
|
|
||||||
go run github.com/magefile/mage lint
|
go run github.com/magefile/mage lint
|
||||||
|
|
41
.concourse/tasks/test.yml
Normal file
41
.concourse/tasks/test.yml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
---
|
||||||
|
platform: linux
|
||||||
|
|
||||||
|
image_resource:
|
||||||
|
type: registry-image
|
||||||
|
source:
|
||||||
|
repository: code.icb4dc0.de/prskr/pipelines/dind-go
|
||||||
|
tag: latest
|
||||||
|
username: ((gitea-credentials.user))
|
||||||
|
password: ((gitea-credentials.token))
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
- name: repo
|
||||||
|
path: .
|
||||||
|
|
||||||
|
params:
|
||||||
|
GO111MODULE: "on"
|
||||||
|
CGO_ENABLED: "1"
|
||||||
|
DOCKER_HOST: tcp://127.0.0.1:2375
|
||||||
|
GITEA_TOKEN: ((gitea-credentials.token))
|
||||||
|
|
||||||
|
run:
|
||||||
|
path: bash
|
||||||
|
args:
|
||||||
|
- -ce
|
||||||
|
- |
|
||||||
|
dockerd -H $DOCKER_HOST >/tmp/docker.log 2>&1 &
|
||||||
|
echo $! > /tmp/docker.pid
|
||||||
|
|
||||||
|
go install gotest.tools/gotestsum@latest
|
||||||
|
|
||||||
|
echo waiting for docker to come up...
|
||||||
|
until docker info >/dev/null 2>&1; do
|
||||||
|
sleep 1
|
||||||
|
if ! kill -0 "$(cat /tmp/docker.pid)" 2>/dev/null; then
|
||||||
|
cat /tmp/docker.log
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
gotestsum -f pkgname-and-test-fails -- -race -shuffle=on ./...
|
Loading…
Reference in a new issue