packages: Add E2E test for Alpine package with noarch
Refs: https://code.forgejo.org/forgejo/end-to-end/pulls/75
This commit is contained in:
parent
5bb5e037ce
commit
b563e5cd19
13 changed files with 145 additions and 6 deletions
63
packages/alpine-7.0-test/test.sh
Executable file
63
packages/alpine-7.0-test/test.sh
Executable file
|
@ -0,0 +1,63 @@
|
|||
#!/bin/busybox ash
|
||||
set -exuo pipefail
|
||||
|
||||
forgejo_url=$1
|
||||
forgejo_token=$2
|
||||
|
||||
# initialize abuild
|
||||
apk update
|
||||
apk add --no-cache alpine-sdk sudo util-linux
|
||||
adduser -D user -h /home/user
|
||||
addgroup user abuild
|
||||
echo "root ALL=(ALL) ALL" >/etc/sudoers
|
||||
echo "%abuild ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers
|
||||
mkdir -p /var/cache/distfiles
|
||||
chgrp abuild /var/cache/distfiles
|
||||
chmod 775 /var/cache/distfiles
|
||||
mkdir -p "/home/user/.abuild"
|
||||
echo "/home/user/.abuild/user.rsa" | abuild-keygen -i -b 4096
|
||||
echo 'PACKAGER_PRIVKEY=/home/user/.abuild/user.rsa' >/home/user/.abuild/abuild.conf
|
||||
chown -R "user:user" /home/user/
|
||||
|
||||
# make sure we own the relevant directory
|
||||
cp -r package-source /srv/alpine
|
||||
cd /srv
|
||||
mkdir packages
|
||||
echo "REPODEST=/srv/packages" >>/home/user/.abuild/abuild.conf
|
||||
cat /home/user/.abuild/abuild.conf
|
||||
chown -R user:user alpine packages
|
||||
|
||||
# build the package
|
||||
sudo -u user APKBUILD=alpine/forgejo-2174/APKBUILD abuild -r
|
||||
|
||||
# build the package
|
||||
sudo -u user APKBUILD=alpine/forgejo-2173/APKBUILD abuild -r
|
||||
|
||||
# upload new package
|
||||
cd packages/alpine/x86_64/
|
||||
for file in $(find . -name '*.apk' -type f | sed -e 's,./,,'); do
|
||||
# remove old package
|
||||
curl \
|
||||
--fail \
|
||||
-H "Authorization: token $forgejo_token" \
|
||||
-X DELETE \
|
||||
"$forgejo_url/api/packages/root/alpine/3.19/e2e-tests/$file" \
|
||||
|| true
|
||||
|
||||
# upload new package
|
||||
curl \
|
||||
--fail \
|
||||
-H "Authorization: token $forgejo_token" \
|
||||
-T "$file" \
|
||||
"$forgejo_url/api/packages/root/alpine/3.19/e2e-tests"
|
||||
done
|
||||
|
||||
# ensure that the install-if condition works as expected
|
||||
apk add openrc
|
||||
(cd /etc/apk/keys && curl -JO $forgejo_url/api/packages/root/alpine/key)
|
||||
echo "$forgejo_url/api/packages/root/alpine/3.19/e2e-tests" >>/etc/apk/repositories
|
||||
apk add forgejo-2174 forgejo-2173
|
||||
[ -e /usr/bin/forgejo_2174 ] # from the installed package
|
||||
[ -e /usr/bin/forgejo_2173 ] # from the installed package
|
||||
[ -e /etc/init.d/forgejo_2174 ] # from the -openrc package installed because of the install-if condition
|
||||
[ -e /etc/init.d/forgejo_2173 ] # from the -openrc package installed because of the install-if condition
|
Loading…
Add table
Reference in a new issue