File tree 1 file changed +71
-0
lines changed
1 file changed +71
-0
lines changed Original file line number Diff line number Diff line change
1
+ # .gitlab-ci.yml example
2
+ # rename this file and adjust to your needs to enable Gitlab CI
3
+ stages :
4
+ - lint
5
+ - test
6
+
7
+ # cache composer vendor
8
+ cache :
9
+ paths :
10
+ - vendor/
11
+
12
+ # run linter against the openapi specification
13
+ lint-api-spec :
14
+ stage : lint
15
+ interruptible : true
16
+ before_script :
17
+ - make start-docker
18
+ - make node_modules/.bin/spectral
19
+ script :
20
+ - make lint
21
+ after_script :
22
+ - make stop-docker
23
+
24
+ # run generator and make sure no changes are uncommitted
25
+ check-generator-changes :
26
+ stage : lint
27
+ interruptible : true
28
+ before_script :
29
+ - make start-docker
30
+ - echo "Waiting for mariadb to start up..."
31
+ - 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)
32
+ - make run COMMAND="./yii migrate/up --interactive=0"
33
+ script :
34
+ - make run COMMAND="./yii gii/api --interactive=0 --overwrite"
35
+ - git diff --exit-code
36
+ - git status -s && test -z "$(git status -s)"
37
+ after_script :
38
+ - make stop-docker
39
+
40
+ # run tests
41
+ tests :
42
+ stage : test
43
+ before_script :
44
+ - make start-docker
45
+ - echo "Waiting for mariadb to start up..."
46
+ - 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)
47
+ script :
48
+ - make test
49
+ after_script :
50
+ - make stop-docker
51
+ - sudo rm -rf docker/_data/*
52
+ artifacts :
53
+ paths :
54
+ - tests/_output
55
+ exclude :
56
+ - tests/_output/.gitignore
57
+ when : always
58
+ expire_in : 2 week
59
+ reports :
60
+ # make the report available in Gitlab UI. see https://docs.gitlab.com/ee/ci/unit_test_reports.html
61
+ junit :
62
+ - tests/_output/*.xml
63
+
64
+ variables :
65
+ GIT_STRATEGY : fetch
66
+ GIT_SUBMODULE_STRATEGY : recursive
67
+ # solve docker timeout issues
68
+ # https://github.com/docker/compose/issues/4486
69
+ DOCKER_CLIENT_TIMEOUT : 300
70
+ COMPOSE_HTTP_TIMEOUT : 300
71
+
You can’t perform that action at this time.
0 commit comments