-
Notifications
You must be signed in to change notification settings - Fork 100
53 lines (46 loc) · 1.43 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
name: Test building and running dojo
on: push
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: Install test dependencies
run: pip install pytest pytest-dependency requests
- 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: |
pytest -vrpP ./test || (docker exec dojo-test docker compose logs && false)