-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
105 lines (81 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
stages:
- build
- deploy
variables:
GIT_SUBMODULE_STRATEGY: recursive
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375
DOCKER_PIPELINE_IMAGE_NAME: "$CI_REGISTRY_IMAGE/pipeline:$CI_PIPELINE_ID"
test:
stage: build
image: registry.gitlab.com/tozd/docker/meteor-testing:ubuntu-focal-1.11.1
variables:
TXT_SECTION: "\\e[34;1m"
TXT_CLEAR: "\\e[0m"
script:
- echo -e "section_start:`date +%s`:install\r\e[0K${TXT_SECTION}Install${TXT_CLEAR}"
- meteor npm ci
- meteor list
- mkdir tests/reports
- echo -e "section_end:`date +%s`:install\r\e[0K"
- echo -e "section_start:`date +%s`:lint\r\e[0K${TXT_SECTION}Lint${TXT_CLEAR}"
- meteor npm run lint-ci
- echo -e "section_end:`date +%s`:lint\r\e[0K"
- echo -e "section_start:`date +%s`:test\r\e[0K${TXT_SECTION}Test${TXT_CLEAR}"
- meteor npm run test-ci
- echo -e "section_end:`date +%s`:test\r\e[0K"
- echo -e "section_start:`date +%s`:cypress\r\e[0K${TXT_SECTION}Cypress${TXT_CLEAR}"
- meteor npm run cypress-ci
- echo -e "section_end:`date +%s`:cypress\r\e[0K"
artifacts:
name: "artifacts-$CI_PIPELINE_ID"
when: always
paths:
- tests/reports
- tests/cypress/videos
- tests/cypress/screenshots
reports:
junit: tests/reports/*.xml
build_image:
stage: build
image: docker:19
services:
- docker:19-dind
before_script:
- docker info
- echo "$CI_JOB_TOKEN" | docker login --username gitlab-ci-token --password-stdin "$CI_REGISTRY"
script:
- docker build --pull -t "$DOCKER_PIPELINE_IMAGE_NAME" .
- docker push "$DOCKER_PIPELINE_IMAGE_NAME"
check_authors:
stage: build
image: alpine:3
script:
- apk add --no-cache git bash
- ./.authors/check-authors.sh
# Check that there are no merge marks in commits.
check_commits:
stage: build
image: alpine:3
variables:
GIT_DEPTH: "0"
script:
- apk add --no-cache git
- '! git log --oneline "-G^(<<<<<<<|=======|>>>>>>>)" | grep "^"'
push_image:
stage: deploy
image: docker:19
services:
- docker:19-dind
before_script:
- docker info
- echo "$CI_JOB_TOKEN" | docker login --username gitlab-ci-token --password-stdin "$CI_REGISTRY"
script:
# TODO: Improve so that pulling is not necessary. See: https://gitlab.com/gitlab-org/gitlab/-/issues/15252
- docker pull "$DOCKER_PIPELINE_IMAGE_NAME"
- docker tag "$DOCKER_PIPELINE_IMAGE_NAME" "$CI_REGISTRY_IMAGE/branch/$CI_COMMIT_REF_SLUG:latest"
- docker tag "$DOCKER_PIPELINE_IMAGE_NAME" "$CI_REGISTRY_IMAGE/branch/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA"
- docker push "$CI_REGISTRY_IMAGE/branch/$CI_COMMIT_REF_SLUG:latest"
- docker push "$CI_REGISTRY_IMAGE/branch/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA"
rules:
- if: $CI_COMMIT_BRANCH