CI: reduce number of jobs in test stage to one job that runs all go tests

This commit is contained in:
Sonja Happ 2020-11-20 09:19:09 +01:00
parent d9175d9432
commit e1b9311686

View file

@ -22,11 +22,10 @@ stages:
- test - test
- deploy - deploy
# Stage: build # Stage: build
############################################################################## ##############################################################################
build:backend: build:
stage: build stage: build
image: ${GO_IMAGE} image: ${GO_IMAGE}
script: script:
@ -42,7 +41,7 @@ build:backend:
# Stage: test # Stage: test
############################################################################## ##############################################################################
test:gotest: test:
stage: test stage: test
image: ${GO_IMAGE} image: ${GO_IMAGE}
variables: variables:
@ -62,75 +61,13 @@ test:gotest:
-coverprofile ./testcover.txt -coverprofile ./testcover.txt
- go tool cover -func=testcover.txt - go tool cover -func=testcover.txt
dependencies: dependencies:
- build:backend - build
test:database:
stage: test
image: ${GO_IMAGE}
variables:
TEST_FOLDER: database
MODE: test
DB_NAME: ${POSTGRES_DB}
DB_HOST: ${POSTGRES_HOST}
DB_USER: ${POSTGRES_USER}
DB_PASS: ${POSTGRES_PASSWORD}
script:
- go mod tidy
- cd ${TEST_FOLDER}
- go test -v
dependencies:
- build:backend
test:scenario:
extends: test:database
variables:
TEST_FOLDER: routes/scenario
test:component-configuration:
extends: test:database
variables:
TEST_FOLDER: routes/component-configuration
test:signal:
extends: test:database
variables:
TEST_FOLDER: routes/signal
test:dashboard:
extends: test:database
variables:
TEST_FOLDER: routes/dashboard
test:widget:
extends: test:database
variables:
TEST_FOLDER: routes/widget
test:infrastructure-component:
extends: test:database
variables:
TEST_FOLDER: routes/infrastructure-component
test:file:
extends: test:database
variables:
TEST_FOLDER: routes/file
test:user:
extends: test:database
variables:
TEST_FOLDER: routes/user
test:healthz:
extends: test:database
variables:
TEST_FOLDER: routes/healthz
# Stage: deploy # Stage: deploy
############################################################################## ##############################################################################
deploy:image: deploy:
stage: deploy stage: deploy
image: image:
name: gcr.io/kaniko-project/executor:debug name: gcr.io/kaniko-project/executor:debug
@ -146,4 +83,4 @@ deploy:image:
--cache=true --cache=true
--cache-ttl=12h --cache-ttl=12h
dependencies: dependencies:
- test:gotest - test