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