start ci --check
This commit is contained in:
parent
f665fff491
commit
84e7a8e915
|
@ -7,6 +7,7 @@ DATABASE_URL="postgresql://user:user@localhost:5601/user?schema=public"
|
|||
|
||||
# RABBIT MQ
|
||||
RMQ_URI=amqp://v3-broker:5672
|
||||
BROKER_IMAGE=rabbitmq:3-management
|
||||
|
||||
# POSTGRES
|
||||
POSTGRES_IMAGE=postgres:15.0
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
image: docker:20.10.22
|
||||
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
- production
|
||||
|
||||
##############
|
||||
# TEST STAGE #
|
||||
##############
|
||||
|
||||
# Dev test
|
||||
test-api-dev:
|
||||
stage: test
|
||||
image: docker/compose:latest
|
||||
variables:
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
services:
|
||||
- docker:dind
|
||||
script:
|
||||
- docker-compose -f docker-compose.ci.yml up -d
|
||||
- sh ci/wait-up.sh
|
||||
- docker-compose -f docker-compose.ci.yml logs
|
||||
- docker exec -t v3-user sh -c "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
|
|
@ -0,0 +1,23 @@
|
|||
###################
|
||||
# BUILD FOR LOCAL DEVELOPMENT
|
||||
###################
|
||||
|
||||
FROM node:18-alpine3.16
|
||||
|
||||
# Create app directory
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# A wildcard is used to ensure both package.json AND package-lock.json are copied
|
||||
COPY package*.json ./
|
||||
|
||||
# Install app dependencies
|
||||
RUN npm ci
|
||||
|
||||
# Bundle app source
|
||||
COPY . .
|
||||
|
||||
# Creates a "dist" folder
|
||||
RUN npm run build
|
||||
|
||||
# Start the server
|
||||
CMD [ "node", "dist/main.js" ]
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
while ! docker logs v3-user --tail=1 | grep -q "Nest application successfully started";
|
||||
do
|
||||
sleep 5
|
||||
echo "Waiting for Nest to be up..."
|
||||
done
|
|
@ -0,0 +1,29 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
api:
|
||||
container_name: v3-user
|
||||
build:
|
||||
dockerfile: ci/Dockerfile
|
||||
context: .
|
||||
env_file:
|
||||
- .env.test
|
||||
ports:
|
||||
- 5001:5001
|
||||
|
||||
db-test:
|
||||
container_name: v3-user-db-test
|
||||
image: ${POSTGRES_IMAGE}
|
||||
environment:
|
||||
POSTGRES_DB: user
|
||||
POSTGRES_USER: user
|
||||
POSTGRES_PASSWORD: user
|
||||
ports:
|
||||
- 5601:5432
|
||||
|
||||
broker:
|
||||
container_name: v3-broker
|
||||
image: ${BROKER_IMAGE}
|
||||
ports:
|
||||
- 5672:5672
|
||||
- 15672:15672
|
File diff suppressed because it is too large
Load Diff
17
package.json
17
package.json
|
@ -19,7 +19,7 @@
|
|||
"test:integration": "npm run migrate-test && 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-auth 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"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -35,11 +35,18 @@
|
|||
"@nestjs/cqrs": "^9.0.1",
|
||||
"@nestjs/microservices": "^9.2.1",
|
||||
"@nestjs/platform-express": "^9.0.0",
|
||||
"@types/node": "^16.0.0",
|
||||
"@prisma/client": "^4.7.1",
|
||||
"@types/supertest": "^2.0.11",
|
||||
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
||||
"@typescript-eslint/parser": "^5.0.0",
|
||||
"dotenv-cli": "^6.0.0",
|
||||
"dotenv-cli": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/cli": "^9.0.0",
|
||||
"@nestjs/schematics": "^9.0.0",
|
||||
"@nestjs/testing": "^9.0.0",
|
||||
"@types/jest": "^29.2.5",
|
||||
"@types/node": "^18.11.18",
|
||||
"eslint": "^8.0.1",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
|
@ -50,9 +57,9 @@
|
|||
"supertest": "^6.1.3",
|
||||
"ts-jest": "28.0.8",
|
||||
"ts-loader": "^9.2.3",
|
||||
"ts-node": "^10.0.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"tsconfig-paths": "4.1.0",
|
||||
"typescript": "^4.7.4"
|
||||
"typescript": "^4.9.4"
|
||||
},
|
||||
"jest": {
|
||||
"moduleFileExtensions": [
|
||||
|
|
Loading…
Reference in New Issue