Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep the owner:group of the one downloading the tarball #2303

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
2bcbb4d
Build example test release for configure/make tests
vmcj Mar 9, 2025
a99acfa
Test with other linux distros
vmcj Mar 9, 2025
f8ba11f
Keep the owner:group of the one downloading the tarball
vmcj Jan 21, 2024
290a870
Extra function to detect make errors
vmcj Mar 9, 2025
b1ce185
Fixup
vmcj Mar 9, 2025
29fd64e
Extra test
vmcj Mar 9, 2025
1fc9a74
Fxiup
vmcj Mar 2, 2025
9d3d030
Try to only trigger fedora in merge-queue
vmcj Mar 9, 2025
4b09992
Cleanup
vmcj Mar 9, 2025
15bb6b6
Update autoconf-check.yml
vmcj Mar 9, 2025
7ae40c9
Update autoconf-check.yml
vmcj Mar 9, 2025
5a23d5c
Update setup_configure_image.sh
vmcj Mar 9, 2025
bcf208d
Update autoconf-check.yml
vmcj Mar 9, 2025
20664ad
Gentoo does not have enough marketshare
vmcj Mar 9, 2025
e0747e2
Update setup_configure_image.sh
vmcj Mar 9, 2025
c26e4f2
Update setup_configure_image.sh
vmcj Mar 9, 2025
dc782a3
Update setup_configure_image.sh
vmcj Mar 9, 2025
435df91
Update setup_configure_image.sh
vmcj Mar 9, 2025
b209cf2
Update all.bats
vmcj Mar 9, 2025
0acd88f
Update autoconf-check.yml
vmcj Mar 9, 2025
3073deb
Update autoconf-check.yml
vmcj Mar 9, 2025
7e60dc0
Update all.bats
vmcj Mar 9, 2025
2583f8b
Update setup_configure_image.sh
vmcj Mar 9, 2025
614500b
Ignore other CI jobs
vmcj Mar 9, 2025
b62a451
Update setup_configure_image.sh
vmcj Mar 10, 2025
5c09805
Update setup_configure_image.sh
vmcj Mar 10, 2025
0366b5a
Update all.bats
vmcj Mar 10, 2025
007f486
Update all.bats
vmcj Mar 10, 2025
4981582
Update all.bats
vmcj Mar 10, 2025
01d1168
Update all.bats
vmcj Mar 11, 2025
11b263c
Update all.bats
vmcj Mar 11, 2025
02080cf
Update all.bats
vmcj Mar 11, 2025
ccdf41f
Update Makefile
vmcj Apr 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 121 additions & 4 deletions .github/jobs/configure-checks/all.bats
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,24 @@ cmd="apt-get"
if [ "$distro_id" = "ID=fedora" ]; then
cmd=dnf
fi
if [ "$distro_id" = "ID=arch" ]; then
cmd=pacman --non-interactive
fi
if [ "$distro_id" = 'ID="opensuse-leap"' ]; then
cmd=zypper
fi

translate () {
args="$@"
if [ "$distro_id" = "ID=fedora" ]; then
if [ "$distro_id" = 'ID="opensuse-leap"' ]; then
args=${args/g++/gcc-c++}
fi
if [ "$distro_id" = "ID=fedora" ] || [ "$distro_id" = 'ID="opensuse-leap"' ]; then
args=${args/libcgroup-dev/libcgroup-devel}
fi
if [ "$distro_id" = "ID=arch" ]; then
args=${args/libcgroup-dev/}
fi
echo "$args"
}

Expand All @@ -37,6 +49,9 @@ setup() {
if [ "$distro_id" = "ID=fedora" ]; then
repo-install httpd
fi
if [ "$distro_id" = 'ID="opensuse-leap"' ]; then
repo-install apache2
fi
repo-install gcc g++ libcgroup-dev composer
}

Expand All @@ -46,16 +61,36 @@ run_configure () {

repo-install () {
args=$(translate $@)
${cmd} install $args -y >/dev/null
if [ "$distro_id" = "ID=arch" ]; then
${cmd} $args -Sy --noconfirm >/dev/null
else
${cmd} install -y $args >/dev/null
fi
}

repo-remove () {
args=$(translate $@)
${cmd} remove $args -y #>/dev/null
if [ "$distro_id" = 'ID="opensuse-leap"' ]; then
${cmd} remove -y $args >/dev/null || ret="$?"
if [ "$ret" -ne "104" ]; then
return $?
fi
else
${cmd} remove -y $args #>/dev/null
fi
if [ "$distro_id" != "ID=fedora" ]; then
apt-get autoremove -y 2>/dev/null
fi
}

run_user_stderr () {
su $u -c "$*" 2>&1
}

run_stderr () {
run "$* 2>&1"
}

@test "Default empty configure" {
# cleanup from earlier runs
repo-remove gcc g++ clang
Expand Down Expand Up @@ -111,7 +146,7 @@ compile_assertions_finished () {
}

@test "Install GNU C only" {
if [ "$distro_id" = "ID=fedora" ]; then
if [ "$distro_id" = "ID=fedora" ] || [ "$distro_id" = "ID=arch" ]; then
# Fedora ships with a gcc with enough C++ support
skip
fi
Expand Down Expand Up @@ -418,6 +453,7 @@ compile_assertions_finished () {
assert_line " * judgehost...........: /opt/domjudge/judgehost"
assert_line " * runguard group......: domjudge-run"
run make domserver
assert_regex "^.*cp -a vendor/nelmio/api-doc-bundle/public/\* public/bundles/nelmioapidoc.*$"
assert_success
run make judgehost
assert_success
Expand Down Expand Up @@ -458,3 +494,84 @@ compile_assertions_finished () {
run make judgehost
assert_failure
}

#@test "'Make distclean' has all permissions" {
#
#
#
# if [ "$distro_id" = "ID=fedora" ]; then
#
#
# # Fails as libraries are not found
#
#
# skip
#
#
# fi
#
#
# setup
#
#
# run run_configure
#
#
# run_user_stderr make domserver
#
#
# make install-domserver
#
#
# run_user_stderr make distclean
#
#
# refute_partial "cannot remove"
#
#
# refute_partial "Permission denied"
#
#
# assert_success
#
#
#}
#
#
#
#
#
#@test "'Make distclean' has permission errors" {
#
#
# if [ "$distro_id" = "ID=fedora" ]; then
#
#
# # Fails as libraries are not found
#
#
# skip
#
#
# fi
#
#
# setup
#
#
# run run_configure
#
#
# run_stderr make install-domserver
#
#
# run_user_stderr make distclean
#
#
# assert_partial "cannot remove"
#
#
# assert_partial "Permission denied"
#
#
#}
13 changes: 7 additions & 6 deletions .github/jobs/configure-checks/setup_configure_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ distro_id=$(grep "^ID=" /etc/os-release)

# Install everything for configure and testing
case $distro_id in
"ID=arch")
pacman -Sy --noconfirm make bats tar ;;
"ID=fedora")
dnf install pkg-config make bats autoconf automake util-linux -y ;;
dnf install make bats -y ;;
'ID="opensuse-leap"')
zypper install -y make bats ;;
*)
apt-get update; apt-get full-upgrade -y
apt-get install pkg-config make bats autoconf -y ;;
apt-get install make bats -y ;;
esac

# Build the configure file
make configure

# Install extra assert statements for bots
cp submit/assert.bash .github/jobs/configure-checks/

# Run the configure tests for this usecase
test_path="/__w/domjudge/domjudge" bats .github/jobs/configure-checks/all.bats
test_path="/__w/domjudge/domjudge/release" bats .github/jobs/configure-checks/all.bats
23 changes: 0 additions & 23 deletions .github/workflows/autoconf-check-different-distro.yml

This file was deleted.

105 changes: 102 additions & 3 deletions .github/workflows/autoconf-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,93 @@ on:
- '[0-9]+.[0-9]+'

jobs:
build:
runs-on: ubuntu-latest
container:
image: domjudge/gitlabci:24.04
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Create the distribution tarball
run: |
make dist
cd ..
mv domjudge release
mkdir domjudge #Workdir for next steps
tar -cf release.tar release
gzip -9 release.tar
mv release.tar.gz domjudge/
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
compression-level: 0
name: test-tarball
path: ${{ github.workspace }}/release.tar.gz

suse-family:
needs: build
strategy:
matrix:
version: [latest]
os: [opensuse/leap]
runs-on: ubuntu-latest
container:
image: ${{ matrix.os }}:${{ matrix.version }}
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: test-tarball
- name: Install needed unpack tools
run: zypper install -y tar gzip
- name: Unpack the "Release" tarball
run: tar xvf release.tar.gz
- name: Setup image and run bats tests
working-directory: release
run: .github/jobs/configure-checks/setup_configure_image.sh

arch-family:
needs: build
strategy:
matrix:
version: [latest]
os: [archlinux]
runs-on: ubuntu-latest
container:
image: ${{ matrix.os }}:${{ matrix.version }}
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: test-tarball
- name: Unpack the "Release" tarball
run: tar xvf release.tar.gz
- name: Setup image and run bats tests
working-directory: release
run: .github/jobs/configure-checks/setup_configure_image.sh

redhat-family:
needs: build
strategy:
matrix:
version: [latest]
os: [fedora]
runs-on: ubuntu-latest
container:
image: ${{ matrix.os }}:${{ matrix.version }}
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: test-tarball
- name: Unpack the "Release" tarball
run: tar xvf release.tar.gz
- name: Setup image and run bats tests
working-directory: release
run: .github/jobs/configure-checks/setup_configure_image.sh

debian-family:
needs: build
strategy:
matrix:
version: [jammy, focal, rolling]
Expand All @@ -28,8 +114,21 @@ jobs:
container:
image: ${{ matrix.os }}:${{ matrix.version }}
steps:
- name: Install git so we get the .github directory
run: apt-get update; apt-get install -y git
- uses: actions/checkout@v4
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: test-tarball
- name: Unpack the "Release" tarball
run: |
ls -atrl
tar xvf release.tar.gz
- name: Setup image and run bats tests
working-directory: release
run: .github/jobs/configure-checks/setup_configure_image.sh

#
## Copy the fedora stuff here and use:
## if: github.event_name != 'merge_group' on the job level
##name: Build and Trigger Workflows
### Either just filter the fedora stuff in onther build step (and run on main but skip) or trigger 2 workflows. I don't work enough with GHA to see which one I prefer for now.
##
30 changes: 0 additions & 30 deletions .github/workflows/chroot-checks.yml
Original file line number Diff line number Diff line change
@@ -1,30 +0,0 @@
name: Chroot checks
on:
push:
pull_request:
branches:
- main
- '[0-9]+.[0-9]+'

jobs:
check-chroot-arch:
runs-on: ubuntu-24.04
container:
image: domjudge/gitlabci:24.04
options: --privileged --cgroupns=host --init
strategy:
matrix:
arch: [amd64, default]
steps:
- name: Checkout current code
uses: actions/checkout@v4
- name: Install DOMjudge
run: |
.github/jobs/chroot_checks.sh ${{ matrix.arch }}
- name: Upload all logs/artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}-logs
path: |
/tmp/artifacts
Loading
Loading