new ci --check
This commit is contained in:
parent
8e5e29cb02
commit
202f714941
|
@ -1,27 +1,36 @@
|
||||||
image: docker:20.10.22
|
image: docker:20.10.22
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build
|
- test:unit
|
||||||
- test
|
- test:integration
|
||||||
- production
|
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# TEST STAGE #
|
# TEST STAGE #
|
||||||
##############
|
##############
|
||||||
|
|
||||||
# Dev test
|
unit-test-api:
|
||||||
test-api-dev:
|
stage: test:unit
|
||||||
stage: test
|
image: node:18-alpine3.16
|
||||||
image: docker/compose:latest
|
|
||||||
variables:
|
|
||||||
DOCKER_TLS_CERTDIR: ""
|
|
||||||
services:
|
|
||||||
- docker:dind
|
|
||||||
script:
|
script:
|
||||||
- docker-compose -f docker-compose.ci.yml --env-file ci/.env.ci up -d
|
- npm install
|
||||||
- sleep 30
|
- npm run test
|
||||||
- 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:
|
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
|
||||||
|
|
||||||
|
# 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
|
# Creates a "dist" folder
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Execute prisma migration
|
|
||||||
RUN npm run migrate-test-ci
|
|
||||||
|
|
||||||
# Execute unit tests
|
# Execute unit tests
|
||||||
RUN npm run test:unit
|
RUN npm run test:unit
|
||||||
|
|
||||||
# Start the server using the production build
|
# 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",
|
"name": "mobicoop-v3-user",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "Mobicoop V3 User Service",
|
"description": "Mobicoop V3 User Service",
|
||||||
"author": "Mobicoop",
|
"author": "sbriat",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "AGPL",
|
"license": "AGPL",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -15,14 +15,12 @@
|
||||||
"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 && 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: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: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 dev --name postgres-init",
|
|
||||||
"migrate-test-ci": "dotenv -e ci/.env.ci -- npx prisma migrate dev --name postgres-init"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@automapper/classes": "^8.7.7",
|
"@automapper/classes": "^8.7.7",
|
||||||
|
|
Loading…
Reference in New Issue