Skip to content

Commit d16fcab

Browse files
Michael Vasseurvmcj
authored andcommitted
Run chroot tests in GHA
We ran those in GitLab but now that the integration test works we can also move those. The crossbuilding fails but this is more related to the runners (although it also fails locally) as the container is still the same. After discussion we don't really care for this feature so I left 1 to check that the flag works but this is building the same as the hostarchitecture. The debootstrap.log is not uploaded for now. Don't crossbuild but only test 1
1 parent 7353579 commit d16fcab

File tree

6 files changed

+87
-66
lines changed

6 files changed

+87
-66
lines changed

gitlab/chroot.bats renamed to .github/jobs/chroot.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
load 'assert'
44

55
CHROOT="/chroot/domjudge"
6-
if [ -n "${CI_JOB_ID+x}" ]; then
7-
CHROOT="/builds/DOMjudge/domjudge${CHROOT}"
6+
if [ -n "${GITHUB_REPOSITORY+x}" ]; then
7+
CHROOT="/__w/domjudge/domjudge${CHROOT}"
88
fi
99
# Cleanup old dir
1010
rm -rf $CHROOT

.github/jobs/chroot_checks.sh

Lines changed: 55 additions & 0 deletions
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/workflows/chroot-checks.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Chroot checks
2+
on:
3+
push:
4+
pull_request:
5+
branches:
6+
- main
7+
- '[0-9]+.[0-9]+'
8+
9+
jobs:
10+
check-chroot-arch:
11+
runs-on: ubuntu-latest
12+
container:
13+
image: domjudge/gitlabci:24.04
14+
options: --privileged --cgroupns=host --init
15+
strategy:
16+
matrix:
17+
arch: [amd64, default]
18+
steps:
19+
- name: Checkout current code
20+
uses: actions/checkout@v4
21+
- name: Install DOMjudge
22+
run: |
23+
.github/jobs/chroot_checks.sh ${{ matrix.arch }}
24+
- name: Upload all logs/artifacts
25+
if: ${{ !cancelled() }}
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: ${{ matrix.arch }}-logs
29+
path: |
30+
/tmp/artifacts

.gitlab-ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
include:
22
- '/gitlab/ci/unit.yml'
33
- '/gitlab/ci/template.yml'
4-
- '/gitlab/ci/misc.yml'
54

65
stages:
76
- test
8-
- chroot_checks
97
- unit
108
- style
119
- ci_checks

gitlab/chroot_checks.sh

Lines changed: 0 additions & 45 deletions
This file was deleted.

gitlab/ci/misc.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)