-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.dist.yml
186 lines (170 loc) · 4.06 KB
/
Taskfile.dist.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
version: 3
env:
PORT: 3060
tasks:
test-all:
deps:
- test-frontend
- test-backend
- test-integration
serve-frontend:
dir: frontend
env:
BUILD_GIT_SHA:
sh: git rev-parse HEAD
cmds:
- node build.mjs serve
deps:
- deps-frontend
- all-parsers
build-frontend:
dir: frontend
env:
BUILD_GIT_SHA:
sh: git rev-parse HEAD
cmds:
- node build.mjs build
deps:
- deps-frontend
- all-parsers
test-frontend:
dir: frontend
cmds:
- yarn run jest --coverage
deps:
- deps-frontend
- all-parsers
all-parsers:
dir: frontend
sources:
- src/grammars/*.grammar
generates:
- src/parsers/*.js
deps:
- deps-frontend
cmds:
- mkdir -p src/parsers
- |
for grammar in src/grammars/*.grammar; do
yarn run lezer-generator "$grammar" -o "src/parsers/$(basename "$grammar" .grammar).js"
done
deps-frontend:
dir: frontend
run: once
sources:
- package.json
generates:
- yarn.lock
- node_modules/sentinel
cmds:
- yarn install $(if [[ -n ${CI-} ]]; then echo --frozen-lockfile; fi)
- touch node_modules/sentinel
serve-backend:
dir: backend
env:
PORT: 3061
PYTHONPATH: .
cmds:
- venv/bin/python -m app
deps:
- deps-backend
test-backend:
dir: backend
env:
PORT: 10001
PYTHONPATH: .
cmds:
- venv/bin/python -m app &
- defer: pkill python
- |
while ! lsof -iTCP:$PORT -sTCP:LISTEN -n -P >/dev/null ; do
sleep 0.2
done
- venv/bin/pytest
deps:
- deps-test-backend
deps-test-backend:
dir: backend
run: once
sources:
- requirements-test.txt
generates:
- venv/sentinel-test
cmds:
- venv/bin/python -m pip install -r requirements-test.txt
- touch venv/sentinel-test
deps:
- deps-backend
deps-backend:
dir: backend
run: once
sources:
- requirements.in
generates:
- requirements.txt
- venv/sentinel
cmds:
- python3 -m venv --prompt littletools venv
- venv/bin/python -m pip install --upgrade pip pip-tools
# Don't do pip-compile on CI, and just install from requirements.txt instead.
- venv/bin/pip-compile --resolver=backtracking requirements.in > requirements.txt
- venv/bin/python -m pip install -r requirements.txt
- touch venv/sentinel
fmt:
dir: backend
cmds:
- venv/bin/python -m black . ../scripts
deps:
- deps-backend
test-integration:
summary: >
Run the Playwright UI integration tests.
dir: intests
env:
KEYCLOAK_PORT: 7200
deps:
- deps-intests
cmds:
- |
# todo: switch to host network here?
docker run -d \
--publish "$KEYCLOAK_PORT:8080" \
--env KEYCLOAK_ADMIN=admin \
--env KEYCLOAK_ADMIN_PASSWORD=admin \
--add-host host.docker.internal:host-gateway \
--add-host littletools.local:host-gateway \
--name keycloak \
quay.io/keycloak/keycloak:20.0.3 \
start-dev --log-level=DEBUG
- defer: docker rm -f keycloak
- |
if [[ -n ${CI-} ]]; then
yarn run playwright install --with-deps chromium
fi
- |
echo Wait for Keycloak to start...
while ! curl --silent --fail "http://localhost:$KEYCLOAK_PORT/" > /dev/null; do
sleep 1
done
echo Keycloak is up!
- yarn run playwright test
- |
if [[ -z ${CI-} ]]; then
yarn run playwright show-report
fi
deps-intests:
dir: intests
sources:
- package.json
generates:
- yarn.lock
- node_modules/sentinel
cmds:
- yarn install
- touch node_modules/sentinel
intests-gen:
summary: >
Start the Playwright test generator and recorder. See <https://playwright.dev/docs/codegen>.
dir: intests
cmds:
- yarn run playwright codegen localhost:$PORT