-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path.gitlab-ci.dist.yml
71 lines (65 loc) · 2.04 KB
/
.gitlab-ci.dist.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# .gitlab-ci.yml example
# rename this file and adjust to your needs to enable Gitlab CI
stages:
- lint
- test
# cache composer vendor
cache:
paths:
- vendor/
# run linter against the openapi specification
lint-api-spec:
stage: lint
interruptible: true
before_script:
- make start-docker
- make node_modules/.bin/spectral
script:
- make lint
after_script:
- make stop-docker
# run generator and make sure no changes are uncommitted
check-generator-changes:
stage: lint
interruptible: true
before_script:
- make start-docker
- echo "Waiting for mariadb to start up..."
- docker-compose exec -T backend-php timeout 60s sh -c "while ! (mysql -uapi_test -papisecret -h db-test --execute 'SELECT 1;' > /dev/null 2>&1); do echo -n '.'; sleep 0.1 ; done; echo 'ok'" || (docker-compose ps; docker-compose logs; exit 1)
- make run COMMAND="./yii migrate/up --interactive=0"
script:
- make run COMMAND="./yii gii/api --interactive=0 --overwrite"
- git diff --exit-code
- git status -s && test -z "$(git status -s)"
after_script:
- make stop-docker
# run tests
tests:
stage: test
before_script:
- make start-docker
- echo "Waiting for mariadb to start up..."
- docker-compose exec -T backend-php timeout 60s sh -c "while ! (mysql -uapi_test -papisecret -h db-test --execute 'SELECT 1;' > /dev/null 2>&1); do echo -n '.'; sleep 0.1 ; done; echo 'ok'" || (docker-compose ps; docker-compose logs; exit 1)
script:
- make test
after_script:
- make stop-docker
- sudo rm -rf docker/_data/*
artifacts:
paths:
- tests/_output
exclude:
- tests/_output/.gitignore
when: always
expire_in: 2 week
reports:
# make the report available in Gitlab UI. see https://docs.gitlab.com/ee/ci/unit_test_reports.html
junit:
- tests/_output/*.xml
variables:
GIT_STRATEGY: fetch
GIT_SUBMODULE_STRATEGY: recursive
# solve docker timeout issues
# https://github.com/docker/compose/issues/4486
DOCKER_CLIENT_TIMEOUT: 300
COMPOSE_HTTP_TIMEOUT: 300