-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
138 lines (129 loc) · 3.46 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
126
127
128
129
130
131
132
133
134
135
136
137
138
stages:
- build
- test
- deploy
- verify
.build:
stage: build
script:
- apk add nodejs npm python3 make g++ git curl
# only checkout the submodules under lib, because MRs don't have access to private
- git submodule sync lib
- git submodule update --init lib
- haxe install-haxelibs.hxml
- npm install --unsafe-perm
- haxelib list
- haxe build.hxml
- haxe build-test.hxml
artifacts:
paths:
- www/js/BrowserMain.js
- www/js/BrowserMain.js.map
- www/js/vendor.js
- ServerMain.js
- ServerMain.js.map
- test/SeleniumTest.py
- test/Spellcheck.js
- node_modules
build-haxe4:
extends: .build
image: haxe:4.1.5-alpine3.12
test-spellcheck:
image: node:12-alpine
dependencies:
- build-haxe4
stage: test
script:
- node test/Spellcheck.js
.test-selenium:
image: alpine:3.12
variables:
MYSQL_ROOT_PASSWORD: devroot
MYSQL_DATABASE: giffon
DB_HOST: mysql
DB_USER: root
DB_PASSWORD: $MYSQL_ROOT_PASSWORD
script:
- apk add nodejs npm mariadb-client mariadb-connector-c openjdk8-jre python3 python3-dev py3-pip openssl gcc libc-dev linux-headers
# initialize mysql
- mysql -h mysql -u root --password="$MYSQL_ROOT_PASSWORD" "$MYSQL_DATABASE" -e "source dev/initdb/00_root_pw.sql"
- mysql -h mysql -u root --password="$MYSQL_ROOT_PASSWORD" "$MYSQL_DATABASE" -e "source dev/initdb/01_giffon.sql"
- mysql -h mysql -u root --password="$MYSQL_ROOT_PASSWORD" "$MYSQL_DATABASE" -e "source dev/initdb/02_giffon.sql"
# figure out host container ip
- cat /etc/hosts
- export WEB_HOST="$(cat /etc/hosts | grep -Eo '^([0-9\.]*)\s+runner-.+-project-.+-concurrent-.+' | grep -Eo '^([0-9\.]*)')"
- echo "${WEB_HOST}"
# generate self-signed cert for https
- cd dev/ssl
- ./gen.sh "${WEB_HOST}"
- cd ../..
# test (validation)
- npm start &
- sleep 3 # allow displaying some server init messages
- pip3 install html5validator==0.3.3
- html5validator --html http://localhost:3000
- html5validator --css www/css/*.css
- html5validator --svg --errors-only www/images/*.svg
# test (selenium)
- pip3 install -r src/test/requirements.txt
- python3 test/SeleniumTest.py
artifacts:
when: always
paths:
- test/errorShots
test-haxe4-chrome:
extends: .test-selenium
dependencies:
- build-haxe4
stage: test
services:
- mysql:8.0
- selenium/standalone-chrome:3.141.59-radium
variables:
BROWSER_NAME: chrome
HUB_HOST: selenium-standalone-chrome
except:
- merge_requests
deploy-s3:
stage: deploy
dependencies:
- build-haxe4
image: python:alpine
script:
- pip install awscli
- aws s3 sync --delete www "s3://static.giffon.io/${CI_COMMIT_REF_NAME}"
only:
- master
- production
except:
- tags
- schedules
- merge_requests
deploy-serverless:
stage: deploy
dependencies:
- build-haxe4
image: node:12-alpine
script:
- npx serverless deploy --stage "${CI_COMMIT_REF_NAME}"
only:
- master
- production
except:
- tags
- schedules
- merge_requests
verify-master:
stage: verify
image: giffon/giffon_devcontainer:20211130055449
script:
- curl -sSLf -o /dev/null https://master.giffon.io?nocache=$RANDOM
only:
- master
verify-production:
stage: verify
image: giffon/giffon_devcontainer:20211130055449
script:
- curl -sSLf -o /dev/null https://giffon.io?nocache=$RANDOM
only:
- production