Skip to content

Commit 5fbe455

Browse files
committed
Use hardcopy of the GHA jobs on main
Based on: 7d7ed2e
1 parent dc75869 commit 5fbe455

28 files changed

+1177
-116
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+28-14
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

+19-8
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

+9
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

+9-24
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,6 @@
22

33
. .github/jobs/ci_settings.sh
44

5-
# Functions to annotate the Github actions logs
6-
alias trace_on='set -x'
7-
alias trace_off='{ set +x; } 2>/dev/null'
8-
9-
section_start_internal () {
10-
echo "::group::$1"
11-
trace_on
12-
}
13-
14-
section_end_internal () {
15-
echo "::endgroup::"
16-
trace_on
17-
}
18-
19-
alias section_start='trace_off ; section_start_internal '
20-
alias section_end='trace_off ; section_end_internal '
21-
225
export version="$1"
236
db=${2:-install}
247
phpversion="${3:-8.1}"
@@ -40,7 +23,9 @@ show_phpinfo "$phpversion"
4023

4124
section_start "Run composer"
4225
export APP_ENV="dev"
43-
composer install --no-scripts
26+
cd webapp
27+
composer install --no-scripts |tee "$ARTIFACTS"/composer_out.txt
28+
cd ..
4429
section_end
4530

4631
section_start "Set simple admin password"
@@ -124,15 +109,15 @@ section_end
124109
section_start "Setup webserver"
125110
cp /opt/domjudge/domserver/etc/domjudge-fpm.conf /etc/php/"$phpversion"/fpm/pool.d/domjudge.conf
126111

127-
sudo rm -f /etc/nginx/sites-enabled/*
128-
sudo cp /opt/domjudge/domserver/etc/nginx-conf /etc/nginx/sites-enabled/domjudge
112+
rm -f /etc/nginx/sites-enabled/*
113+
cp /opt/domjudge/domserver/etc/nginx-conf /etc/nginx/sites-enabled/domjudge
129114

130115
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"
131-
sudo cp /tmp/server.crt /usr/local/share/ca-certificates/
132-
sudo update-ca-certificates
116+
cp /tmp/server.crt /usr/local/share/ca-certificates/
117+
update-ca-certificates
133118
# shellcheck disable=SC2002
134-
cat "$(pwd)/.github/jobs/data/nginx_extra" | sudo tee -a /etc/nginx/sites-enabled/domjudge
135-
sudo nginx -t
119+
cat "$(pwd)/.github/jobs/data/nginx_extra" | tee -a /etc/nginx/sites-enabled/domjudge
120+
nginx -t
136121
section_end
137122

138123
section_start "Show webserver is up"

.github/jobs/chroot.bats

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env bats
2+
3+
load 'assert'
4+
5+
CHROOT="/chroot/domjudge"
6+
if [ -n "${GITHUB_REPOSITORY+x}" ]; then
7+
CHROOT="/__w/domjudge/domjudge${CHROOT}"
8+
fi
9+
# Cleanup old dir
10+
rm -rf $CHROOT
11+
12+
COMMANDARGS=""
13+
if [ -n "${ARCH+x}" ]; then
14+
COMMANDARGS="-a $ARCH $COMMANDARGS"
15+
fi
16+
17+
@test "help output" {
18+
run ./dj_make_chroot -h
19+
assert_success
20+
assert_partial "Usage:"
21+
assert_partial "Creates a chroot environment with Java JRE support using the"
22+
assert_partial "Debian or Ubuntu GNU/Linux distribution."
23+
assert_partial "Options"
24+
assert_partial "Available architectures:"
25+
assert_partial "Environment Overrides:"
26+
assert_partial "This script must be run as root"
27+
}
28+
29+
@test "Test chroot fails if unsupported architecture given" {
30+
if [ -n "${ARCH+x}" ]; then
31+
skip "Already an Arch set in the commands."
32+
fi
33+
for unsupported_arch in 'dom04' 'arm' '64' 'namd64' 'amd64v2'; do
34+
run ./dj_make_chroot $COMMANDARGS -a $unsupported_arch
35+
assert_failure
36+
assert_partial "Error: Architecture $unsupported_arch not supported for"
37+
done
38+
}
39+
40+
# Creation of the chroot is slow so we run all tests inside 1 large test to speedup.
41+
@test "Test chroot works with args: $COMMANDARGS" {
42+
run ./dj_make_chroot $COMMANDARGS
43+
assert_partial "Done building chroot in $CHROOT"
44+
assert_success
45+
if [ -n "${ARCH+x}" ]; then
46+
run ./dj_run_chroot "dpkg --print-architecture"
47+
assert_partial "$ARCH"
48+
assert_success
49+
else
50+
HOSTARCH=$(dpkg --print-architecture)
51+
run ./dj_run_chroot "dpkg --print-architecture"
52+
assert_partial "$HOSTARCH"
53+
assert_success
54+
fi
55+
}

.github/jobs/chroot_checks.sh

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
. .github/jobs/ci_settings.sh
4+
5+
if [ -n "$1" ] && [ "$1" != "default" ]; then
6+
export ARCH="$1"
7+
fi
8+
9+
function finish() {
10+
echo -e "\\n\\n=======================================================\\n"
11+
echo "Storing artifacts..."
12+
trace_on
13+
set +e
14+
cp /proc/cmdline "$ARTIFACTS/cmdline"
15+
cp /__w/domjudge/domjudge/chroot/domjudge/etc/apt/sources.list "$ARTIFACTS/sources.list"
16+
cp /__w/domjudge/domjudge/chroot/domjudge/debootstrap/debootstrap.log "$ARTIFACTS/debootstrap.log"
17+
}
18+
19+
FAILED=0
20+
21+
trap finish EXIT
22+
23+
DIR=$PWD
24+
section_start "Debug info"
25+
lsb_release -a | tee -a "$ARTIFACTS/debug-info"
26+
mount | tee -a "$ARTIFACTS/debug-info"
27+
whoami | tee -a "$ARTIFACTS/debug-info"
28+
echo "Dir: $DIR" | tee -a "$ARTIFACTS/debug-info"
29+
section_end
30+
31+
section_start "Basic judgehost install"
32+
chown -R domjudge ./
33+
34+
# configure, make and install (but skip documentation)
35+
sudo -u domjudge make configure
36+
sudo -u domjudge ./configure --with-baseurl='http://localhost/domjudge/' --with-domjudge-user=domjudge --with-judgehost_chrootdir=${DIR}/chroot/domjudge |& tee "$ARTIFACTS/configure.log"
37+
sudo -u domjudge make judgehost |& tee "$ARTIFACTS/make.log"
38+
make install-judgehost |& tee -a "$ARTIFACTS/make.log"
39+
section_end setup
40+
41+
section_start "Configure chroot"
42+
43+
cd /opt/domjudge/judgehost/bin || exit 1
44+
section_end chroot
45+
46+
section_start "Show minimal chroot"
47+
./dj_make_chroot -a "$ARCH" | tee -a "$ARTIFACTS"/chroot.log
48+
section_end
49+
50+
section_start "Test chroot contents"
51+
set -xe
52+
cp ${DIR}/submit/assert.bash .
53+
cp ${DIR}/.github/jobs/chroot.bats .
54+
bats ./chroot.bats
55+
section_end

.github/jobs/composer_setup.sh

+16
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)