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

initial CI tests for OpenBSD #590

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
43 changes: 42 additions & 1 deletion ci/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,52 @@ freebsd_install() {
}

openbsd_install() {
echo ""
if [ "$(id -u)" -ne 0 ]; then
echo "need to run as root"
exit 1
fi

export PKG_PATH="https://cloudflare.cdn.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -m)"

# CI script and build dependencies
for pkg in bash git wget bzip2 cmake gmake gettext-tools libiconv; do
pkg_info | grep -q "${pkg}" && \
continue

pkg_add -I "${pkg}"
done

rm -f /bin/bash
ln -s /usr/local/bin/bash /bin/bash
grep -q "^/bin/bash" /etc/shells || \
echo "/bin/bash" >> /etc/shells

for pkg in automake gnupg; do
pkg_ver="$(pkg_add -In ${pkg} 2>&1 | grep ^Ambiguous | tr ' ' '\n' | grep ${pkg}- | sort -V | tail -1)"

pkg_info | grep -q "${pkg_ver}" && \
continue

echo "Installing: ${pkg_ver}"
pkg_add -I "${pkg_ver}"
done

# Create link to expected gpg binary name and location
rm -f ${GPG21_INSTALL}/bin/gpg
ln -s /usr/local/bin/gpg2 ${GPG21_INSTALL}/bin/gpg

# Python will be installed as a dependency of gnupg
rm -f /bin/python
ln -s /usr/local/bin/python2.7 /bin/python
}

netbsd_install() {
echo ""
pkgin -y install gnupg
pkgin -y install cmake
pkgin -y install gettext-tools
pkgin -y install clang
pkgin -y install wget
}

linux_install() {
Expand Down
1 change: 1 addition & 0 deletions ci/env-freebsd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ export BUILD_MODE=normal
export CLANG_FORMAT_DIFF="clang-format-diff-4.0"
export CC=clang
export MAKE=gmake

18 changes: 18 additions & 0 deletions ci/env-netbsd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh
set -ex

source /root/.profile

export PATH=/usr/local/bin:$PATH
export LOCAL_BUILDS=${WORKSPACE}/local-builds
export BOTAN_INSTALL="${LOCAL_BUILDS}/builds/botan-install"
export CMOCKA_INSTALL="${LOCAL_BUILDS}/builds/cmocka-install"
export JSONC_INSTALL="${LOCAL_BUILDS}/builds/json-c-install"
export GPG21_INSTALL="${LOCAL_BUILDS}/builds/gpg21-install"
export BUILD_MODE=normal
export CLANG_FORMAT_DIFF="clang-format-diff-4.0"
export CC=clang
export MAKE=gmake
export AUTOCONF_VERSION=2.69
export AUTOMAKE_VERSION=1.15
export GPG=gpg
20 changes: 20 additions & 0 deletions ci/env-openbsd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
set -ex

export PATH=/usr/local/bin:$PATH
export LOCAL_BUILDS=${WORKSPACE}/local-builds
export BOTAN_INSTALL="${LOCAL_BUILDS}/builds/botan-install"
export CMOCKA_INSTALL="${LOCAL_BUILDS}/builds/cmocka-install"
export JSONC_INSTALL="${LOCAL_BUILDS}/builds/json-c-install"
export GPG21_INSTALL="${LOCAL_BUILDS}/builds/gpg21-install"
export BUILD_MODE=normal
export CLANG_FORMAT_DIFF="clang-format-diff-4.0"
export CC=gcc
export MAKE=gmake

# TODO: make these read from pkg_info
export AUTOCONF_VERSION=2.69
export AUTOMAKE_VERSION=1.15

# TODO: use this environment variable in test scripts
export GPG=gpg2
17 changes: 10 additions & 7 deletions ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -exu

: "${CORES:=2}"
: "${MAKE:=make}"
: "${GPG:=gpg}"

# botan
botan_build=${LOCAL_BUILDS}/botan
Expand Down Expand Up @@ -58,6 +59,8 @@ if [ ! -e "${JSONC_INSTALL}/lib/libjson-c.so" ] && \
mkdir -p "${jsonc_build}"
pushd ${jsonc_build}
wget https://s3.amazonaws.com/json-c_releases/releases/json-c-0.12.1.tar.gz -O json-c.tar.gz

# TODO: this doesn't work on OpenBSD tar
tar xzf json-c.tar.gz --strip 1

autoreconf -ivf
Expand All @@ -72,15 +75,15 @@ if [ ! -e "${GPG21_INSTALL}/bin/gpg" ]; then
mkdir -p "${gpg21_build}"
cd "${gpg21_build}"

gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 249B39D24F25E3B6 04376F3EE0856959 2071B08A33BD3F06 8A861B1C7EFD60D9
${GPG} --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 249B39D24F25E3B6 04376F3EE0856959 2071B08A33BD3F06 8A861B1C7EFD60D9

for archive in npth:1.5 libgpg-error:1.27; do
pkgname="${archive%:*}"
version="${archive#*:}"

wget -c https://www.gnupg.org/ftp/gcrypt/${pkgname}/${pkgname}-${version}.tar.bz2
wget -c https://www.gnupg.org/ftp/gcrypt/${pkgname}/${pkgname}-${version}.tar.bz2.sig
gpg --verify ${pkgname}-${version}.tar.bz2.sig
${GPG} --verify ${pkgname}-${version}.tar.bz2.sig
tar -xjf ${pkgname}-${version}.tar.bz2
cd ${pkgname}-${version}/
# autoreconf -ivf
Expand All @@ -95,18 +98,18 @@ if [ ! -e "${GPG21_INSTALL}/bin/gpg" ]; then

wget -c https://www.gnupg.org/ftp/gcrypt/${pkgname}/${pkgname}-${version}.tar.bz2
wget -c https://www.gnupg.org/ftp/gcrypt/${pkgname}/${pkgname}-${version}.tar.bz2.sig
gpg --verify ${pkgname}-${version}.tar.bz2.sig
${GPG} --verify ${pkgname}-${version}.tar.bz2.sig
tar -xjf ${pkgname}-${version}.tar.bz2
cd ${pkgname}-${version}/
pushd ${pkgname}-${version}/
# autoreconf -ivf
./configure --prefix="${GPG21_INSTALL}" --with-libgpg-error-prefix="${GPG21_INSTALL}"
${MAKE} -j${CORES} install
cd ..
popd
done

wget -c https://www.gnupg.org/ftp/gcrypt/pinentry/pinentry-1.0.0.tar.bz2
wget -c https://www.gnupg.org/ftp/gcrypt/pinentry/pinentry-1.0.0.tar.bz2.sig
gpg --verify pinentry-1.0.0.tar.bz2.sig
${GPG} --verify pinentry-1.0.0.tar.bz2.sig
tar -xjf pinentry-1.0.0.tar.bz2
cd pinentry-1.0.0
./configure --prefix="${GPG21_INSTALL}" \
Expand All @@ -119,7 +122,7 @@ if [ ! -e "${GPG21_INSTALL}/bin/gpg" ]; then

wget -c https://www.gnupg.org/ftp/gcrypt/gnupg/gnupg-2.1.23.tar.bz2
wget -c https://www.gnupg.org/ftp/gcrypt/gnupg/gnupg-2.1.23.tar.bz2.sig
gpg --verify gnupg-2.1.23.tar.bz2.sig
${GPG} --verify gnupg-2.1.23.tar.bz2.sig
tar -xjf gnupg-2.1.23.tar.bz2
cd gnupg-2.1.23
./configure --prefix="${GPG21_INSTALL}" \
Expand Down
1 change: 0 additions & 1 deletion ci/style-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ if [ "$diffs" != "" ]; then
echo "$diffs"
exit 1
fi

1 change: 0 additions & 1 deletion ci/success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ if [ "$BUILD_MODE" = "coverage" ]; then
gcov-4.8 --object-file rnp_tests-rnp_tests.o rnp_tests.c
bash <(curl -s https://codecov.io/bash)
fi