-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path.gitlab-ci.yml
125 lines (113 loc) · 3.55 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
125
stages:
- build
- test
- deploy
.build-image:
image: docker:27
stage: build
services:
- name: docker:27-dind
command: [ "--tls=false" ]
variables:
HEALTHCHECK_TCP_PORT: "2375"
when: manual
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker compose build $IMAGE_NAME
- IMAGE_ID=$(docker images | grep $DERIVED_IMAGE_NAME | awk '{print $3}')
- docker image tag $IMAGE_ID $CI_REGISTRY_IMAGE/weathergov-$IMAGE_NAME:latest
- docker push $CI_REGISTRY_IMAGE/weathergov-$IMAGE_NAME:latest
build-utility-node-image:
extends: .build-image
variables:
DERIVED_IMAGE_NAME: utility-node
IMAGE_NAME: utility-node
build-drupal-image:
extends: .build-image
variables:
DERIVED_IMAGE_NAME: 18f-zscaler-drupal
IMAGE_NAME: drupal
build-api-proxy-image:
extends: .build-image
variables:
DERIVED_IMAGE_NAME: api-proxy
IMAGE_NAME: api-proxy
build-api-interop-image:
extends: .build-image
variables:
DERIVED_IMAGE_NAME: api-interop-layer
IMAGE_NAME: api-interop-layer
build-playwright-image:
extends: .build-image
variables:
DERIVED_IMAGE_NAME: playwright
IMAGE_NAME: playwright
# docker compose does not actually "build" the database image because there is
# nothing to compose. so, instead, we pull the dependent mysql image and push
# that as a weather.gov image instead
build-database-image:
extends: .build-image
script:
- docker pull mysql:8.0
- IMAGE_ID=$(docker images | grep mysql | awk '{print $3}')
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker image tag $IMAGE_ID $CI_REGISTRY_IMAGE/weathergov-database:latest
- docker push $CI_REGISTRY_IMAGE/weathergov-database:latest
# NB: GitLab clones into CI_BUILDS_DIR which defaults to
# /builds/gitlab-licensed/NWS/Systems/DIS/Weather.gov-2.0/ whereas in our Docker
# images our WORKDIR is /app. so we symlink the various /app/node_modules to
# CI_BUILDS_DIR so we can "npm run" as needed.
js-lint:
stage: test
image: $CI_REGISTRY_IMAGE/weathergov-utility-node:latest
script:
- ln -s /app/node_modules/ .
- ln -s /app/api-interop-layer/node_modules api-interop-layer/
- ln -s /app/tests/api/node_modules tests/api/
- npm run --silent js-lint-report > eslint.xml
artifacts:
when: always
reports:
junit: eslint.xml
style-lint:
stage: test
image: $CI_REGISTRY_IMAGE/weathergov-utility-node:latest
script:
- ln -s /app/node_modules/ .
- npm run --silent style-lint-report 2> stylelint.xml
artifacts:
when: always
reports:
junit: stylelint.xml
php-lint:
stage: test
image: $CI_REGISTRY_IMAGE/weathergov-drupal:latest
script:
- phpcs --report=junit --report-file=phpcs.xml
artifacts:
when: always
reports:
junit: phpcs.xml
js-component-tests:
stage: test
image: $CI_REGISTRY_IMAGE/weathergov-utility-node:latest
script:
- ln -s /app/node_modules/ .
- npm run --silent js-component-tests-report
artifacts:
when: always
reports:
junit: test-results.xml # mocha-junit-reporter writes to this file by default
js-interop-layer-tests:
stage: test
image: $CI_REGISTRY_IMAGE/weathergov-utility-node:latest
script:
- ln -s /app/api-interop-layer/node_modules api-interop-layer/
- cd api-interop-layer/ && npm run --silent test-report
artifacts:
when: always
reports:
junit: api-interop-layer/test-results.xml # mocha-junit-reporter writes to this file by default