Skip to content

Commit 627941f

Browse files
Merge branch 'main' into self-register-password-length
2 parents 1b7d877 + 7c890e8 commit 627941f

File tree

432 files changed

+28400
-6037
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

432 files changed

+28400
-6037
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,46 @@ assignees: ''
77

88
---
99

10-
NOTE: If this is a _discussion starter_, you need any _installation help_ or have a _question_ on how to accomplish something,
10+
<!--
11+
NOTE: If this is a _discussion starter_, you need any _installation help_, or have a _question_ on how to accomplish something,
1112
rather post at [our discussion channel](https://www.domjudge.org/chat) or send an email to our
1213
[DOMjudge-devel mailinglist](https://www.domjudge.org/mailman/postorius/lists/domjudge-devel.domjudge.org/)
1314
instead of filing an issue here.
15+
-->
1416

1517
### Description of the problem
16-
> Replace this line with a short description.
18+
<!--
19+
Write here a short description.
20+
-->
1721

1822
### Your environment
19-
> Include details about your installation here.
20-
> - DOMjudge version (e.g. 7.0.0 or a github commit hash)
21-
> - Operating system / Linux distribution and version (e.g. Ubuntu 18.04)
22-
> - Webserver (e.g. Apache or nginx)
23+
<!--
24+
Include details about your installation here.
25+
- DOMjudge version (e.g. 7.0.0 or a github commit hash)
26+
- Operating system / Linux distribution and version (e.g. Ubuntu 18.04)
27+
- Webserver (e.g. Apache or nginx)
28+
-->
2329

2430
### Steps to reproduce
25-
> Replace this with a description how we can reproduce your bug.
26-
> - Step 1
27-
> - Step 2
28-
> - Step 3
31+
<!--
32+
Write here a description how we can reproduce your bug.
33+
1. Step 1
34+
1. Step 2
35+
1. Step 3
36+
-->
2937

3038
### Expected behaviour
31-
> Replace this line with what you would expect to happen.
39+
<!--
40+
Write here what you would expect to happen.
41+
-->
3242

3343
### Actual behaviour
34-
> Replace this line with what happens instead.
44+
<!--
45+
Write here what happens instead.
46+
-->
3547

3648
### Any other information that you want to share?
37-
> Please include webserver, symfony and judgedaemon log snippets here as appropriate.
38-
> Screenshots may help in case of UI bugs.
49+
<!--
50+
Please include webserver, symfony and judgedaemon log snippets here as appropriate.
51+
Screenshots may help in case of UI bugs.
52+
-->

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,36 @@ assignees: ''
77

88
---
99

10-
NOTE: If this is a _discussion starter_, you need any _installation help_ or have a _question_ on how to accomplish something,
10+
<!--
11+
NOTE: If this is a _discussion starter_, you need any _installation help_, or have a _question_ on how to accomplish something,
1112
rather post at [our discussion channel](https://www.domjudge.org/chat) or send an email to our
1213
[DOMjudge-devel mailinglist](https://www.domjudge.org/mailman/postorius/lists/domjudge-devel.domjudge.org/).
1314
1415
Thank you for suggesting ways to improve DOMjudge. Before you file a feature
1516
request, it might be useful to discuss it first via the chat or mailing list
1617
linked above. We can then assess together whether there is
1718
not already a way to accomplish your goal with DOMjudge currently.
19+
-->
1820

1921
### Description of the enhancement request
20-
> Replace this line with a short description.
22+
<!--
23+
Write here a short description.
24+
-->
2125

2226
### The goal you want to achieve
23-
> Please elaborate on the (larger, higher level) goal you want to achieve with this enhancement, so we have a good understanding what this feature would be useful for and how it fits in DOMjudge as a whole.
27+
<!--
28+
Please elaborate on the (larger, higher level) goal you want to achieve with this enhancement, so we have a good understanding what this feature would be useful for and how it fits in DOMjudge as a whole.
29+
-->
2430

2531
### Expected behaviour
26-
> Replace this line with what you would expect to happen.
27-
> Please describe the workflow how you want this feature to work with expected start URL
28-
> - Step 1
29-
> - Step 2
32+
<!--
33+
Write here what you would expect to happen.
34+
For example describe the flow how you want this feature to work.
35+
1. Step 1
36+
2. Step 2
37+
-->
38+
3039
### Any other information that you want to share?
31-
> Screenshots may help in case of UI enhancements with annotated drawings.
40+
<!--
41+
Screenshots with annotated drawings may help in case of UI enhancements.
42+
-->

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,12 @@ updates:
4444
allow:
4545
- dependency-type: "all"
4646
target-branch: "8.2"
47+
- package-ecosystem: "composer"
48+
directory: "/"
49+
schedule:
50+
interval: "weekly"
51+
open-pull-requests-limit: 0
52+
versioning-strategy: lockfile-only
53+
allow:
54+
- dependency-type: "all"
55+
target-branch: "8.3"

.github/jobs/baseinstall.sh

Lines changed: 89 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,20 @@
11
#!/bin/sh
22

3-
# Functions to annotate the Github actions logs
4-
alias trace_on='set -x'
5-
alias trace_off='{ set +x; } 2>/dev/null'
6-
7-
section_start_internal () {
8-
echo "::group::$1"
9-
trace_on
10-
}
11-
12-
section_end_internal () {
13-
echo "::endgroup::"
14-
trace_on
15-
}
16-
17-
alias section_start='trace_off ; section_start_internal '
18-
alias section_end='trace_off ; section_end_internal '
3+
. .github/jobs/ci_settings.sh
194

205
export version="$1"
6+
db=${2:-install}
217

228
set -eux
239

24-
section_start "Update packages"
25-
sudo apt update
26-
section_end
27-
28-
section_start "Install needed packages"
29-
sudo apt install -y acl zip unzip nginx php php-fpm php-gd \
30-
php-cli php-intl php-mbstring php-mysql php-curl php-json \
31-
php-xml php-zip ntp make sudo debootstrap \
32-
libcgroup-dev lsof php-cli php-curl php-json php-xml \
33-
php-zip procps gcc g++ default-jre-headless \
34-
default-jdk-headless ghc fp-compiler autoconf automake bats \
35-
python3-sphinx python3-sphinx-rtd-theme rst2pdf fontconfig \
36-
python3-yaml latexmk curl
37-
section_end
38-
3910
PHPVERSION=$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION."\n";')
4011
export PHPVERSION
4112

42-
section_start "Install composer"
43-
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
44-
HASH="$(wget -q -O - https://composer.github.io/installer.sig)"
45-
php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
46-
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
47-
section_end
48-
4913
section_start "Run composer"
5014
export APP_ENV="dev"
51-
composer install --no-scripts
15+
cd webapp
16+
composer install --no-scripts |tee "$ARTIFACTS"/composer_out.txt
17+
cd ..
5218
section_end
5319

5420
section_start "Set simple admin password"
@@ -58,59 +24,119 @@ section_end
5824

5925
section_start "Install domserver"
6026
make configure
61-
./configure --with-baseurl='https://localhost/domjudge/' --enable-doc-build=no --prefix="/opt/domjudge"
27+
if [ "$version" = "all" ]; then
28+
# Note that we use http instead of https here as python requests doesn't
29+
# like our self-signed cert. We should fix this separately.
30+
./configure \
31+
--with-baseurl='http://localhost/domjudge/' \
32+
--with-domjudge-user=domjudge \
33+
--with-judgehost-chrootdir=/chroot/domjudge | tee "$ARTIFACTS"/configure.txt
34+
make build-scripts domserver judgehost docs
35+
make install-domserver install-judgehost install-docs
36+
else
37+
./configure \
38+
--with-baseurl='https://localhost/domjudge/' \
39+
--with-domjudge-user=root \
40+
--enable-doc-build=no \
41+
--enable-judgehost-build=no | tee "$ARTIFACTS"/configure.txt
42+
make domserver
43+
make install-domserver
44+
fi
45+
46+
section_end
6247

63-
make domserver
64-
sudo make install-domserver
48+
section_start "SQL settings"
49+
cat > ~/.my.cnf <<EOF
50+
[client]
51+
host=sqlserver
52+
user=root
53+
password=root
54+
EOF
55+
cat ~/.my.cnf
56+
57+
mysql_root "CREATE DATABASE IF NOT EXISTS \`domjudge\` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
58+
mysql_root "CREATE USER IF NOT EXISTS \`domjudge\`@'%' IDENTIFIED BY 'domjudge';"
59+
mysql_root "GRANT SELECT, INSERT, UPDATE, DELETE ON \`domjudge\`.* TO 'domjudge'@'%';"
60+
mysql_root "FLUSH PRIVILEGES;"
61+
62+
# Show some MySQL debugging
63+
mysql_root "show databases"
64+
mysql_root "SELECT CURRENT_USER();"
65+
mysql_root "SELECT USER();"
66+
mysql_root "SELECT user,host FROM mysql.user"
67+
echo "unused:sqlserver:domjudge:domjudge:domjudge:3306" > /opt/domjudge/domserver/etc/dbpasswords.secret
68+
mysql_user "SELECT CURRENT_USER();"
69+
mysql_user "SELECT USER();"
6570
section_end
6671

67-
section_start "Explicit start mysql + install DB"
68-
sudo /etc/init.d/mysql start
72+
if [ "${db}" = "install" ]; then
73+
section_start "Install DOMjudge database"
74+
/opt/domjudge/domserver/bin/dj_setup_database -uroot -proot bare-install
75+
section_end
76+
elif [ "${db}" = "upgrade" ]; then
77+
section_start "Upgrade DOMjudge database"
78+
/opt/domjudge/domserver/bin/dj_setup_database -uroot -proot upgrade
79+
section_end
80+
fi
81+
82+
section_start "Show PHP config"
83+
php -v | tee -a "$ARTIFACTS"/php.txt
84+
php -m | tee -a "$ARTIFACTS"/php.txt
85+
section_end
6986

70-
/opt/domjudge/domserver/bin/dj_setup_database -uroot -proot bare-install
87+
section_start "Show general config"
88+
printenv | tee -a "$ARTIFACTS"/environment.txt
89+
cp /etc/os-release "$ARTIFACTS"/os-release.txt
90+
cp /proc/cmdline "$ARTIFACTS"/cmdline.txt
7191
section_end
7292

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

76-
sudo rm -f /etc/nginx/sites-enabled/*
77-
sudo cp /opt/domjudge/domserver/etc/nginx-conf /etc/nginx/sites-enabled/domjudge
96+
rm -f /etc/nginx/sites-enabled/*
97+
cp /opt/domjudge/domserver/etc/nginx-conf /etc/nginx/sites-enabled/domjudge
7898

7999
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"
80-
sudo cp /tmp/server.crt /usr/local/share/ca-certificates/
81-
sudo update-ca-certificates
100+
cp /tmp/server.crt /usr/local/share/ca-certificates/
101+
update-ca-certificates
82102
# shellcheck disable=SC2002
83-
cat "$(pwd)/.github/jobs/data/nginx_extra" | sudo tee -a /etc/nginx/sites-enabled/domjudge
84-
sudo nginx -t
103+
cat "$(pwd)/.github/jobs/data/nginx_extra" | tee -a /etc/nginx/sites-enabled/domjudge
104+
nginx -t
85105
section_end
86106

87107
section_start "Show webserver is up"
88108
for service in nginx php${PHPVERSION}-fpm; do
89-
sudo systemctl restart $service
90-
sudo systemctl status $service
109+
service "$service" restart
110+
service "$service" status
91111
done
92112
section_end
93113

94-
section_start "Install the example data"
95-
/opt/domjudge/domserver/bin/dj_setup_database -uroot -proot install-examples
96-
section_end
114+
if [ "${db}" = "install" ]; then
115+
section_start "Install the example data"
116+
/opt/domjudge/domserver/bin/dj_setup_database -uroot -proot install-examples | tee -a "$ARTIFACTS/mysql.txt"
117+
section_end
118+
fi
97119

98120
section_start "Setup user"
99121
# We're using the admin user in all possible roles
100-
echo "DELETE FROM userrole WHERE userid=1;" | mysql -uroot -proot domjudge
122+
mysql_root "DELETE FROM userrole WHERE userid=1;" domjudge
101123
if [ "$version" = "team" ]; then
102124
# Add team to admin user
103-
echo "INSERT INTO userrole (userid, roleid) VALUES (1, 3);" | mysql -uroot -proot domjudge
104-
echo "UPDATE user SET teamid = 1 WHERE userid = 1;" | mysql -uroot -proot domjudge
125+
mysql_root "INSERT INTO userrole (userid, roleid) VALUES (1, 3);" domjudge
126+
mysql_root "UPDATE user SET teamid = 1 WHERE userid = 1;" domjudge
105127
elif [ "$version" = "jury" ]; then
106128
# Add jury to admin user
107-
echo "INSERT INTO userrole (userid, roleid) VALUES (1, 2);" | mysql -uroot -proot domjudge
129+
mysql_root "INSERT INTO userrole (userid, roleid) VALUES (1, 2);" domjudge
108130
elif [ "$version" = "balloon" ]; then
109131
# Add balloon to admin user
110-
echo "INSERT INTO userrole (userid, roleid) VALUES (1, 4);" | mysql -uroot -proot domjudge
132+
mysql_root "INSERT INTO userrole (userid, roleid) VALUES (1, 4);" domjudge
111133
elif [ "$version" = "admin" ]; then
112134
# Add admin to admin user
113-
echo "INSERT INTO userrole (userid, roleid) VALUES (1, 1);" | mysql -uroot -proot domjudge
135+
mysql_root "INSERT INTO userrole (userid, roleid) VALUES (1, 1);" domjudge
136+
elif [ "$version" = "all" ]; then
137+
mysql_root "INSERT INTO userrole (userid, roleid) VALUES (1, 1);" domjudge
138+
mysql_root "INSERT INTO userrole (userid, roleid) VALUES (1, 3);" domjudge
139+
mysql_root "UPDATE user SET teamid = 1 WHERE userid = 1;" domjudge
114140
fi
115141
section_end
116142

.github/jobs/ci_settings.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/sh
2+
3+
# Store artifacts/logs
4+
export ARTIFACTS="/tmp/artifacts"
5+
mkdir -p "$ARTIFACTS"
6+
7+
# Functions to annotate the Github actions logs
8+
trace_on () {
9+
set -x
10+
}
11+
trace_off () {
12+
{
13+
set +x
14+
} 2>/dev/null
15+
}
16+
17+
section_start_internal () {
18+
echo "::group::$1"
19+
trace_on
20+
}
21+
22+
section_end_internal () {
23+
echo "::endgroup::"
24+
trace_on
25+
}
26+
27+
mysql_root () {
28+
# shellcheck disable=SC2086
29+
echo "$1" | mysql -uroot -proot ${2:-} | tee -a "$ARTIFACTS"/mysql.txt
30+
}
31+
32+
mysql_user () {
33+
# shellcheck disable=SC2086
34+
echo "$1" | mysql -udomjudge -pdomjudge ${2:-} | tee -a "$ARTIFACTS"/mysql.txt
35+
}
36+
37+
section_start () {
38+
if [ "$#" -ne 1 ]; then
39+
echo "Only 1 argument is needed for GHA, 2 was needed for GitLab."
40+
exit 1
41+
fi
42+
trace_off
43+
section_start_internal "$1"
44+
}
45+
46+
section_end () {
47+
trace_off
48+
section_end_internal
49+
}

.github/jobs/composer_setup.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
set -eux
4+
5+
. .github/jobs/ci_settings.sh
6+
7+
section_start "Configure PHP"
8+
PHPVERSION=$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION."\n";')
9+
export PHPVERSION
10+
echo "$PHPVERSION" | tee -a "$ARTIFACTS"/phpversion.txt
11+
section_end
12+
13+
section_start "Run composer"
14+
cd webapp
15+
composer install --no-scripts 2>&1 | tee -a "$ARTIFACTS/composer_log.txt"
16+
section_end

0 commit comments

Comments
 (0)