Skip to content

Commit

Permalink
Use hardcopy of the GHA jobs on main
Browse files Browse the repository at this point in the history
Based on: 7d7ed2e
  • Loading branch information
vmcj committed Dec 11, 2024
1 parent dc75869 commit 5fbe455
Show file tree
Hide file tree
Showing 28 changed files with 1,177 additions and 116 deletions.
42 changes: 28 additions & 14 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,46 @@ assignees: ''

---

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

### Description of the problem
> Replace this line with a short description.
<!--
Write here a short description.
-->

### Your environment
> Include details about your installation here.
> - DOMjudge version (e.g. 7.0.0 or a github commit hash)
> - Operating system / Linux distribution and version (e.g. Ubuntu 18.04)
> - Webserver (e.g. Apache or nginx)
<!--
Include details about your installation here.
- DOMjudge version (e.g. 7.0.0 or a github commit hash)
- Operating system / Linux distribution and version (e.g. Ubuntu 18.04)
- Webserver (e.g. Apache or nginx)
-->

### Steps to reproduce
> Replace this with a description how we can reproduce your bug.
> - Step 1
> - Step 2
> - Step 3
<!--
Write here a description how we can reproduce your bug.
1. Step 1
1. Step 2
1. Step 3
-->

### Expected behaviour
> Replace this line with what you would expect to happen.
<!--
Write here what you would expect to happen.
-->

### Actual behaviour
> Replace this line with what happens instead.
<!--
Write here what happens instead.
-->

### Any other information that you want to share?
> Please include webserver, symfony and judgedaemon log snippets here as appropriate.
> Screenshots may help in case of UI bugs.
<!--
Please include webserver, symfony and judgedaemon log snippets here as appropriate.
Screenshots may help in case of UI bugs.
-->
27 changes: 19 additions & 8 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,36 @@ assignees: ''

---

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

### Description of the enhancement request
> Replace this line with a short description.
<!--
Write here a short description.
-->

### The goal you want to achieve
> 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.
<!--
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.
-->

### Expected behaviour
> Replace this line with what you would expect to happen.
> Please describe the workflow how you want this feature to work with expected start URL
> - Step 1
> - Step 2
<!--
Write here what you would expect to happen.
For example describe the flow how you want this feature to work.
1. Step 1
2. Step 2
-->

### Any other information that you want to share?
> Screenshots may help in case of UI enhancements with annotated drawings.
<!--
Screenshots with annotated drawings may help in case of UI enhancements.
-->
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,12 @@ updates:
allow:
- dependency-type: "all"
target-branch: "8.2"
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 0
versioning-strategy: lockfile-only
allow:
- dependency-type: "all"
target-branch: "8.3"
33 changes: 9 additions & 24 deletions .github/jobs/baseinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,6 @@

. .github/jobs/ci_settings.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 '

export version="$1"
db=${2:-install}
phpversion="${3:-8.1}"
Expand All @@ -40,7 +23,9 @@ show_phpinfo "$phpversion"

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 Down Expand Up @@ -124,15 +109,15 @@ section_end
section_start "Setup webserver"
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"
Expand Down
55 changes: 55 additions & 0 deletions .github/jobs/chroot.bats
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
}
55 changes: 55 additions & 0 deletions .github/jobs/chroot_checks.sh
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
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
Loading

0 comments on commit 5fbe455

Please sign in to comment.