fix workflow

- run test environment
- use start instead of dev to enforce restarts
- migrate database
- log database connection errors
This commit is contained in:
Ulf Gebhardt 2021-10-20 02:55:48 +02:00
parent 0bc8115e0d
commit 089732862c
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD
4 changed files with 20 additions and 3 deletions

View File

@ -381,7 +381,7 @@ jobs:
# UNIT TESTS BACKEND ##################################################### # UNIT TESTS BACKEND #####################################################
########################################################################## ##########################################################################
- name: backend | docker-compose - name: backend | docker-compose
run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mariadb backend run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mariadb database backend
- name: backend Unit tests | test - name: backend Unit tests | test
run: docker-compose exec -T backend yarn test run: docker-compose exec -T backend yarn test
########################################################################## ##########################################################################

View File

@ -73,7 +73,7 @@ RUN yarn run build
FROM build as test FROM build as test
# Run command # Run command
CMD /bin/sh -c "yarn run dev" CMD /bin/sh -c "yarn run start"
################################################################################## ##################################################################################
# PRODUCTION (Does contain only "binary"- and static-files to reduce image size) # # PRODUCTION (Does contain only "binary"- and static-files to reduce image size) #

View File

@ -16,7 +16,10 @@ const connection = async (): Promise<Connection | null> => {
entities: [path.join(__dirname, 'entity', '*.{ts,js}')], entities: [path.join(__dirname, 'entity', '*.{ts,js}')],
synchronize: false, synchronize: false,
}) })
} catch (error) {} } catch (error) {
// eslint-disable-next-line no-console
console.log(error)
}
return con return con
} }

View File

@ -2,6 +2,20 @@ version: "3.4"
services: services:
########################################################
# BACKEND ##############################################
########################################################
backend:
image: gradido/backend:test
build:
target: test
networks:
- external-net
- internal-net
environment:
- NODE_ENV="test"
- DB_HOST=mariadb
######################################################### #########################################################
## MARIADB ############################################## ## MARIADB ##############################################
######################################################### #########################################################