22
22
timeout-minutes : 20
23
23
container :
24
24
image : domjudge/gitlabci:24.04
25
- options : --privileged --cgroupns=host --init
26
25
services :
27
26
sqlserver :
28
27
image : mariadb
48
47
run : pstree -p
49
48
- name : Install DOMjudge
50
49
run : .github/jobs/baseinstall.sh all
51
- - name : Set up chroot
52
- run : sudo misc-tools/dj_make_chroot -a amd64
53
50
- name : Check nginx
54
51
run : curl -v https://localhost/domjudge/
55
- - name : Configure print command
56
- working-directory : submit
57
- run : |
58
- curl --fail -u 'admin:password' -X 'GET' 'http://localhost/domjudge/api/v4/config?strict=false' \
59
- | jq '.print_command |= "cp [file] /tmp/dj-printfile"' \
60
- | curl --fail -u 'admin:password' -X 'PUT' -T - 'http://localhost/domjudge/api/v4/config?strict=false' \
61
- - name : Testing submit client
62
- working-directory : submit
63
- run : make check-full
64
- - name : Configure judgehost
65
- run : sudo cp /opt/domjudge/judgehost/etc/sudoers-domjudge /etc/sudoers.d/ && sudo chmod 400 /etc/sudoers.d/sudoers-domjudge && cat /opt/domjudge/judgehost/etc/sudoers-domjudge
66
- - name : Create user
67
- run : sudo userdel -f -r domjudge-run-0 ; sudo useradd -d /nonexistent -g nogroup -s /bin/false -u 2222 domjudge-run-0
68
- - name : Start judging
69
- run : sudo -u domjudge sh -c 'cd /opt/domjudge/judgehost/ && nohup bin/judgedaemon -n 0 &'
70
- - name : Import Kattis example problems
71
- run : |
72
- cd /tmp
73
- git clone --depth=1 https://github.com/Kattis/problemtools.git
74
- cd problemtools/examples
75
- mv hello hello_kattis
76
- # Remove 2 submissions that will not pass validation. The first is because it is
77
- # a Python 2 submission. The latter has a judgement type we do not understand.
78
- rm different/submissions/accepted/different_py2.py different/submissions/slow_accepted/different_slow.py
79
- for i in hello_kattis different guess; do
80
- (
81
- cd "$i"
82
- zip -r "../${i}.zip" -- *
83
- )
84
- curl --fail -X POST -n -N -F zip=@${i}.zip http://localhost/domjudge/api/contests/demo/problems
85
- done
86
- - name : Monitor judgehost log and stop once all submissions are judged
87
- run : |
88
- tail -f /opt/domjudge/judgehost/log/judge*-0.log | while read line; do
89
- echo "$line"
90
- grep "No submissions in queue" /opt/domjudge/judgehost/log/judge*-0.log && break
91
- done
92
- - name : dump the db
93
- if : ${{ !cancelled() }}
94
- run : mysqldump -uroot -proot domjudge > /tmp/db.sql
95
- - name : Upload database dump for debugging
96
- if : ${{ !cancelled() }}
97
- uses : actions/upload-artifact@v3
98
- with :
99
- name : DB-dump
100
- path : /tmp/db.sql
101
52
- name : Get SQL logs
102
53
run : docker logs "${{ job.services.sqlserver.id }}"
103
54
- name : Collect docker logs on failure
@@ -115,57 +66,9 @@ jobs:
115
66
/opt/domjudge/domserver/webapp/var/log/*.log
116
67
/tmp/docker-logs
117
68
/tmp/artifacts
118
- - name : Verifying submissions
119
- shell : bash
120
- run : |
121
- set -x
122
- export CURLOPTS="--fail -sq -m 30 -b /tmp/cookiejar"
123
- # Make an initial request which will get us a session id, and grab the csrf token from it
124
- CSRFTOKEN=$(curl $CURLOPTS -c /tmp/cookiejar "http://localhost/domjudge/login" | sed -n 's/.*_csrf_token.*value="\(.*\)".*/\1/p')
125
- # Make a second request with our session + csrf token to actually log in
126
- curl $CURLOPTS -c /tmp/cookiejar -F "_csrf_token=$CSRFTOKEN" -F "_username=admin" -F "_password=password" "http://localhost/domjudge/login"
127
- # Send a general clarification to later test if we see the event.
128
- curl $CURLOPTS -F "sendto=" -F "problem=1-" -F "bodytext=Testing" -F "submit=Send" \
129
- "http://localhost/domjudge/jury/clarifications/send" -o /dev/null
130
- curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier?verify_multiple=1" -o /dev/null
131
- NUMNOTVERIFIED=$(curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier" | grep "submissions checked" | sed -r 's/^.* ([0-9]+) submissions checked.*$/\1/')
132
- NUMVERIFIED=$( curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier" | grep "submissions not checked" | sed -r 's/^.* ([0-9]+) submissions not checked.*$/\1/')
133
- NUMNOMAGIC=$( curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier" | grep "without magic string" | sed -r 's/^.* ([0-9]+) without magic string.*$/\1/')
134
- NUMSUBS=$(curl $CURLOPTS http://localhost/domjudge/api/contests/demo/submissions | python3 -mjson.tool | grep -c '"id":')
135
- # We expect
136
- # - two submissions with ambiguous outcome,
137
- # - one submissions submitted through the submit client, and thus the magic string ignored,
138
- # - and all submissions to be judged.
139
- if [ $NUMNOTVERIFIED -ne 2 ] || [ $NUMNOMAGIC -ne 1 ] || [ $NUMSUBS -gt $((NUMVERIFIED+NUMNOTVERIFIED)) ]; then
140
- echo "verified subs: $NUMVERIFIED, unverified subs: $NUMNOTVERIFIED, total subs: $NUMSUBS"
141
- echo "(expected 2 submissions to be unverified, but all to be processed)"
142
- echo "Of these $NUMNOMAGIC do not have the EXPECTED_RESULTS string (should be 1)."
143
- curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier?verify_multiple=1" | w3m -dump -T text/html
144
- exit 1
145
- fi
146
- - name : Finalize contest so that awards appear in the feed
147
- shell : bash
148
- run : |
149
- set -x
150
- export CURLOPTS="--fail -m 30 -b $COOKIEJAR"
151
- curl $CURLOPTS http://localhost/domjudge/jury/contests/1/freeze/doNow || true
152
- curl $CURLOPTS http://localhost/domjudge/jury/contests/1/end/doNow || true
153
- curl $CURLOPTS -X POST -d 'finalize_contest[b]=0&finalize_contest[finalizecomment]=gitlab&finalize_contest[finalize]=' http://localhost/domjudge/jury/contests/1/finalize
154
69
- name : Verify no errors in prod.log
155
70
shell : bash
156
71
run : |
157
- if cat /opt/domjudge/domserver/webapp/var/log/prod .log | egrep '(CRITICAL|ERROR):'; then
72
+ if cat /opt/domjudge/domserver/webapp/var/log/* .log | egrep '(CRITICAL|ERROR):'; then
158
73
exit 1
159
74
fi
160
- - name : Download and perform API check
161
- shell : bash
162
- run : |
163
- cd $HOME
164
- curl -o yajsv https://github.com/neilpa/yajsv/releases/download/v1.4.1/yajsv.linux.amd64
165
- chmod a+x yajsv
166
- echo -e "\033[0m"
167
- git clone https://github.com/icpc/ccs-specs.git
168
- export CCS_SPECS_PINNED_SHA1='a68aff54c4e60fc2bff2fc5c36c119bffa4d30f1'
169
- ( cd ccs-specs && git reset --hard $CCS_SPECS_PINNED_SHA1 )
170
- export CHECK_API="${HOME}/ccs-specs/check-api.sh -j ${HOME}/yajsv"
171
- $CHECK_API -n -C -e -a 'strict=1' http://admin:password@localhost/domjudge/api
0 commit comments