-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use hardcopy of the GHA jobs on main
Based on: 7d7ed2e
- Loading branch information
Showing
28 changed files
with
1,177 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env bats | ||
|
||
load 'assert' | ||
|
||
CHROOT="/chroot/domjudge" | ||
if [ -n "${GITHUB_REPOSITORY+x}" ]; then | ||
CHROOT="/__w/domjudge/domjudge${CHROOT}" | ||
fi | ||
# Cleanup old dir | ||
rm -rf $CHROOT | ||
|
||
COMMANDARGS="" | ||
if [ -n "${ARCH+x}" ]; then | ||
COMMANDARGS="-a $ARCH $COMMANDARGS" | ||
fi | ||
|
||
@test "help output" { | ||
run ./dj_make_chroot -h | ||
assert_success | ||
assert_partial "Usage:" | ||
assert_partial "Creates a chroot environment with Java JRE support using the" | ||
assert_partial "Debian or Ubuntu GNU/Linux distribution." | ||
assert_partial "Options" | ||
assert_partial "Available architectures:" | ||
assert_partial "Environment Overrides:" | ||
assert_partial "This script must be run as root" | ||
} | ||
|
||
@test "Test chroot fails if unsupported architecture given" { | ||
if [ -n "${ARCH+x}" ]; then | ||
skip "Already an Arch set in the commands." | ||
fi | ||
for unsupported_arch in 'dom04' 'arm' '64' 'namd64' 'amd64v2'; do | ||
run ./dj_make_chroot $COMMANDARGS -a $unsupported_arch | ||
assert_failure | ||
assert_partial "Error: Architecture $unsupported_arch not supported for" | ||
done | ||
} | ||
|
||
# Creation of the chroot is slow so we run all tests inside 1 large test to speedup. | ||
@test "Test chroot works with args: $COMMANDARGS" { | ||
run ./dj_make_chroot $COMMANDARGS | ||
assert_partial "Done building chroot in $CHROOT" | ||
assert_success | ||
if [ -n "${ARCH+x}" ]; then | ||
run ./dj_run_chroot "dpkg --print-architecture" | ||
assert_partial "$ARCH" | ||
assert_success | ||
else | ||
HOSTARCH=$(dpkg --print-architecture) | ||
run ./dj_run_chroot "dpkg --print-architecture" | ||
assert_partial "$HOSTARCH" | ||
assert_success | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
. .github/jobs/ci_settings.sh | ||
|
||
if [ -n "$1" ] && [ "$1" != "default" ]; then | ||
export ARCH="$1" | ||
fi | ||
|
||
function finish() { | ||
echo -e "\\n\\n=======================================================\\n" | ||
echo "Storing artifacts..." | ||
trace_on | ||
set +e | ||
cp /proc/cmdline "$ARTIFACTS/cmdline" | ||
cp /__w/domjudge/domjudge/chroot/domjudge/etc/apt/sources.list "$ARTIFACTS/sources.list" | ||
cp /__w/domjudge/domjudge/chroot/domjudge/debootstrap/debootstrap.log "$ARTIFACTS/debootstrap.log" | ||
} | ||
|
||
FAILED=0 | ||
|
||
trap finish EXIT | ||
|
||
DIR=$PWD | ||
section_start "Debug info" | ||
lsb_release -a | tee -a "$ARTIFACTS/debug-info" | ||
mount | tee -a "$ARTIFACTS/debug-info" | ||
whoami | tee -a "$ARTIFACTS/debug-info" | ||
echo "Dir: $DIR" | tee -a "$ARTIFACTS/debug-info" | ||
section_end | ||
|
||
section_start "Basic judgehost install" | ||
chown -R domjudge ./ | ||
|
||
# configure, make and install (but skip documentation) | ||
sudo -u domjudge make configure | ||
sudo -u domjudge ./configure --with-baseurl='http://localhost/domjudge/' --with-domjudge-user=domjudge --with-judgehost_chrootdir=${DIR}/chroot/domjudge |& tee "$ARTIFACTS/configure.log" | ||
sudo -u domjudge make judgehost |& tee "$ARTIFACTS/make.log" | ||
make install-judgehost |& tee -a "$ARTIFACTS/make.log" | ||
section_end setup | ||
|
||
section_start "Configure chroot" | ||
|
||
cd /opt/domjudge/judgehost/bin || exit 1 | ||
section_end chroot | ||
|
||
section_start "Show minimal chroot" | ||
./dj_make_chroot -a "$ARCH" | tee -a "$ARTIFACTS"/chroot.log | ||
section_end | ||
|
||
section_start "Test chroot contents" | ||
set -xe | ||
cp ${DIR}/submit/assert.bash . | ||
cp ${DIR}/.github/jobs/chroot.bats . | ||
bats ./chroot.bats | ||
section_end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.