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