forked from jobtome-labs/ci-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-unit.yml
36 lines (33 loc) · 958 Bytes
/
test-unit.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
test:unit:
extends: .docker
stage: test
script:
- |
# DOCKER LOGIN PHASE
echo -n "${CI_REGISTRY_PASSWORD}" | docker login -u "${CI_REGISTRY_USER}" --password-stdin "${CI_REGISTRY}"
- |
# CHECK IF TEST DOCKER COMPOSE FILE EXISTS
if [ -z "${TEST_CONTAINER_NAME}" ]; then
TEST_CONTAINER_NAME="app"
fi
if [ -z "${COMPOSE_FILE_NAME}" ]; then
COMPOSE_FILE_NAME="docker-compose.test.yml"
fi
if [ ! -f "${COMPOSE_FILE_NAME}" ]; then
echo
echo "${COMPOSE_FILE_NAME} not found!"
echo
exit 1
fi
- |
# TEST
docker-compose -f "${COMPOSE_FILE_NAME}" pull
docker-compose -f "${COMPOSE_FILE_NAME}" up --remove-orphans --abort-on-container-exit --exit-code-from "${TEST_CONTAINER_NAME}"
only:
- /^v.+$/i
- master
- merge_requests
except:
variables:
- $SKIP_CI_TEST == "true"
- $CI_FAST_TRACK == "true"