check ci --check

This commit is contained in:
sbriat 2023-02-09 14:20:05 +01:00
parent ee9cf8d64d
commit 0469aa0e87
3 changed files with 42 additions and 16 deletions

View File

@ -2,6 +2,7 @@ image: docker:20.10.22
stages: stages:
- test - test
- build
############## ##############
# TEST STAGE # # TEST STAGE #
@ -15,10 +16,31 @@ test:
services: services:
- docker:dind - docker:dind
script: script:
- docker-compose -f docker-compose.ci.yml --env-file ci/.env.ci up -d - docker-compose -f docker-compose.ci.tools.yml -p auth-tools --env-file ci/.env.ci up -d
- sh ci/wait-up.sh - sh ci/wait-up.sh
- docker-compose -f docker-compose.ci.service.yml -p auth-service --env-file ci/.env.ci up -d
- docker exec -t v3-auth sh -c "npm run test:integration:ci" - docker exec -t v3-auth sh -c "npm run test:integration:ci"
coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/ coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/
rules: rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH || $CI_COMMIT_MESSAGE =~ /--check/ || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH || $CI_COMMIT_MESSAGE =~ /--check/ || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
when: always when: always
###############
# BUILD STAGE #
###############
build:
stage: build
image: docker:20.10.22
variables:
DOCKER_TLS_CERTDIR: ""
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"
only:
- main
when: manual

View File

@ -0,0 +1,19 @@
version: '3.8'
services:
api:
container_name: v3-auth
build:
dockerfile: ci/Dockerfile
context: .
env_file:
- ci/.env.ci
ports:
- 5002:5002
networks:
- v3-network
networks:
v3-network:
name: v3-network
external: true

View File

@ -1,21 +1,6 @@
version: '3.8' version: '3.8'
services: services:
api:
container_name: v3-auth
build:
dockerfile: ci/Dockerfile
context: .
env_file:
- ci/.env.ci
ports:
- 5002:5002
depends_on:
- db
- broker
networks:
- v3-network
db: db:
container_name: v3-auth-db-test container_name: v3-auth-db-test
image: ${POSTGRES_IMAGE} image: ${POSTGRES_IMAGE}