Skip to content

Commit dba150b

Browse files
committed
Remove unneeded parts for the unit-tests
1 parent 9435a77 commit dba150b

File tree

1 file changed

+1
-98
lines changed

1 file changed

+1
-98
lines changed

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ jobs:
2222
timeout-minutes: 20
2323
container:
2424
image: domjudge/gitlabci:24.04
25-
options: --privileged --cgroupns=host --init
2625
services:
2726
sqlserver:
2827
image: mariadb
@@ -48,56 +47,8 @@ jobs:
4847
run: pstree -p
4948
- name: Install DOMjudge
5049
run: .github/jobs/baseinstall.sh all
51-
- name: Set up chroot
52-
run: sudo misc-tools/dj_make_chroot -a amd64
5350
- name: Check nginx
5451
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
10152
- name: Get SQL logs
10253
run: docker logs "${{ job.services.sqlserver.id }}"
10354
- name: Collect docker logs on failure
@@ -115,57 +66,9 @@ jobs:
11566
/opt/domjudge/domserver/webapp/var/log/*.log
11667
/tmp/docker-logs
11768
/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
15469
- name: Verify no errors in prod.log
15570
shell: bash
15671
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
15873
exit 1
15974
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

Comments
 (0)