new ci --check
This commit is contained in:
parent
8e5e29cb02
commit
202f714941
|
@ -1,27 +1,36 @@
|
|||
image: docker:20.10.22
|
||||
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
- production
|
||||
- test:unit
|
||||
- test:integration
|
||||
|
||||
##############
|
||||
# TEST STAGE #
|
||||
##############
|
||||
|
||||
# Dev test
|
||||
test-api-dev:
|
||||
stage: test
|
||||
image: docker/compose:latest
|
||||
variables:
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
services:
|
||||
- docker:dind
|
||||
unit-test-api:
|
||||
stage: test:unit
|
||||
image: node:18-alpine3.16
|
||||
script:
|
||||
- docker-compose -f docker-compose.ci.yml --env-file ci/.env.ci up -d
|
||||
- sleep 30
|
||||
- docker-compose -f docker-compose.ci.yml --env-file ci/.env.ci logs
|
||||
- docker exec -t v3-user sh -c "npm run test:integration"
|
||||
- npm install
|
||||
- npm run test
|
||||
rules:
|
||||
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH || $CI_COMMIT_MESSAGE =~ /--check/ || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||
when: always
|
||||
|
||||
# test-api-dev:
|
||||
# stage: test
|
||||
# image: docker/compose:latest
|
||||
# variables:
|
||||
# DOCKER_TLS_CERTDIR: ""
|
||||
# services:
|
||||
# - docker:dind
|
||||
# script:
|
||||
# - docker-compose -f docker-compose.ci.yml --env-file ci/.env.ci up -d
|
||||
# - sleep 30
|
||||
# - docker exec -t v3-user sh -c "npm run test:integration"
|
||||
# - docker-compose -f docker-compose.ci.yml --env-file ci/.env.ci logs
|
||||
# - docker exec -t v3-user sh -c "npm run test:integration"
|
||||
# rules:
|
||||
# - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH || $CI_COMMIT_MESSAGE =~ /--check/ || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||
# when: always
|
||||
|
|
|
@ -19,11 +19,8 @@ COPY . .
|
|||
# Creates a "dist" folder
|
||||
RUN npm run build
|
||||
|
||||
# Execute prisma migration
|
||||
RUN npm run migrate-test-ci
|
||||
|
||||
# Execute unit tests
|
||||
RUN npm run test:unit
|
||||
|
||||
# Start the server using the production build
|
||||
CMD [ "node", "dist/main.js" ]
|
||||
# CMD [ "node", "dist/main.js" ]
|
||||
|
|
10
package.json
10
package.json
|
@ -2,7 +2,7 @@
|
|||
"name": "mobicoop-v3-user",
|
||||
"version": "0.0.1",
|
||||
"description": "Mobicoop V3 User Service",
|
||||
"author": "Mobicoop",
|
||||
"author": "sbriat",
|
||||
"private": true,
|
||||
"license": "AGPL",
|
||||
"scripts": {
|
||||
|
@ -15,14 +15,12 @@
|
|||
"start:prod": "node dist/main",
|
||||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||
"test": "npm run migrate-test && dotenv -e .env.test jest",
|
||||
"test:ci": "docker ps && npm run migrate-test-ci && dotenv -e ci/.env.ci 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 --testPathIgnorePatterns 'integration' --verbose",
|
||||
"test:integration": "npm run migrate-test && dotenv -e .env.test -- jest --testPathPattern 'integration' --verbose",
|
||||
"test:integration": "dotenv -e .env.test -- npx prisma migrate dev --name postgres-init && dotenv -e .env.test -- jest --testPathPattern 'integration' --verbose",
|
||||
"test:cov": "npm run migrate-test && dotenv -e .env.test -- jest --coverage",
|
||||
"test:e2e": "jest --config ./test/jest-e2e.json",
|
||||
"migrate": "docker exec v3-user sh -c 'npx prisma migrate dev'",
|
||||
"migrate-test": "dotenv -e .env.test -- npx prisma migrate dev --name postgres-init",
|
||||
"migrate-test-ci": "dotenv -e ci/.env.ci -- npx prisma migrate dev --name postgres-init"
|
||||
"migrate": "docker exec v3-user sh -c 'npx prisma migrate dev'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@automapper/classes": "^8.7.7",
|
||||
|
|
Loading…
Reference in New Issue