[squash] [actions] combine test jobs and use LXC for systemd tests

This commit is contained in:
crystal 2024-11-20 04:21:37 -07:00
parent 47394d5dfb
commit 552135dc7b
No known key found for this signature in database
GPG key ID: 1122054731F7CC43
2 changed files with 95 additions and 101 deletions

View file

@ -26,13 +26,13 @@ case "$1" in
"actions-prep")
case "$2" in
"build-forgejo-deb")
APREP_APT_EXTRAS="debhelper devscripts sudo"
APREP_APT_EXTRAS="debhelper devscripts sudo retry"
;;
"installtest")
APREP_APT_EXTRAS="sudo"
;;
"complextest")
APREP_APT_EXTRAS="sudo wget"
if [ ! "$TEST_DEBIAN_BUSTER" ] ; then
APREP_APT_EXTRAS="$APREP_APT_EXTRAS retry"
fi
;;
"")
APREP_APT_EXTRAS=
@ -212,19 +212,29 @@ case "$1" in
fi
fi
apt install -y $APT_FORGEJO_COMMON ./"$2"
if [ -f "/etc/default/forgejo" ] || [ "$2" != "${2#"./forgejo-bin_"}" ] ; then
[ -f "/etc/default/forgejo" ] && . /etc/default/forgejo
[ -z "$FORGEJO_HOME" ] && FORGEJO_HOME=/var/lib/forgejo
[ -z "$FORGEJO_USER" ] && FORGEJO_USER=forgejo
sudo -u $FORGEJO_USER USER=$FORGEJO_USER \
HOME=$FORGEJO_HOME FORGEJO_WORK_DIR=$FORGEJO_HOME \
forgejo web -q --config /etc/forgejo/app.ini &
else
echo "No env setup! Run testing defaults using hardcoded vars..."
sudo -u forgejo USER=forgejo forgejo web -q &
if [ -f "/.dockerenv" ] ; then
if [ -f "/etc/default/forgejo" ] || [ "$2" != "${2#"./forgejo-bin_"}" ] ; then
[ -f "/etc/default/forgejo" ] && . /etc/default/forgejo
[ -z "$FORGEJO_HOME" ] && FORGEJO_HOME=/var/lib/forgejo
[ -z "$FORGEJO_USER" ] && FORGEJO_USER=forgejo
sudo -u $FORGEJO_USER USER=$FORGEJO_USER \
HOME=$FORGEJO_HOME FORGEJO_WORK_DIR=$FORGEJO_HOME \
forgejo web -q --config /etc/forgejo/app.ini &
else
echo "No env setup! Run testing defaults using hardcoded vars..."
sudo -u forgejo USER=forgejo forgejo web -q &
fi
sleep 1
fi
if [ "$TEST_DEBIAN_BUSTER" ] ; then
curl http://localhost:3000/ | grep -A 4 "Powered by Forgejo"
if [ "$?" != "0" ] ; then
sleep 3
curl http://localhost:3000/ | grep -A 4 "Powered by Forgejo"
fi
else
retry -d 2 -t 2 curl http://localhost:3000/ | grep -A 4 "Powered by Forgejo"
fi
sleep 10
curl http://localhost:3000/ | grep -A 4 "Powered by Forgejo"
exit $?
;;
"install-repo-test")
@ -236,11 +246,13 @@ case "$1" in
apt upgrade -y
apt update -qq
apt install -y "$3"
sudo -u forgejo USER=forgejo \
HOME=/var/lib/forgejo FORGEJO_WORK_DIR=/var/lib/forgejo \
forgejo web -q --config /etc/fogejo/app.ini &
sleep 10
curl http://localhost:3000/ | grep -A 4 "Powered by Forgejo"
if [ -f "/.dockerenv" ] ; then
sudo -u forgejo USER=forgejo \
HOME=/var/lib/forgejo FORGEJO_WORK_DIR=/var/lib/forgejo \
forgejo web -q --config /etc/fogejo/app.ini &
sleep 1
fi
retry -d 2 -t 2 curl http://localhost:3000/ | grep -A 4 "Powered by Forgejo"
exit $?
;;
"verify-data-dir-chmod")
@ -300,9 +312,12 @@ case "$1" in
apt purge -y forgejo forgejo-sqlite forgejo-common forgejo-bin
rm -rf /var/lib/forgejo
rm -rf /etc/forgejo /etc/default/forgejo /etc/systemd/system/forgejo.service.d
sudo deluser forgejo
if [ "$2" = "userinst" ] ; then
sudo deluser git
else
sudo deluser forgejo
fi
apt purge -y forgejo-deb-repo forgejo-deb-repokey
exit 0
;;
esac

View file

@ -92,8 +92,8 @@ jobs:
*.deb.sha256
repo-deb/*.deb
installtest-bookworm-sqlite:
runs-on: bookworm
multitest-bookworm-lxc:
runs-on: lxc-bookworm
needs: [build-forgejo-deb]
steps:
- uses: actions/checkout@v4
@ -107,8 +107,38 @@ jobs:
name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}
- run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
- run: ./.ci-make.sh full-instance-clean
- run: ./.ci-make.sh install-run-test ./forgejo_*_amd64.deb
- run: ./.ci-make.sh full-instance-clean
- run: ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
- run: ./.ci-make.sh full-instance-clean
- run: ./.ci-make.sh test-userinst-prep
- run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
- run: ./.ci-make.sh full-instance-clean userinst
- run: ./.ci-make.sh test-userinst-prep
- run: ./.ci-make.sh install-run-test ./forgejo_*_amd64.deb
- run: ./.ci-make.sh full-instance-clean userinst
- run: ./.ci-make.sh test-userinst-prep
- run: ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
- run: ./.ci-make.sh full-instance-clean userinst
- run: ./.ci-make.sh install-repo-test ./repo-deb/forgejo-deb-repo_0-0_all.deb forgejo-sqlite
- run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
- run: ./.ci-make.sh verify-data-dir-chmod
- run: ./.ci-make.sh full-instance-clean
- run: ./.ci-make.sh install-repo-test ./repo-deb/forgejo-deb-repo_0-0_all.deb forgejo
- run: ./.ci-make.sh install-run-test ./forgejo_*_amd64.deb
- run: ./.ci-make.sh verify-data-dir-chmod
- run: ./.ci-make.sh full-instance-clean
- run: ./.ci-make.sh install-repo-test ./repo-deb/forgejo-deb-repo_0-0_all.deb forgejo-bin
- run: ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
- run: ./.ci-make.sh verify-data-dir-chmod
- run: ./.ci-make.sh full-instance-clean
- run: ./.ci-make.sh complex-test split-deb-upgrade -sqlite
- run: ./.ci-make.sh full-instance-clean
- run: ./.ci-make.sh complex-test split-deb-upgrade
- run: ./.ci-make.sh full-instance-clean
installtest-bullseye-sqlite:
multitest-bullseye-docker:
runs-on: bullseye
needs: [build-forgejo-deb]
steps:
@ -120,65 +150,24 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}
name: forgejo-deb-${{steps.ciprep.outputs.artifactlabel }}
- run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
installtest-buster-sqlite:
runs-on: buster
needs: [build-forgejo-deb]
steps:
- uses: actions/checkout@v4
- name: "actions prep: installtest"
id: ciprep
run: ./.ci-make.sh actions-prep installtest
- uses: actions/download-artifact@v3
with:
name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}
- run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
installtest-bookworm-user:
runs-on: bookworm
needs: [build-forgejo-deb]
steps:
- uses: actions/checkout@v4
- name: "actions prep: installtest"
id: ciprep
run: ./.ci-make.sh actions-prep installtest
- uses: actions/download-artifact@v3
with:
name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}
- run: ./.ci-make.sh test-userinst-prep
- run: ./.ci-make.sh install-run-test ./forgejo_*_amd64.deb
testsuite-repo-upgrade-sqlite:
runs-on: bookworm
needs: [build-forgejo-deb]
steps:
- uses: actions/checkout@v4
- name: "actions prep: installtest"
id: ciprep
run: ./.ci-make.sh actions-prep installtest
- uses: actions/download-artifact@v3
with:
name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}
- run: ./.ci-make.sh install-repo-test ./repo-deb/forgejo-deb-repo_0-0_all.deb forgejo-sqlite
- run: ./.ci-make.sh force-clean-forgejo
- run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
- run: ./.ci-make.sh verify-data-dir-chmod
- run: ./.ci-make.sh full-instance-clean
- run: ./.ci-make.sh install-run-test ./forgejo_*_amd64.deb
- run: ./.ci-make.sh force-clean-forgejo
- run: ./.ci-make.sh full-instance-clean
- run: ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
- run: ./.ci-make.sh force-clean-forgejo
- run: ./.ci-make.sh full-instance-clean
installtest-buster-bin:
multitest-buster-docker:
runs-on: buster
needs: [build-forgejo-deb]
env:
TEST_DEBIAN_BUSTER: 1
steps:
- uses: actions/checkout@v4
@ -188,31 +177,21 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}
name: forgejo-deb-${{steps.ciprep.outputs.artifactlabel }}
- run: ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
complextest-split-deb-upgrade:
runs-on: bookworm
needs: [build-forgejo-deb]
steps:
- uses: actions/checkout@v4
- name: "actions prep: installtest"
id: ciprep
run: ./.ci-make.sh actions-prep installtest
- uses: actions/download-artifact@v3
with:
name: forgejo-deb-${{ steps.ciprep.outputs.artifactlabel }}
- run: ./.ci-make.sh complex-test split-deb-upgrade -sqlite
- run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
- run: ./.ci-make.sh force-clean-forgejo
- run: ./.ci-make.sh full-instance-clean
- run: ./.ci-make.sh install-run-test ./forgejo_*_amd64.deb
- run: ./.ci-make.sh force-clean-forgejo
- run: ./.ci-make.sh full-instance-clean
- run: ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
- run: ./.ci-make.sh force-clean-forgejo
- run: ./.ci-make.sh full-instance-clean
- run: ./.ci-make.sh complex-test split-deb-upgrade
publish-release-repo:
runs-on: bookworm
needs: [installtest-bookworm-sqlite, installtest-bullseye-sqlite, installtest-buster-sqlite, installtest-bookworm-user, testsuite-repo-upgrade-sqlite, installtest-buster-bin, complextest-split-deb-upgrade]
needs: [multitest-bookworm-lxc, multitest-bullseye-docker, multitest-buster-docker]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') && github.repository == 'forgejo-contrib/forgejo-deb'
steps:
- uses: actions/checkout@v4