forked from schmunk42/yii2-giiant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
46 lines (41 loc) · 1.08 KB
/
.gitlab-ci.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
37
38
39
40
41
42
43
44
45
46
before_script:
- export BUILD_PREFIX=buildref${CI_BUILD_REF}$(echo ${CI_BUILD_REF_NAME} | tr -dc '[:alnum:]\n\r' | tr '[:upper:]' '[:lower:]')giiant
- export COMPOSE_PROJECT_NAME=${BUILD_PREFIX}
- cd tests
stages:
- build
- test
- report
- cleanup
build:
stage: build
script:
- docker-compose pull
test:
stage: test
script:
- export GIIANT_TEST_DB=sakila
- docker-compose up -d
# workaround (wait for db)
- sleep 10
- docker-compose run phpfpm setup.sh
- set +e
- docker-compose run --rm -e YII_ENV=dev phpfpm bash -c 'codecept run --steps --html=_report.html -g mandatory -g ${GIIANT_TEST_DB} -g onlyCrud cli,unit,acceptance' || TESTS_EXIT_CODE=1
- cp -r _output /tmp/${BUILD_PREFIX}
- set -e
- exit $TESTS_EXIT_CODE
report:
stage: report
script:
- mkdir -p ../reports
- mv /tmp/${BUILD_PREFIX} ../reports/${BUILD_PREFIX}
artifacts:
paths:
- reports
when: always
cleanup:
stage: cleanup
script:
- docker-compose kill && docker-compose rm -fv
- docker-compose down --rmi local --volumes
when: always