Skip to content

Commit b825138

Browse files
committed
👷 Add sample GitLab CI
Signed-off-by: mathieu.brunot <[email protected]>
1 parent 9590856 commit b825138

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

.gitlab-ci.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# see https://docs.gitlab.com/ce/ci/yaml/README.html for all available options
2+
3+
# Docker-in-Docker
4+
image:
5+
name: docker/compose:1.24.1
6+
entrypoint: ["sh", "-c"]
7+
8+
services:
9+
- name: docker:19.03.12-dind
10+
alias: docker
11+
12+
variables:
13+
VARIANT: alpine
14+
DOCKER_REPO: monogramm/vue-symfony-starter
15+
DOCKER_HOST: tcp://docker:2375
16+
DOCKER_DRIVER: overlay2
17+
# This instructs Docker NOT to start over TLS.
18+
DOCKER_TLS_CERTDIR: ""
19+
# This instructs Docker to start over TLS.
20+
#DOCKER_TLS_CERTDIR: "/certs"
21+
22+
# Check docker
23+
before_script:
24+
- pwd
25+
- id
26+
- apk add bash git
27+
- docker --version
28+
- docker-compose --version
29+
- docker info
30+
31+
# Always cleanup after the build
32+
after_script:
33+
- docker images
34+
- docker image prune -f --filter until=$(TZ=EST+24 date +%Y-%m-%d)
35+
36+
# Execute CI build hooks
37+
build-hooks:
38+
stage: build
39+
tags:
40+
- docker
41+
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
42+
script:
43+
# Export variables to tag against GitLab Registry
44+
#- [ -z "${CI_REGISTRY_IMAGE}" ] || export DOCKER_REPO=${$CI_REGISTRY_IMAGE}
45+
- export STORIES=true
46+
- export EXPORT_TESTS_RESULTS=true
47+
- ./hooks/run build "${VARIANT}"
48+
# Save docker image as artifact
49+
- mkdir -p .docker/image
50+
- docker save "${DOCKER_REPO}:${VARIANT}" > .docker/image/app.tar
51+
artifacts:
52+
expire_in: 24 hrs
53+
paths:
54+
- .docker/image
55+
56+
# Execute CI test hooks
57+
test-hooks:
58+
stage: test
59+
tags:
60+
- docker
61+
script:
62+
# Load artifact from build stage
63+
- docker load -i .docker/image/app.tar
64+
- ./hooks/run test "${VARIANT}"
65+
66+
# Publish images
67+
#push-hooks:
68+
# stage: deploy
69+
# tags:
70+
# - docker
71+
# script:
72+
# # Export variables to login and push to GitLab Registry
73+
# - [ -z "${CI_REGISTRY_IMAGE}" ] || export DOCKER_LOGIN=${CI_REGISTRY_USER}
74+
# - [ -z "${CI_REGISTRY_IMAGE}" ] || export DOCKER_PASSWORD=${CI_REGISTRY_PASSWORD}
75+
# - [ -z "${CI_REGISTRY_IMAGE}" ] || export DOCKER_REGISTRY=${CI_REGISTRY}
76+
# # Load artifact from build stage
77+
# - docker load -i .docker/image/app.tar
78+
# - ./hooks/run push
79+
80+
# Publish test results
81+
#push-coverage:
82+
# stage: deploy
83+
# script:
84+
# - echo "TBD"
85+
86+
# Deploy to stage
87+
#staging:
88+
# stage: staging
89+
# script:
90+
# - echo "TBD"
91+
92+
# Deploy to production
93+
#production:
94+
# stage: production
95+
# script:
96+
# - echo "TBD"
97+
# when: manual
98+
# only:
99+
# - master

0 commit comments

Comments
 (0)