forked from mendersoftware/gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
121 lines (112 loc) · 2.75 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
image: docker:git
stages:
- test
- build
- e2e-test
- publish
before_script:
- export DOCKER_REPOSITORY="mendersoftware/gui"
- export DOCKER_TAG=${CI_COMMIT_REF_NAME/master}
- export NODE_ENV=$(echo "$DOCKER_TAG" | grep -Eq '^(staging|production)$' && echo "production" || echo "development")
- export SERVICE_ENV=$(echo "$DOCKER_TAG" | grep -Eq '^(development|staging|production)$' && echo $DOCKER_TAG || echo "development")
- export SERVICE_IMAGE=$DOCKER_REPOSITORY:$DOCKER_TAG
build:master:
stage: build
services:
- docker:dind
script:
- echo "building gui for ${SERVICE_IMAGE}"
- docker build
--pull
-t $SERVICE_IMAGE
-t $DOCKER_REPOSITORY:$COMMIT_TAG
.
- docker save $SERVICE_IMAGE > image.tar
only:
- master
artifacts:
expire_in: 2w
paths:
- image.tar
tags:
- docker
build:
stage: build
services:
- docker:dind
except:
- master
script:
- echo "building gui for ${SERVICE_IMAGE}"
- docker build
-t $SERVICE_IMAGE
-t $DOCKER_REPOSITORY:$CI_COMMIT_REF_SLUG
.
- docker save $SERVICE_IMAGE > image.tar
artifacts:
expire_in: 2w
paths:
- image.tar
tags:
- docker
test:static:
stage: test
before_script:
- apk add --no-cache bash
# Rename the branch we're on, so that it's not in the way for the
# subsequent fetch. It's ok if this fails, it just means we're not on any
# branch.
- git branch -m temp-branch || true
# Git trick: Fetch directly into our local branches instead of remote
# branches.
- git fetch origin 'refs/heads/*:refs/heads/*'
# Get last remaining tags, if any.
- git fetch --tags origin
- git clone http://github.com/mendersoftware/mendertesting
script:
- mendertesting/check_commits.sh
test:lint:
stage: test
image: node
script:
- npm ci
- npm run lint
except:
- master
test:acceptance:
image: tiangolo/docker-with-compose
dependencies:
- build
services:
- docker:18-dind
stage: e2e-test
script:
- docker load -i image.tar
- docker tag $SERVICE_IMAGE $DOCKER_REPOSITORY:pr
- apk add git bash
- git clone https://github.com/mendersoftware/integration.git
- cp -r integration/tests/* tests
- GUI_REPOSITORY=$(pwd) INTEGRATION_PATH=$(pwd)/integration ./tests/e2e_tests/run
tags:
- mender-qa-slave
test:unit:
image: node:11.6.0-alpine
stage: test
script:
- npm install
- npm run test
publish:
stage: publish
services:
- docker:dind
dependencies:
- test:lint
- test:acceptance
script:
- docker load -i image.tar
# - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
# - docker push $CI_REGISTRY_IMAGE
only:
- master
tags:
- docker