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

View file

@ -92,8 +92,8 @@ jobs:
*.deb.sha256 *.deb.sha256
repo-deb/*.deb repo-deb/*.deb
installtest-bookworm-sqlite: multitest-bookworm-lxc:
runs-on: bookworm runs-on: lxc-bookworm
needs: [build-forgejo-deb] needs: [build-forgejo-deb]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -107,8 +107,38 @@ jobs:
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 - 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 runs-on: bullseye
needs: [build-forgejo-deb] needs: [build-forgejo-deb]
steps: steps:
@ -120,65 +150,24 @@ jobs:
- uses: actions/download-artifact@v3 - uses: actions/download-artifact@v3
with: 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 - 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 force-clean-forgejo
- run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb - run: ./.ci-make.sh full-instance-clean
- run: ./.ci-make.sh verify-data-dir-chmod - 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 runs-on: buster
needs: [build-forgejo-deb] needs: [build-forgejo-deb]
env:
TEST_DEBIAN_BUSTER: 1
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -188,31 +177,21 @@ jobs:
- uses: actions/download-artifact@v3 - uses: actions/download-artifact@v3
with: 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 - run: ./.ci-make.sh install-run-test ./forgejo-sqlite_*_amd64.deb
- run: ./.ci-make.sh force-clean-forgejo
complextest-split-deb-upgrade: - run: ./.ci-make.sh full-instance-clean
runs-on: bookworm - run: ./.ci-make.sh install-run-test ./forgejo_*_amd64.deb
needs: [build-forgejo-deb] - run: ./.ci-make.sh force-clean-forgejo
steps: - run: ./.ci-make.sh full-instance-clean
- uses: actions/checkout@v4 - run: ./.ci-make.sh install-run-test ./forgejo-bin_*_amd64.deb
- run: ./.ci-make.sh force-clean-forgejo
- 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 full-instance-clean - run: ./.ci-make.sh full-instance-clean
- run: ./.ci-make.sh complex-test split-deb-upgrade
publish-release-repo: publish-release-repo:
runs-on: bookworm 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' if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') && github.repository == 'forgejo-contrib/forgejo-deb'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4