forked from pwncollege/dojo
-
Notifications
You must be signed in to change notification settings - Fork 29
58 lines (49 loc) · 1.57 KB
/
test.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
name: Test building and running dojo
on: [push, pull_request]
jobs:
smoketest:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
with:
tags: dojo-test
load: true
# cache-from: type=gha
# cache-to: type=gha,mode=max
- uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: Prepare Firefox
uses: browser-actions/setup-firefox@latest
- name: Install test dependencies
run: pip install pytest pytest-dependency requests selenium
- name: Run dojo
run: |
docker run \
--privileged \
-d \
-v ./dojo-test-data:/opt/pwn.college/data:shared \
-p 2222:22 -p 80:80 -p 443:443 \
--name dojo-test \
dojo-test
- name: Wait for services to build and start
run: |
docker exec dojo-test dojo wait
- name: Wait for services to be ready
timeout-minutes: 2
run: |
docker exec dojo-test dojo compose logs -f &
log_pid=$!
until [[ "$(docker exec dojo-test docker inspect --format='{{.State.Health.Status}}' ctfd)" == "healthy" ]]; do
sleep 1
done
kill $log_pid
exit 0
- name: Run tests against dojo
run: |
export MOZ_HEADLESS=1
pytest -vrpP ./test || (docker exec dojo-test docker compose logs && false)