test ci --check
This commit is contained in:
parent
802e5f7f0a
commit
e0d7306560
|
@ -1,15 +1,14 @@
|
||||||
image: docker:20.10.22
|
image: docker:20.10.22
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- test:unit
|
- test
|
||||||
- test:integration
|
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# TEST STAGE #
|
# TEST STAGE #
|
||||||
##############
|
##############
|
||||||
|
|
||||||
unit-test:
|
unit-test:
|
||||||
stage: test:unit
|
stage: test
|
||||||
image: node:18-alpine3.16
|
image: node:18-alpine3.16
|
||||||
script:
|
script:
|
||||||
- npm install
|
- npm install
|
||||||
|
@ -19,7 +18,7 @@ unit-test:
|
||||||
when: always
|
when: always
|
||||||
|
|
||||||
integration-test:
|
integration-test:
|
||||||
stage: test:integration
|
stage: test
|
||||||
image: docker/compose:latest
|
image: docker/compose:latest
|
||||||
variables:
|
variables:
|
||||||
DOCKER_TLS_CERTDIR: ""
|
DOCKER_TLS_CERTDIR: ""
|
||||||
|
@ -29,7 +28,7 @@ integration-test:
|
||||||
- docker-compose -f docker-compose.ci.yml --env-file ci/.env.ci up -d
|
- docker-compose -f docker-compose.ci.yml --env-file ci/.env.ci up -d
|
||||||
- sleep 30
|
- sleep 30
|
||||||
- docker-compose -f docker-compose.ci.yml --env-file ci/.env.ci logs
|
- docker-compose -f docker-compose.ci.yml --env-file ci/.env.ci logs
|
||||||
- docker exec -t v3-user sh -c "npm run test:integration"
|
- docker exec -t v3-user sh -c "npm run test:integration:ci"
|
||||||
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
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
|
# SERVICE
|
||||||
|
SERVICE_URL=0.0.0.0
|
||||||
|
SERVICE_PORT=5001
|
||||||
|
|
||||||
# PRISMA
|
# PRISMA
|
||||||
DATABASE_URL="postgresql://user:user@v3-user-db-test:5432/user?schema=public"
|
DATABASE_URL="postgresql://user:user@db:5432/user?schema=public"
|
||||||
|
|
||||||
# RABBIT MQ
|
# RABBIT MQ
|
||||||
RMQ_URI=amqp://v3-broker:5672
|
RMQ_URI=amqp://broker:5672
|
||||||
|
|
||||||
# MESSAGE BROKER
|
# MESSAGE BROKER
|
||||||
BROKER_IMAGE=rabbitmq:3-alpine
|
BROKER_IMAGE=rabbitmq:3-alpine
|
||||||
|
|
|
@ -11,14 +11,12 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- 5001:5001
|
- 5001:5001
|
||||||
depends_on:
|
depends_on:
|
||||||
- db-test
|
- db
|
||||||
- broker
|
- broker
|
||||||
networks:
|
networks:
|
||||||
v3-network:
|
- v3-network
|
||||||
aliases:
|
|
||||||
- v3-user-api
|
|
||||||
|
|
||||||
db-test:
|
db:
|
||||||
container_name: v3-user-db-test
|
container_name: v3-user-db-test
|
||||||
image: ${POSTGRES_IMAGE}
|
image: ${POSTGRES_IMAGE}
|
||||||
environment:
|
environment:
|
||||||
|
@ -28,9 +26,7 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- 5601:5432
|
- 5601:5432
|
||||||
networks:
|
networks:
|
||||||
v3-network:
|
- v3-network
|
||||||
aliases:
|
|
||||||
- v3-user-db-test
|
|
||||||
|
|
||||||
broker:
|
broker:
|
||||||
container_name: v3-broker
|
container_name: v3-broker
|
||||||
|
@ -38,11 +34,8 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- 5672:5672
|
- 5672:5672
|
||||||
networks:
|
networks:
|
||||||
v3-network:
|
- v3-network
|
||||||
aliases:
|
|
||||||
- v3-broker
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
v3-network:
|
v3-network:
|
||||||
name: v3-network
|
name: v3-network
|
||||||
driver: bridge
|
|
||||||
|
|
13
package.json
13
package.json
|
@ -14,14 +14,15 @@
|
||||||
"start:debug": "nest start --debug --watch",
|
"start:debug": "nest start --debug --watch",
|
||||||
"start:prod": "node dist/main",
|
"start:prod": "node dist/main",
|
||||||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||||
"test": "npm run migrate-test && dotenv -e .env.test jest",
|
"test": "npm run migrate:test && dotenv -e .env.test jest",
|
||||||
"test:ci": "docker ps && dotenv -e ci/.env.ci -- npx prisma migrate deploy --name postgres-init && dotenv -e ci/.env.ci jest",
|
"test:unit": "jest --testPathPattern 'tests/unit/' --verbose",
|
||||||
"test:unit": "jest --testPathIgnorePatterns 'integration' --verbose",
|
"test:integration": "npm run migrate:test && dotenv -e .env.test -- jest --testPathPattern 'tests/integration/' --verbose",
|
||||||
"test:integration": "npm run migrate-test && dotenv -e .env.test -- jest --testPathPattern 'integration' --verbose",
|
"test:integration:ci": "npm run migrate:test:ci && dotenv -e ci/.env.ci -- jest --testPathPattern 'tests/integration/' --verbose",
|
||||||
"test:cov": "npm run migrate-test && dotenv -e .env.test -- jest --coverage",
|
"test:cov": "npm run migrate:test && dotenv -e .env.test -- jest --coverage",
|
||||||
"test:e2e": "jest --config ./test/jest-e2e.json",
|
"test:e2e": "jest --config ./test/jest-e2e.json",
|
||||||
"migrate": "docker exec v3-user sh -c 'npx prisma migrate dev'",
|
"migrate": "docker exec v3-user sh -c 'npx prisma migrate dev'",
|
||||||
"migrate-test": "dotenv -e .env.test -- npx prisma migrate deploy"
|
"migrate:test": "dotenv -e .env.test -- npx prisma migrate deploy",
|
||||||
|
"migrate:test:ci": "dotenv -e ci/.env.ci -- npx prisma migrate deploy"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@automapper/classes": "^8.7.7",
|
"@automapper/classes": "^8.7.7",
|
||||||
|
|
Loading…
Reference in New Issue