Skip to content

Commit

Permalink
github: Implement workflow for building all tags.
Browse files Browse the repository at this point in the history
This currently only supports v21.7.0 onwards.  Supporting older releases
will be more difficult, but will hopefully be done at some point.
  • Loading branch information
jperkin committed Dec 12, 2024
1 parent 04a1569 commit e839085
Showing 1 changed file with 121 additions and 0 deletions.
121 changes: 121 additions & 0 deletions .github/workflows/build-pkgin-tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Build all pkgin release tags
on:
workflow_dispatch:
jobs:
build-tags:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up host
run: |
sudo apt-get update
sudo apt-get install -y \
bmake \
build-essential \
cvs \
libarchive-dev \
libsqlite3-dev \
libssl-dev
mkdir ~/.ssh
ssh-keyscan anoncvs.netbsd.org >>~/.ssh/known_hosts
cvs -d [email protected]:/cvsroot co -P \
pkgsrc/net/libfetch/files \
pkgsrc/pkgtools/libnbcompat/files \
pkgsrc/pkgtools/pkg_install/files \
pkgsrc/security/netpgpverify/files
(
cd pkgsrc/pkgtools/libnbcompat/files
./configure --enable-db
bmake
)
CFLAGS="-DHAVE_NBCOMPAT_H=1"
CFLAGS="${CFLAGS} -I${GITHUB_WORKSPACE}/pkgsrc/pkgtools/libnbcompat/files"
export CFLAGS
(
cd pkgsrc/net/libfetch/files
export BINOWN="$(id -un)"
export ROOT_GROUP="$(id -gn)"
bmake
bmake DESTDIR=/tmp/destdir install
)
(
cd pkgsrc/security/netpgpverify/files
./configure
bmake
bmake -f Makefile.lib.in
)
(
cd pkgsrc/pkgtools/pkg_install/files
sed -i -e '/optreset/d' admin/audit.c
ln -s ${GITHUB_WORKSPACE}/pkgsrc/security/netpgpverify/files lib/netpgp
cp ${GITHUB_WORKSPACE}/pkgsrc/security/netpgpverify/files/libnetpgpverify.a lib
CFLAGS="${CFLAGS} -I${GITHUB_WORKSPACE}/pkgsrc/net/libfetch/files"
CFLAGS="${CFLAGS} -I/tmp/destdir/usr/include"
LDFLAGS="-L${GITHUB_WORKSPACE}/pkgsrc/pkgtools/libnbcompat/files"
LDFLAGS="${LDFLAGS} -L/tmp/destdir/usr/lib"
export LDFLAGS
export LIBS="-lnbcompat"
./configure --prefix=/usr
bmake
bmake DESTDIR=/tmp/destdir install
)
- name: Build each tag
run: |
mkdir bin
for tag in $(git tag | grep ^v); do
# TODO: < v0.10 require patches for PKGIN_DBDIR / PKG_INSTALL_DIR
case "${tag}" in
v0.[0-9].*)
continue
;;
# TODO: some issues with the Makefile
v0.*)
continue
;;
# TODO: pre-automake, do not support out-of-srcdir
v20.*)
continue
;;
esac
git checkout $tag
mkdir build
(
cd build
CONFIGURE_ARGS="--prefix=/usr/local"
case "${tag}" in
v0.*)
CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-libraries=/tmp/destdir/usr/lib"
CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-includes=/tmp/destdir/usr/include"
CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-pkginstall=/tmp/destdir/usr/sbin"
;;
*)
CONFIGURE_ARGS="${CONFIGURE_ARGS} --disable-maintainer-mode"
CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-dbdir=/usr/local/.pkgdb"
CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-libarchive=/usr"
CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-libfetch=/tmp/destdir/usr"
CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-openssl=/usr"
CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-sqlite3=/usr"
CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-machine-arch=x86_64"
CONFIGURE_ARGS="${CONFIGURE_ARGS} --with-pkg-install=/tmp/destdir/usr/sbin"
;;
esac
env \
CFLAGS="-DHAVE_NBCOMPAT_H=1 -I${GITHUB_WORKSPACE}/pkgsrc/pkgtools/libnbcompat/files" \
LDFLAGS="-L${GITHUB_WORKSPACE}/pkgsrc/pkgtools/libnbcompat/files" \
LIBS="-lnbcompat" \
../configure ${CONFIGURE_ARGS} || (cat config.log && ./configure --help && false)
bmake || make V=1
)
mv build/pkgin bin/pkgin-"$tag"
rm -rf build
done
cp /tmp/destdir/usr/sbin/pkg_* ./bin
tar -czvf pkgin-bins.tar.gz ./bin
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: pkgin-binaries
path: pkgin-bins.tar.gz

0 comments on commit e839085

Please sign in to comment.