Automated Fedora 34 rpm build

This commit is contained in:
Jason Rhinelander 2021-08-09 16:08:33 -03:00
parent 6c1f030174
commit 035da804c2
5 changed files with 212 additions and 50 deletions

View File

@ -1,63 +1,45 @@
local debian_pipeline(name, image, arch='amd64', deps='g++ libsodium-dev libzmq3-dev', cmake_extra='', build_type='Release', extra_cmds=[], allow_fail=false) = {
local distro = "fedora-34";
local distro_name = 'Fedora 34';
local distro_docker = 'fedora:34';
local submodules = {
name: 'submodules',
image: 'drone/git',
commands: ['git fetch --tags', 'git submodule update --init --recursive']
};
local dnf(arch) = 'dnf -y --setopt install_weak_deps=False --setopt cachedir=/cache/'+distro+'/'+arch+'/${DRONE_STAGE_MACHINE} ';
local rpm_pipeline(image, buildarch='amd64', rpmarch='x86_64', jobs=6) = {
kind: 'pipeline',
type: 'docker',
name: name,
platform: { arch: arch },
environment: { CLICOLOR_FORCE: '1' }, // Lets color through ninja (1.9+)
name: distro_name + ' (' + rpmarch + ')',
platform: { arch: buildarch },
steps: [
submodules,
{
name: 'build',
image: image,
[if allow_fail then "failure"]: "ignore",
environment: {
SSH_KEY: { from_secret: "SSH_KEY" },
RPM_BUILD_NCPUS: jobs
},
commands: [
'apt-get update',
'apt-get install -y eatmydata',
'eatmydata apt-get dist-upgrade -y',
'eatmydata apt-get install -y cmake git ninja-build pkg-config ccache ' + deps,
'git submodule update --init --recursive',
'mkdir build',
'cd build',
'cmake .. -G Ninja -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_BUILD_TYPE='+build_type+' -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ' + cmake_extra,
'ninja -v',
'./tests/tests --use-colour yes'
] + extra_cmds,
'echo "Building on ${DRONE_STAGE_MACHINE}"',
dnf(rpmarch) + 'distro-sync',
dnf(rpmarch) + 'install rpm-build git-archive-all dnf-plugins-core ccache',
'pkg_src_base="$(rpm -q --queryformat=\'%{NAME}-%{VERSION}\n\' --specfile SPECS/oxenmq.spec | head -n 1)"',
'git-archive-all --prefix $pkg_src_base/ SOURCES/$pkg_src_base.src.tar.gz',
dnf(rpmarch) + 'builddep --spec SPECS/oxenmq.spec',
'if [ -n "$CCACHE_DIR" ]; then mkdir -pv ~/.cache; ln -sv "$CCACHE_DIR" ~/.cache/ccache; fi',
'rpmbuild --define "_topdir $(pwd)" -bb SPECS/oxenmq.spec',
'./SPECS/ci-upload.sh ' + distro + ' ' + rpmarch,
],
}
]
};
[
debian_pipeline("Ubuntu focal (amd64)", "ubuntu:focal"),
debian_pipeline("Ubuntu bionic (amd64)", "ubuntu:bionic", deps='libsodium-dev g++-8',
cmake_extra='-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8'),
debian_pipeline("Debian sid (amd64)", "debian:sid"),
debian_pipeline("Debian sid/Debug (amd64)", "debian:sid", build_type='Debug'),
debian_pipeline("Debian sid/clang-11 (amd64)", "debian:sid", deps='clang-11 lld-11 libsodium-dev libzmq3-dev',
cmake_extra='-DCMAKE_C_COMPILER=clang-11 -DCMAKE_CXX_COMPILER=clang++-11 ' + std.join(' ', [
'-DCMAKE_'+type+'_LINKER_FLAGS=-fuse-ld=lld-11' for type in ['EXE','MODULE','SHARED','STATIC']])),
debian_pipeline("Debian buster (amd64)", "debian:buster"),
debian_pipeline("Debian buster (i386)", "i386/debian:buster"),
debian_pipeline("Ubuntu bionic (ARM64)", "ubuntu:bionic", arch="arm64", deps='libsodium-dev g++-8',
cmake_extra='-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8'),
debian_pipeline("Debian sid (ARM64)", "debian:sid", arch="arm64"),
debian_pipeline("Debian buster (armhf)", "arm32v7/debian:buster", arch="arm64"),
{
kind: 'pipeline',
type: 'exec',
name: 'macOS (Catalina w/macports)',
platform: { os: 'darwin', arch: 'amd64' },
environment: { CLICOLOR_FORCE: '1' }, // Lets color through ninja (1.9+)
steps: [
{
name: 'build',
commands: [
'git submodule update --init --recursive',
'mkdir build',
'cd build',
'cmake .. -G Ninja -DCMAKE_CXX_FLAGS=-fcolor-diagnostics -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache',
'ninja -v',
'./tests/tests --use-colour yes'
],
}
]
},
rpm_pipeline(distro_docker),
rpm_pipeline("arm64v8/" + distro_docker, buildarch='arm64', rpmarch="aarch64", jobs=4)
]

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
/build*
/BUILD
/RPMS
/SOURCES/*.tar.gz
/compile_commands.json
/obj-*-linux-gnu/

View File

@ -0,0 +1,21 @@
From: Jason Rhinelander <jason@imaginary.ca>
Date: Sat, 28 Mar 2020 12:22:07 -0300
Subject: Fully version library
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 68926f8..51f5fc2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,7 +24,7 @@ include(GNUInstallDirs)
message(STATUS "oxenmq v${PROJECT_VERSION}")
-set(OXENMQ_LIBVERSION 0)
+set(OXENMQ_LIBVERSION ${PROJECT_VERSION})
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)

59
SPECS/ci-upload.sh Executable file
View File

@ -0,0 +1,59 @@
#!/usr/bin/env bash
# Script used with Drone CI to upload build artifacts (because specifying all this in
# .drone.jsonnet is too painful).
set -o errexit
if [ -z "$SSH_KEY" ]; then
echo -e "\n\n\n\e[31;1mUnable to upload artifact: SSH_KEY not set\e[0m"
# Just warn but don't fail, so that this doesn't trigger a build failure for untrusted builds
exit 0
fi
echo "$SSH_KEY" >ssh_key
set -o xtrace # Don't start tracing until *after* we write the ssh key
chmod 600 ssh_key
distro="${1:-unknown}"
rpmarch="${2:-x86_64}"
base="rpm-$distro-$(date --date=@$DRONE_BUILD_CREATED +%Y%m%dT%H%M%SZ)-${DRONE_COMMIT:0:9}"
br="${DRONE_BRANCH// /_}"
br="${br//\//-}"
upload_to="builds.lokinet.dev/${DRONE_REPO// /_}/$br/$base"
put=
for rpm in RPMS/${rpmarch}/*.rpm; do
put+=$'\n'"put $rpm $upload_to"
echo -e "\n\n\e[35;1m$rpm contents:\e[0m"
rpm --query --list $rpm
done
# sftp doesn't have any equivalent to mkdir -p, so we have to split the above up into a chain of
# -mkdir a/, -mkdir a/b/, -mkdir a/b/c/, ... commands. The leading `-` allows the command to fail
# without error.
upload_dirs=(${upload_to//\// })
mkdirs=
dir_tmp=""
for p in "${upload_dirs[@]}"; do
dir_tmp="$dir_tmp$p/"
mkdirs="$mkdirs
-mkdir $dir_tmp"
done
sftp -i ssh_key -b - -o StrictHostKeyChecking=off drone@builds.lokinet.dev <<SFTP
$mkdirs
$put
SFTP
set +o xtrace
echo -e "\n\n\n\n\e[32;1mUploaded to https://${upload_to}\e[0m\n\n\n"

97
SPECS/oxenmq.spec Normal file
View File

@ -0,0 +1,97 @@
Name: oxenmq
Version: 1.2.6
Release: 2%{?dist}
Summary: zeromq-based Oxen message passing library
License: BSD
URL: https://github.com/oxen-io/oxen-mq
Source0: %{name}-%{version}.src.tar.gz
%global sonamever %{version}
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: pkgconfig
BuildRequires: cppzmq-devel
Patch1: fully-version-library.patch
%description
This C++17 library contains an abstraction layer around ZeroMQ to support
integration with Oxen authentication, RPC, and message passing. It is designed
to be usable as the underlying communication mechanism of SN-to-SN communication
("quorumnet"), the RPC interface used by wallets and local daemon commands,
communication channels between oxend and auxiliary services (storage server,
lokinet), and also provides a local multithreaded job scheduling within a
process.
%package libs
Summary: zeromq-based Oxen message passing library
%description libs
This C++17 library contains an abstraction layer around ZeroMQ to support
integration with Oxen authentication, RPC, and message passing. It is designed
to be usable as the underlying communication mechanism of SN-to-SN communication
("quorumnet"), the RPC interface used by wallets and local daemon commands,
communication channels between oxend and auxiliary services (storage server,
lokinet), and also provides a local multithreaded job scheduling within a
process.
This package contains the library file needed by software built using oxenmq.
%package devel
Summary: zeromq-based Oxen message passing library -- headers
Requires: pkgconfig
Requires: cppzmq-devel
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%description devel
This C++17 library contains an abstraction layer around ZeroMQ to support
integration with Oxen authentication, RPC, and message passing. It is designed
to be usable as the underlying communication mechanism of SN-to-SN communication
("quorumnet"), the RPC interface used by wallets and local daemon commands,
communication channels between oxend and auxiliary services (storage server,
lokinet), and also provides a local multithreaded job scheduling within a
process.
This package contains the library headers and other development files needed to
build software using oxenmq.
%prep
%autosetup
%build
%undefine __cmake_in_source_build
%cmake -DOXENMQ_INSTALL_CPPZMQ=OFF -DOXENMQ_LOKIMQ_COMPAT=OFF
%cmake_build
%install
%cmake_install
%files devel
%{_includedir}/oxenmq/*.h
%{_libdir}/liboxenmq.so
%{_libdir}/pkgconfig/liboxenmq.pc
%files libs
%license LICENSE
%doc README.md
%{_libdir}/liboxenmq.so.%{version}
%changelog
* Mon Aug 09 2021 Jason Rhinelander <jason@imaginary.ca> - 1.2.6-2
- Split oxenmq into lib and devel package
- Versioned the library, as we do for debs
- Updated various package descriptions and build commands
* Thu Jul 22 2021 Technical Tumbleweed (necro_nemesis@hotmail.com) oxenmq
-First oxenmq RPM
-Second build update to v1.2.6