-
Notifications
You must be signed in to change notification settings - Fork 16
/
.gitlab-ci.yml
124 lines (110 loc) · 2.21 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
variables:
NODE_VERSION: "12"
FOO: "initial foo"
BAR: "initial bar"
BAZ: "initial baz"
image: node:lts-alpine3.12
cache: &global_cache
key: ${CI_COMMIT_REF_SLUG}
#untracked: true
policy: pull
paths:
- node_modules
stages:
- pre-prepare
- prepare
- test
# - build
# - deploy
# - schedule
include:
- local: "/ci/prepare.yml"
# - local: '/ci/test.yml'
# - local: '/ci/schedule.yml'
# - local: '/ci/build.yml'
# - local: '/ci/deploy.yml'
.example-template:
image:
name: alpine
before_script:
- "echo 'Example template before...'"
variables:
FOO: "foo"
BAR: "bar"
.other-template:
before_script:
- "echo 'Other template before...'"
after_script:
- "echo 'Other template after...'"
variables:
FOO: "overriden foo"
job-extends:
stage: pre-prepare
extends:
- .example-template
- .other-template
before_script:
- "echo 'Job before...'"
script: echo "Hello World"
variables:
BAR: "overriden bar"
BAZ: "baz"
private-image-job:
image: maximedubourg/glci-private-repo:latest
script:
- date
pre:
stage: pre-prepare
cache:
#<<: *global_cache
policy: pull-push
untracked: true
before_script:
- whoami
script:
- mkdir -p node_modules/lodash
- touch node_modules/lodash/index.js
- touch foo.txt
- mkdir -p bar && touch bar/bar.txt
artifacts:
untracked: true
paths:
- package.json
pre-test:
stage: prepare
script:
- touch pretestfile.txt
artifacts:
paths:
- pretestfile.txt
test:cacheworks:
stage: test
script:
- ls -lA node_modules/lodash/*
- test -f foo.txt && echo "foo.txt exists."
- test -f bar/bar.txt && echo "foo.txt exists."
dependencies:
- pre
test:artifactswork:
stage: test
script:
- test -f foo.txt && echo "foo.txt exists."
- test -f bar/bar.txt && echo "foo.txt exists."
- test -f pretestfile.txt && echo "pretestfile.txt exists."
test:unit:
stage: test
before_script:
- echo "Yay before script !"
script:
- ls node_modules
after_script:
- echo "Yay after script !"
dependencies:
- install
failingjob:
stage: test
script:
- echo 1
- echo 2
- node -e "process.exit(1);"
- echo 3