Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial code for a mobile friendly scoreboard. #2447

Open
wants to merge 212 commits into
base: wfluxor
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
212 commits
Select commit Hold shift + click to select a range
6a8d012
Add scoreboard alias for consistency
vmcj Apr 6, 2024
3814a5e
Mask the teams in the ICPC online mirror mode API
vmcj Apr 6, 2024
95cb5e8
Fix marking the team output as truncated.
meisterT Mar 23, 2024
57766e7
Make TLE detection for interactive problems more robust.
meisterT Mar 17, 2024
7b242cd
Add documentation and long option
eldering Apr 3, 2024
93f05c3
Address review comments.
meisterT Apr 7, 2024
c46eb28
Disable refresh on internal error page.
meisterT Apr 8, 2024
9e81389
Make code more readable.
meisterT Apr 8, 2024
9fe44b6
Only set expected results during problem import.
meisterT Apr 8, 2024
d88b317
Sort language list
eldering Apr 14, 2024
b5d995e
Add kt as alias for kotlin in ACE editor
eldering Apr 14, 2024
fc38b9e
Add missing closing tr HTML element
eldering Apr 15, 2024
3264818
Add option to start/freeze/unfreeze/... on the contest page
meisterT Mar 24, 2024
01bcbcc
Sort affiliations by name (as displayed) in the self-registration form
eldering Apr 15, 2024
b4c28a3
Default to yes on banner import if the file exists.
meisterT Apr 15, 2024
2407572
Fix finding missing keys in configuration values that are dicts
eldering Apr 15, 2024
09210e4
Update SVG and PNG DOMjudge logos
eldering Apr 15, 2024
c978c62
dont use uuid as shortname
mzuenni Apr 16, 2024
66e0a6a
Only interpret the log record as printf-style if context is a list
eldering Apr 16, 2024
f4095e6
Fix logic for downloading scoreboard zip witbh unfrozen data.
nickygerritsen Apr 17, 2024
9f44e13
Lazy load team pictures
Kevinjil Apr 18, 2024
d81e039
Add judgehost hostname to error message and sync with other code
Apr 17, 2024
a485000
Ignore gauges we don't know
Apr 17, 2024
abf80fa
Fix updating freeze and end time from event-feed
Kevinjil Apr 16, 2024
b9d9431
Ignore additional bronze medals in public scoreboard until unfreeze
Apr 15, 2024
f467913
Add a route including external contest ID
Kevinjil Apr 15, 2024
583d21d
Add button to print clarifications.
meisterT Apr 15, 2024
2bde645
Do not update state when contest is paused.
nickygerritsen Apr 15, 2024
b75260c
Ignore TLS protocol error.
Kevinjil Apr 15, 2024
4401424
Ignore the `map-info` event in the event feed
Kevinjil Apr 14, 2024
e8cc04d
Change countdownPauseTime to type to match specs
Kevinjil Apr 14, 2024
72da661
Warn when problem/language is disabled on submission page.
meisterT Apr 13, 2024
c133c01
Show unjudgeable reasons also when judging has no final verdict yet.
meisterT Apr 13, 2024
de40776
Do not include submissions in rejudging if problem/language are not a…
meisterT Apr 13, 2024
466ee4a
Add a warning for disabled problem/langs on the rejudging page as well.
meisterT Apr 13, 2024
984f3ed
Add check for disabled langs/probs to config checker.
meisterT Apr 13, 2024
2897cb0
Fix missing events in the feed due to out of order commits
Apr 16, 2024
f863f37
Show final scoreboard when downloading jury scoreboard zip.
nickygerritsen Apr 23, 2024
2b36335
Use bundle to correctly handle CORS for API.
nickygerritsen Apr 23, 2024
625f837
Target PHP8.3 for the current main branch
vmcj Apr 28, 2024
af075a3
Set errno to zero before strto* function calls
wx-csy Apr 22, 2024
76221ae
Use new images for the team manual.
nickygerritsen Apr 30, 2024
57abaeb
Fix submit tests on updated CI.
meisterT May 1, 2024
0574694
Fix viewForContestExternalIdAction implementation
Kevinjil Apr 30, 2024
634c2b3
Add rank to first to solve and region winners in results HTML.
nickygerritsen Apr 23, 2024
718d082
Make rank column appear after team for both FTS and region winners.
nickygerritsen Apr 29, 2024
527fa94
Make Gitlab CI compatible with MySQL 8.4
Kevinjil May 1, 2024
88cd2f6
Catch errors when adding problems YAML.
nickygerritsen Apr 23, 2024
5591569
Update webapp/src/Service/ImportExportService.php
nickygerritsen Apr 23, 2024
32125e7
Unify exceptions into one.
nickygerritsen Apr 29, 2024
2b19b81
Use two different variables for error tracking so the logic is more c…
nickygerritsen Apr 29, 2024
2792e67
PHPversion is upgraded in the GitlabCI image
vmcj Apr 29, 2024
8968400
Use the ubuntu default version for PHP testing
vmcj May 4, 2024
20d66ed
Improve error message on inconsistent ZIP files.
meisterT May 4, 2024
632d31a
Rename function for clarity
vmcj Apr 27, 2024
d82014f
Test debian/testing again for autoconf checks
vmcj Apr 27, 2024
60ab2c5
Update ChangeLog
vmcj Mar 23, 2024
1c2b424
Add compiler version commands for C#, Rust, and Scala to DefaultData/…
mpsijm May 9, 2024
cb9e1a7
Skip parts of the integration tests that rely on v1.
meisterT May 11, 2024
124ebba
Improve display of test case run times.
meisterT May 11, 2024
65bea9f
Simplify judgehost and judging time line.
meisterT May 11, 2024
316c10d
Fix `printHosts` for a single host.
meisterT May 11, 2024
3d55513
Set compilation metadata also for compiler errors.
meisterT May 12, 2024
63a8779
Make judgedaemon service shut down gracefully
Apr 15, 2024
48578e5
Use latest checkout action
vmcj May 11, 2024
cdc6603
Run syntax scripts for Rscripts
vmcj May 12, 2024
1f33e3c
R needs a TMPDIR during running of the submission
vmcj May 12, 2024
d9c9044
Add test to verify that TMPDIR has no (known) security implications
vmcj May 13, 2024
9cea18e
Simplify test case run display.
meisterT May 11, 2024
34afe4e
Remove check of ONLINE_JUDGE & DOMJUDGE in example submissions
vmcj May 8, 2024
0060dba
Set default value as not all invocations use 2 arguments
vmcj May 14, 2024
754d456
Fix swift language
vmcj May 14, 2024
9c57fe6
Allow to add user when editing a team without user
nickygerritsen May 21, 2024
3c95e36
Version in the compose file is deprecated.
nickygerritsen May 21, 2024
4c3b579
Fix typo in prolog compile script
vmcj May 24, 2024
82b8686
Allow to import/export medals with contest.yaml
nickygerritsen May 24, 2024
f740f73
Composer2 can be installed again in our images
vmcj May 25, 2024
ac60eca
Fix progress display of rejudgings that apply automatically.
meisterT May 25, 2024
8719be1
Refactor code to allow splitting the creation of judgetasks and queue…
meisterT May 25, 2024
e3bc681
Fix wording on results page.
meisterT May 26, 2024
5b3413a
Add keyboard shortcuts.
meisterT May 13, 2024
14c5e00
Allow jury to access the export pages, such as printed clarifications.
meisterT May 27, 2024
94c0329
Display failing URL in E2E crawling test
vmcj May 15, 2024
2ead148
Add edit button on versions page
vmcj May 14, 2024
3c1979d
Add `|` as indication between samples and secret cases.
meisterT May 27, 2024
f47ff24
Add option to disable keyboard shortcuts.
meisterT May 27, 2024
5311c96
Make problem badges a bit wider by default so they have the same size.
nickygerritsen May 25, 2024
07e7ec5
Validate entities when importing JSON/TSV files through the API
nickygerritsen May 26, 2024
0219d8e
Select shortname from current contestproblem
vmcj May 27, 2024
dcb690a
#2537 Give flags a ring-shadow, to make the white parts visible
mpsijm May 28, 2024
21a217e
Remove empty dir.
meisterT May 30, 2024
4f4e475
Remove dangling judgetasks first
vmcj May 28, 2024
b62fe65
Release DOMjudge 8.3
vmcj May 19, 2024
0de9b9c
Start development of DOMjudge 8.4.0
vmcj May 31, 2024
778e2ed
Cleanup TMPDIR between testcases
vmcj May 13, 2024
cb45cd9
Document how to get GHC to work
vmcj May 14, 2024
a546e78
Add version commands and installation instructions for chroot in manual
vmcj May 10, 2024
6782afc
Add migration to upgrade version commands when unset
vmcj May 11, 2024
9974cec
Don't set the empty string as we display it on the scoreboard
vmcj May 10, 2024
63cde5b
Remove configure option for cgroup location
vmcj Jun 1, 2024
c5988a0
When you log in to the main DOMjudge, allow to use the API with the s…
nickygerritsen May 25, 2024
e1f78ca
Revert "Don't set the empty string as we display it on the scoreboard"
vmcj Jun 1, 2024
6df01fe
Conditionally set WWW-Authenticate header for AJAX requests
jimmyhealer Apr 30, 2024
7cb1de8
Highlight pending submissions during freeze on jury scoreboard
meisterT May 30, 2024
ee1a145
Consistently use lowercase hex colors in webapp/public/style_*.css
mpsijm Jun 7, 2024
3d3d641
Change exception as this is allowed to be retried
vmcj Jun 7, 2024
6862840
Refer to correct field to prevent HTTP500
vmcj Jun 7, 2024
b73f61a
Always use external ID in API
nickygerritsen May 21, 2024
904d642
Test code for PHP8.3 compatibility
vmcj Jun 8, 2024
be07dc3
Disable (broken) Mayhem tests
vmcj Jun 9, 2024
476f3b4
Make runguard a C++ program.
meisterT Feb 23, 2024
7b1b816
Remove unnecessary macros for a C++ file.
meisterT Feb 23, 2024
6678098
Use C++ specific include statements.
meisterT Feb 23, 2024
29227a4
Use nullptr instead of NULL.
meisterT Feb 23, 2024
29a07ec
strlen returns size_t
meisterT Feb 23, 2024
6991125
Remove unused vars.
meisterT Feb 23, 2024
1473f05
Move variables definitions close to their usage.
meisterT Feb 24, 2024
bbdfa25
Update judge/runguard.cc
meisterT Feb 25, 2024
016e81d
For submissions and clarifications, prefix external ID in shadow mode
nickygerritsen Jun 11, 2024
34f62be
Implement syntax check for AWK
vmcj May 19, 2024
3002fb3
Implement syntax check for javascript
vmcj May 19, 2024
a585991
fix: time_limit type in ProblemEvent Object
Dup4 Jun 16, 2024
6b28c39
Decrease running time of phpstan job
vmcj Jun 14, 2024
d5716a3
Remove default documentation section for Debian 10
vmcj Jun 16, 2024
05f5924
Use latest container in CI
vmcj Jun 12, 2024
db8575f
Use our container for the CodeQL job
vmcj Jun 13, 2024
7b48be5
ui: problem_list: fix line break
undefined-moe Jun 16, 2024
da8b44e
Escape \ in Python strings
nickygerritsen Jun 19, 2024
f58745e
Increase number of accepted deprecations
vmcj Jun 20, 2024
61b2f7b
Move webstandard script to .github directory
vmcj Jun 20, 2024
7858e80
Use correct API doc root by reading it from the request
nickygerritsen Jun 21, 2024
b19f973
Webstandard should not fail on 403 errors
vmcj Jun 21, 2024
98c29f7
Revert "Select shortname from current contestproblem"
moesoha Jun 17, 2024
56104f6
Add `getContestProblem` to Contest for getting an associated ContestP…
moesoha Jun 17, 2024
eaf95fe
Rename `problemBadgeForProblemAndContest` to `problemBadgeForContest`
moesoha Jun 17, 2024
affacb4
Fix #2279: get associated ContestProblem with Clarification entity
moesoha Jun 17, 2024
3975637
Upgrade FontAwesome
vmcj Jun 24, 2024
9b51f03
Update composer dependencies
vmcj Jun 24, 2024
b740618
Remove annotations
vmcj Jun 24, 2024
0a68916
New version doesn't have Resources folder
Jun 24, 2024
e1737bb
Fix Unit tests (unknown type to string)
vmcj Jun 24, 2024
b09a88a
The composer command was missing for the autoconf tests
vmcj Jun 16, 2024
b404383
Don't run composer as root if unneeded
vmcj Jun 16, 2024
ab267ec
Put lib/vendor close to the webapp
Jun 23, 2024
066e79f
Fix merge of last 2 commits
vmcj Jul 12, 2024
514a200
Revert indentation
vmcj Jul 21, 2024
4fb25aa
Fix maintainer-install
tom93 Jul 20, 2024
2c18a72
Close form before starting the other one.
vmcj Jul 26, 2024
5c96eb0
Use "accepted" contest pdf name in import-contest script
vmcj Jul 25, 2024
030078c
Do not use a CDN for the API docs
nickygerritsen Jul 26, 2024
9c2bb99
Fix start of MySQL container
vmcj Jul 22, 2024
ec7ca6c
Remove installation of service files
vmcj Jun 26, 2024
2a1735b
Move symfony.lock file to make Composer Flex happy and update hash in…
nickygerritsen Jul 28, 2024
4a890c5
Fix indentation/alignment
vmcj Jul 24, 2024
e8ddc5e
Don't display number of balloons when no contest is active
vmcj Jul 23, 2024
cc3271e
Fix default full name in self-registration form
tom93 Jul 26, 2024
d0e01fa
Revert "ui: problem_list: fix line break"
cubercsl Jul 23, 2024
98ce985
fix(frontend): The line break in the tooltips
cubercsl Jul 23, 2024
74caca6
fix(frontend): enable popover
cubercsl Jul 23, 2024
4e9998b
Add test for results generation based on WF 47
nickygerritsen Jul 8, 2024
b821b69
Implement new results rules
nickygerritsen Jul 8, 2024
a2f63e7
Ignore fixtures for codespell
nickygerritsen Jul 8, 2024
bc2f6f5
Add array shape for result row
nickygerritsen Jul 8, 2024
928bd94
Get rid of negation logic
nickygerritsen Jul 22, 2024
26c4109
Minor code style fixes.
nickygerritsen Jul 22, 2024
fa65157
Use fixtures for results
nickygerritsen Jul 26, 2024
f74b3bd
Introduce way to generated both honors and ranked results
nickygerritsen Jul 26, 2024
fe734bc
Get rid of some deprecations
nickygerritsen Jul 26, 2024
4f87cbd
Explicitly map problem entity for analysis now that we disabled auto …
nickygerritsen Jul 26, 2024
c01749d
Drop deprecation count to 32, since that is wat is reported currently
nickygerritsen Jul 29, 2024
745748d
Fix leftover reference to lib/vendor
tom93 Jul 29, 2024
70a089a
Simplify relative paths to webapp/vendor
tom93 Jul 20, 2024
271ee22
Simplify relative symlink conversion
tom93 Jul 20, 2024
597e622
Simplify relative path to webapp/public in webapp/tests/*
tom93 Jul 29, 2024
3b82b38
docs: specify externalid and shortname is optional
cubercsl Aug 3, 2024
78ccfa8
Add commands to compare awards, scoreboard and results
nickygerritsen May 31, 2024
2b6eea2
Move comparing to a service so we can reuse it (and test it)
nickygerritsen Jun 14, 2024
acb4e18
Add tests for compare services
nickygerritsen Jun 17, 2024
0023f38
Use ResultRow DTO now that we have it
nickygerritsen Jul 29, 2024
32e7ede
Compute hashes of executable files when migrating
tom93 Jul 30, 2024
7a5e397
Prefer addSql() over executeStatement() in migrations
tom93 Jul 30, 2024
6a99afc
Use query parameters in migrations
tom93 Jul 30, 2024
667bf7f
feat: follow medal categories when export results
cubercsl Jul 30, 2024
19bc91e
test: fix testGetResultsData
cubercsl Jul 30, 2024
1a7c94e
test(export): add test for medal medal categories
cubercsl Aug 6, 2024
ec5d9c5
team didn't solve anything shouldn't get any medals
cubercsl Aug 8, 2024
90c3ab8
Disable webstandard job because of startup failure
vmcj Aug 13, 2024
7b4a669
Add page with language stats
nickygerritsen Aug 11, 2024
3bfe011
Also show problem badges
nickygerritsen Aug 11, 2024
3e25ec9
Use a table and show solve stats per team for team language stats
nickygerritsen Aug 16, 2024
9f12b77
Fix saving new problems with statements
nickygerritsen Aug 16, 2024
d67cc1c
Update broken link to problem package format
eldering Aug 19, 2024
79d9f1d
Apply base64 encoding to compilation output
Kevinjil Aug 25, 2024
1236e58
Check for correct message
vmcj Aug 25, 2024
8f532b3
Extend bats test for new debian versions
vmcj Aug 25, 2024
53025db
Merge webapp/vendor/Makefile into webapp/Makefile
tom93 Jul 20, 2024
5ed1de6
Reorganise webapp/Makefile
tom93 Jul 29, 2024
bba227e
recreates foreign-keys, changes delete rules.
tuupke Aug 25, 2024
5b885c2
prevents removing submissions on user delete
tuupke Aug 25, 2024
5ff8ae4
Use /etc/os-release as alternative when lsb_release is not available
vmcj Jul 26, 2024
8d9fcfb
Enable webstandard job after fixed image
vmcj Aug 26, 2024
2bfd078
Allow null display_name when importing teams.json, fixes #2666
ningit Aug 30, 2024
c28e41e
Avoid infinite error handling recursion in runguard.
meisterT Aug 27, 2024
4dcbb95
Use the preg_match_all return to detect failures
vmcj Aug 31, 2024
9bb6a1e
Drastically speed up creating rejudgings by using direct queries
nickygerritsen Aug 12, 2024
1d03b8a
Ugly code for a mobile-friendly view, only for demonstration purposes.
meisterT Mar 23, 2024
bb5e839
Update mobile scoreboard.
nickygerritsen Apr 5, 2024
81ba953
Scale problem badges for very small screens.
nickygerritsen Apr 5, 2024
e164fbb
Move scoreboard javascript to JS file so browser can cache it.
nickygerritsen Apr 6, 2024
cb551c1
Run mobile scoreboard logic only after the page has loaded.
nickygerritsen Apr 8, 2024
cd5c91f
Fix pending subs on mobile scoreboard.
meisterT May 25, 2024
c0f9b32
Display as table to center align properly
nickygerritsen Sep 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
127 changes: 66 additions & 61 deletions .github/jobs/baseinstall.sh
Original file line number Diff line number Diff line change
@@ -1,54 +1,20 @@
#!/bin/sh

# Functions to annotate the Github actions logs
alias trace_on='set -x'
alias trace_off='{ set +x; } 2>/dev/null'

section_start_internal () {
echo "::group::$1"
trace_on
}

section_end_internal () {
echo "::endgroup::"
trace_on
}

alias section_start='trace_off ; section_start_internal '
alias section_end='trace_off ; section_end_internal '
. .github/jobs/ci_settings.sh

export version="$1"
db=${2:-install}

set -eux

section_start "Update packages"
sudo apt update
section_end

section_start "Install needed packages"
sudo apt install -y acl zip unzip nginx php php-fpm php-gd \
php-cli php-intl php-mbstring php-mysql php-curl php-json \
php-xml php-zip ntp make sudo debootstrap \
libcgroup-dev lsof php-cli php-curl php-json php-xml \
php-zip procps gcc g++ default-jre-headless \
default-jdk-headless ghc fp-compiler autoconf automake bats \
python3-sphinx python3-sphinx-rtd-theme rst2pdf fontconfig \
python3-yaml latexmk curl
section_end

PHPVERSION=$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION."\n";')
export PHPVERSION

section_start "Install composer"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
HASH="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
section_end

section_start "Run composer"
export APP_ENV="dev"
composer install --no-scripts
cd webapp
composer install --no-scripts |tee "$ARTIFACTS"/composer_out.txt
cd ..
section_end

section_start "Set simple admin password"
Expand All @@ -58,59 +24,98 @@ section_end

section_start "Install domserver"
make configure
./configure --with-baseurl='https://localhost/domjudge/' --enable-doc-build=no --prefix="/opt/domjudge"
./configure \
--with-baseurl='https://localhost/domjudge/' \
--with-domjudge-user=root \
--enable-doc-build=no \
--enable-judgehost-build=no | tee "$ARTIFACTS"/configure.txt

make domserver
sudo make install-domserver
make install-domserver
section_end

section_start "Explicit start mysql + install DB"
sudo /etc/init.d/mysql start
section_start "SQL settings"
cat > ~/.my.cnf <<EOF
[client]
host=sqlserver
user=root
password=root
EOF
cat ~/.my.cnf

mysql_root "CREATE DATABASE IF NOT EXISTS \`domjudge\` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql_root "CREATE USER IF NOT EXISTS \`domjudge\`@'%' IDENTIFIED BY 'domjudge';"
mysql_root "GRANT SELECT, INSERT, UPDATE, DELETE ON \`domjudge\`.* TO 'domjudge'@'%';"
mysql_root "FLUSH PRIVILEGES;"

# Show some MySQL debugging
mysql_root "show databases"
mysql_root "SELECT CURRENT_USER();"
mysql_root "SELECT USER();"
mysql_root "SELECT user,host FROM mysql.user"
echo "unused:sqlserver:domjudge:domjudge:domjudge:3306" > /opt/domjudge/domserver/etc/dbpasswords.secret
mysql_user "SELECT CURRENT_USER();"
mysql_user "SELECT USER();"
section_end

section_start "Install DOMjudge database"
/opt/domjudge/domserver/bin/dj_setup_database -uroot -proot bare-install
section_end

section_start "Show PHP config"
php -v | tee -a "$ARTIFACTS"/php.txt
php -m | tee -a "$ARTIFACTS"/php.txt
section_end

section_start "Show general config"
printenv | tee -a "$ARTIFACTS"/environment.txt
cp /etc/os-release "$ARTIFACTS"/os-release.txt
cp /proc/cmdline "$ARTIFACTS"/cmdline.txt
section_end

section_start "Setup webserver"
sudo cp /opt/domjudge/domserver/etc/domjudge-fpm.conf /etc/php/$PHPVERSION/fpm/pool.d/domjudge.conf
cp /opt/domjudge/domserver/etc/domjudge-fpm.conf /etc/php/"$PHPVERSION"/fpm/pool.d/domjudge.conf

sudo rm -f /etc/nginx/sites-enabled/*
sudo cp /opt/domjudge/domserver/etc/nginx-conf /etc/nginx/sites-enabled/domjudge
rm -f /etc/nginx/sites-enabled/*
cp /opt/domjudge/domserver/etc/nginx-conf /etc/nginx/sites-enabled/domjudge

openssl req -nodes -new -x509 -keyout /tmp/server.key -out /tmp/server.crt -subj "/C=NL/ST=Noord-Holland/L=Amsterdam/O=TestingForPR/CN=localhost"
sudo cp /tmp/server.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates
cp /tmp/server.crt /usr/local/share/ca-certificates/
update-ca-certificates
# shellcheck disable=SC2002
cat "$(pwd)/.github/jobs/data/nginx_extra" | sudo tee -a /etc/nginx/sites-enabled/domjudge
sudo nginx -t
cat "$(pwd)/.github/jobs/data/nginx_extra" | tee -a /etc/nginx/sites-enabled/domjudge
nginx -t
section_end

section_start "Show webserver is up"
for service in nginx php${PHPVERSION}-fpm; do
sudo systemctl restart $service
sudo systemctl status $service
service "$service" restart
service "$service" status
done
section_end

section_start "Install the example data"
/opt/domjudge/domserver/bin/dj_setup_database -uroot -proot install-examples
section_end
if [ "${db}" = "install" ]; then
section_start "Install the example data"
/opt/domjudge/domserver/bin/dj_setup_database -uroot -proot install-examples | tee -a "$ARTIFACTS/mysql.txt"
section_end
fi

section_start "Setup user"
# We're using the admin user in all possible roles
echo "DELETE FROM userrole WHERE userid=1;" | mysql -uroot -proot domjudge
mysql_root "DELETE FROM userrole WHERE userid=1;" domjudge
if [ "$version" = "team" ]; then
# Add team to admin user
echo "INSERT INTO userrole (userid, roleid) VALUES (1, 3);" | mysql -uroot -proot domjudge
echo "UPDATE user SET teamid = 1 WHERE userid = 1;" | mysql -uroot -proot domjudge
mysql_root "INSERT INTO userrole (userid, roleid) VALUES (1, 3);" domjudge
mysql_root "UPDATE user SET teamid = 1 WHERE userid = 1;" domjudge
elif [ "$version" = "jury" ]; then
# Add jury to admin user
echo "INSERT INTO userrole (userid, roleid) VALUES (1, 2);" | mysql -uroot -proot domjudge
mysql_root "INSERT INTO userrole (userid, roleid) VALUES (1, 2);" domjudge
elif [ "$version" = "balloon" ]; then
# Add balloon to admin user
echo "INSERT INTO userrole (userid, roleid) VALUES (1, 4);" | mysql -uroot -proot domjudge
mysql_root "INSERT INTO userrole (userid, roleid) VALUES (1, 4);" domjudge
elif [ "$version" = "admin" ]; then
# Add admin to admin user
echo "INSERT INTO userrole (userid, roleid) VALUES (1, 1);" | mysql -uroot -proot domjudge
mysql_root "INSERT INTO userrole (userid, roleid) VALUES (1, 1);" domjudge
fi
section_end

49 changes: 49 additions & 0 deletions .github/jobs/ci_settings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/sh

# Store artifacts/logs
export ARTIFACTS="/tmp/artifacts"
mkdir -p "$ARTIFACTS"

# Functions to annotate the Github actions logs
trace_on () {
set -x
}
trace_off () {
{
set +x
} 2>/dev/null
}

section_start_internal () {
echo "::group::$1"
trace_on
}

section_end_internal () {
echo "::endgroup::"
trace_on
}

mysql_root () {
# shellcheck disable=SC2086
echo "$1" | mysql -uroot -proot ${2:-} | tee -a "$ARTIFACTS"/mysql.txt
}

mysql_user () {
# shellcheck disable=SC2086
echo "$1" | mysql -udomjudge -pdomjudge ${2:-} | tee -a "$ARTIFACTS"/mysql.txt
}

section_start () {
if [ "$#" -ne 1 ]; then
echo "Only 1 argument is needed for GHA, 2 was needed for GitLab."
exit 1
fi
trace_off
section_start_internal "$1"
}

section_end () {
trace_off
section_end_internal
}
16 changes: 16 additions & 0 deletions .github/jobs/composer_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

set -eux

. .github/jobs/ci_settings.sh

section_start "Configure PHP"
PHPVERSION=$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION."\n";')
export PHPVERSION
echo "$PHPVERSION" | tee -a "$ARTIFACTS"/phpversion.txt
section_end

section_start "Run composer"
cd webapp
composer install --no-scripts 2>&1 | tee -a "$ARTIFACTS/composer_log.txt"
section_end
21 changes: 5 additions & 16 deletions .github/jobs/configure-checks/all.bats
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ setup() {
if [ "$distro_id" = "ID=fedora" ]; then
repo-install httpd
fi
repo-install gcc g++ libcgroup-dev
repo-install gcc g++ libcgroup-dev composer
}

run_configure () {
Expand Down Expand Up @@ -67,9 +67,9 @@ repo-remove () {
assert_line "checking for gcc... no"
assert_line "checking for cc... no"
assert_line "checking for cl.exe... no"
assert_line "configure: error: in \`${test_path}':"
assert_regex "configure: error: in .${test_path}':"
assert_line 'configure: error: no acceptable C compiler found in $PATH'
assert_line "See \`config.log' for more details"
assert_regex "See [\`']config.log' for more details"
}

compiler_assertions () {
Expand Down Expand Up @@ -231,7 +231,6 @@ compile_assertions_finished () {
assert_line " - bin..............: /opt/domjudge/domserver/bin"
assert_line " - etc..............: /opt/domjudge/domserver/etc"
assert_line " - lib..............: /opt/domjudge/domserver/lib"
assert_line " - libvendor........: /opt/domjudge/domserver/lib/vendor"
assert_line " - log..............: /opt/domjudge/domserver/log"
assert_line " - run..............: /opt/domjudge/domserver/run"
assert_line " - sql..............: /opt/domjudge/domserver/sql"
Expand All @@ -248,7 +247,6 @@ compile_assertions_finished () {
assert_line " - tmp..............: /opt/domjudge/judgehost/tmp"
assert_line " - judge............: /opt/domjudge/judgehost/judgings"
assert_line " - chroot...........: /chroot/domjudge"
assert_line " - cgroup...........: /sys/fs/cgroup"
}

@test "Prefix configured" {
Expand All @@ -258,7 +256,6 @@ compile_assertions_finished () {
refute_line " * documentation.......: /opt/domjudge/doc"
refute_line " * domserver...........: /opt/domjudge/domserver"
refute_line " - bin..............: /opt/domjudge/domserver/bin"
refute_line " - libvendor........: /opt/domjudge/domserver/lib/vendor"
refute_line " - tmp..............: /opt/domjudge/domserver/tmp"
refute_line " - example_problems.: /opt/domjudge/domserver/example_problems"
refute_line " * judgehost...........: /opt/domjudge/judgehost"
Expand All @@ -270,7 +267,6 @@ compile_assertions_finished () {
assert_line " * prefix..............: /tmp"
assert_line " * documentation.......: /tmp/doc"
assert_line " * domserver...........: /tmp/domserver"
assert_line " - libvendor........: /tmp/domserver/lib/vendor"
assert_line " * judgehost...........: /tmp/judgehost"
assert_line " - judge............: /tmp/judgehost/judgings"
}
Expand All @@ -292,7 +288,6 @@ compile_assertions_finished () {
assert_line " - bin..............: /usr/local/bin"
assert_line " - etc..............: /usr/local/etc/domjudge"
assert_line " - lib..............: /usr/local/lib/domjudge"
assert_line " - libvendor........: /usr/local/lib/domjudge/vendor"
assert_line " - log..............: /usr/local/var/log/domjudge"
assert_line " - run..............: /usr/local/var/run/domjudge"
assert_line " - sql..............: /usr/local/share/domjudge/sql"
Expand All @@ -309,19 +304,17 @@ compile_assertions_finished () {
assert_line " - tmp..............: /tmp"
assert_line " - judge............: /usr/local/var/lib/domjudge/judgings"
assert_line " - chroot...........: /chroot/domjudge"
assert_line " - cgroup...........: /sys/fs/cgroup"
}

@test "Alternative dirs together with FHS" {
setup
run run_configure --enable-fhs --with-domserver_webappdir=/run/webapp --with-domserver_tmpdir=/tmp/domserver --with-judgehost_tmpdir=/srv/tmp --with-judgehost_judgedir=/srv/judgings --with-judgehost_chrootdir=/srv/chroot/domjudge --with-judgehost_cgroupdir=/sys/fs/altcgroup
run run_configure --enable-fhs --with-domserver_webappdir=/run/webapp --with-domserver_tmpdir=/tmp/domserver --with-judgehost_tmpdir=/srv/tmp --with-judgehost_judgedir=/srv/judgings --with-judgehost_chrootdir=/srv/chroot/domjudge
assert_line " * prefix..............: /usr/local"
assert_line " * documentation.......: /usr/local/share/doc/domjudge"
assert_line " * domserver...........: "
assert_line " - bin..............: /usr/local/bin"
assert_line " - etc..............: /usr/local/etc/domjudge"
assert_line " - lib..............: /usr/local/lib/domjudge"
assert_line " - libvendor........: /usr/local/lib/domjudge/vendor"
assert_line " - log..............: /usr/local/var/log/domjudge"
assert_line " - run..............: /usr/local/var/run/domjudge"
assert_line " - sql..............: /usr/local/share/domjudge/sql"
Expand All @@ -343,13 +336,11 @@ compile_assertions_finished () {
assert_line " - judge............: /srv/judgings"
refute_line " - chroot...........: /chroot/domjudge"
assert_line " - chroot...........: /srv/chroot/domjudge"
refute_line " - cgroup...........: /sys/fs/cgroup"
assert_line " - cgroup...........: /sys/fs/altcgroup"
}

@test "Alternative dirs together with defaults" {
setup
run run_configure "--with-judgehost_tmpdir=/srv/tmp --with-judgehost_judgedir=/srv/judgings --with-judgehost_chrootdir=/srv/chroot --with-judgehost_cgroupdir=/sys/fs/altcgroup --with-domserver_logdir=/log"
run run_configure "--with-judgehost_tmpdir=/srv/tmp --with-judgehost_judgedir=/srv/judgings --with-judgehost_chrootdir=/srv/chroot --with-domserver_logdir=/log"
assert_line " * prefix..............: /opt/domjudge"
assert_line " * documentation.......: /opt/domjudge/doc"
assert_line " * domserver...........: /opt/domjudge/domserver"
Expand All @@ -362,8 +353,6 @@ compile_assertions_finished () {
assert_line " - judge............: /srv/judgings"
refute_line " - chroot...........: /chroot/domjudge"
assert_line " - chroot...........: /srv/chroot"
refute_line " - cgroup...........: /sys/fs/cgroup"
assert_line " - cgroup...........: /sys/fs/altcgroup"
}

@test "Default URL not set, docs mention" {
Expand Down
3 changes: 2 additions & 1 deletion .github/jobs/data/codespellignorefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
./config.guess
./gitlab/codespell.yml
./.github/jobs/uploadcodecov.sh
./lib/vendor
./webapp/vendor
./webapp/public/bundles
./webapp/public/js/ace
./webapp/templates/bundles
Expand All @@ -26,3 +26,4 @@ nv.d3.min*
composer*
./doc/logos
./m4
./webapp/tests/Unit/Fixtures
9 changes: 9 additions & 0 deletions .github/jobs/pa11y_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"chromeLaunchConfig": {
"args": [
"--no-sandbox",
"--disable-setuid-sandbox",
"--disable-dev-shm-usage"
]
}
}
Loading
Loading