From e43e657603a6e81989eabe491549ac88db630dc6 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Tue, 31 Jan 2023 10:21:22 +0100 Subject: [PATCH] GHA: build Icinga 2 from source as the package build images aren't public anymore. --- .github/workflows/deb.yml | 117 --------------------------------- .github/workflows/linux.bash | 90 +++++++++++++++++++++++++ .github/workflows/linux.yml | 51 ++++++++++++++ .github/workflows/raspbian.yml | 87 ------------------------ .github/workflows/rpm.yml | 21 ------ 5 files changed, 141 insertions(+), 225 deletions(-) delete mode 100644 .github/workflows/deb.yml create mode 100755 .github/workflows/linux.bash create mode 100644 .github/workflows/linux.yml delete mode 100644 .github/workflows/raspbian.yml diff --git a/.github/workflows/deb.yml b/.github/workflows/deb.yml deleted file mode 100644 index 0bc236cb3..000000000 --- a/.github/workflows/deb.yml +++ /dev/null @@ -1,117 +0,0 @@ -name: .deb - -on: - push: - branches: - - master - - 'support/*' - pull_request: {} - -concurrency: - group: deb-${{ github.ref }} - cancel-in-progress: true - -jobs: - deb: - name: .deb - - strategy: - fail-fast: false - max-parallel: 1 - matrix: - distro: - - name: debian - codename: bullseye - has32bit: true - - name: debian - codename: buster - has32bit: true - - name: ubuntu - codename: jammy - has32bit: false - - name: ubuntu - codename: focal - has32bit: false - - runs-on: ubuntu-latest - - steps: - - name: Checkout HEAD - uses: actions/checkout@v1 - - - name: deb-icinga2 - run: | - set -exo pipefail - git clone https://git.icinga.com/packaging/deb-icinga2.git - chmod o+w deb-icinga2 - - - name: Source - run: | - set -exo pipefail - git checkout -B master - docker run --rm \ - -v "$(pwd)/deb-icinga2:/deb-icinga2" \ - -v "$(pwd)/.git:/icinga2.git:ro" \ - -w /deb-icinga2 \ - -e ICINGA_BUILD_PROJECT=icinga2 \ - -e ICINGA_BUILD_TYPE=snapshot \ - -e UPSTREAM_GIT_URL=file:///icinga2.git \ - registry.icinga.com/build-docker/${{ matrix.distro.name }}/${{ matrix.distro.codename }} \ - icinga-build-deb-source - - - name: Restore/backup ccache - id: ccache - uses: actions/cache@v1 - with: - path: deb-icinga2/ccache - key: |- - ${{ matrix.distro.name }}/${{ matrix.distro.codename }}-ccache-${{ hashFiles('deb-icinga2/ccache') }} - - - name: Binary x64 - run: | - set -exo pipefail - if [ -e deb-icinga2/ccache ]; then - chmod -R o+w deb-icinga2/ccache - fi - docker run --rm \ - -v "$(pwd)/deb-icinga2:/deb-icinga2" \ - -w /deb-icinga2 \ - -e ICINGA_BUILD_PROJECT=icinga2 \ - -e ICINGA_BUILD_TYPE=snapshot \ - registry.icinga.com/build-docker/${{ matrix.distro.name }}/${{ matrix.distro.codename }} \ - icinga-build-deb-binary - - - name: Binary x86 - if: matrix.distro.has32bit - run: | - set -exo pipefail - docker run --rm \ - -v "$(pwd)/deb-icinga2:/deb-icinga2" \ - -w /deb-icinga2 \ - -e ICINGA_BUILD_PROJECT=icinga2 \ - -e ICINGA_BUILD_TYPE=snapshot \ - registry.icinga.com/build-docker/${{ matrix.distro.name }}/${{ matrix.distro.codename }}:x86 \ - icinga-build-deb-binary - - - name: Test x64 - run: | - set -exo pipefail - docker run --rm \ - -v "$(pwd)/deb-icinga2:/deb-icinga2" \ - -w /deb-icinga2 \ - -e ICINGA_BUILD_PROJECT=icinga2 \ - -e ICINGA_BUILD_TYPE=snapshot \ - registry.icinga.com/build-docker/${{ matrix.distro.name }}/${{ matrix.distro.codename }} \ - icinga-build-test - - - name: Test x86 - if: matrix.distro.has32bit - run: | - set -exo pipefail - docker run --rm \ - -v "$(pwd)/deb-icinga2:/deb-icinga2" \ - -w /deb-icinga2 \ - -e ICINGA_BUILD_PROJECT=icinga2 \ - -e ICINGA_BUILD_TYPE=snapshot \ - registry.icinga.com/build-docker/${{ matrix.distro.name }}/${{ matrix.distro.codename }}:x86 \ - icinga-build-test diff --git a/.github/workflows/linux.bash b/.github/workflows/linux.bash new file mode 100755 index 000000000..9deae8e74 --- /dev/null +++ b/.github/workflows/linux.bash @@ -0,0 +1,90 @@ +#!/bin/bash +set -exo pipefail + +export PATH="/usr/lib/ccache:/usr/lib64/ccache:/opt/rh/devtoolset-11/root/usr/bin:$PATH" +export CCACHE_DIR=/icinga2/ccache +export CTEST_OUTPUT_ON_FAILURE=1 +CMAKE_OPTS='' + +case "$DISTRO" in + amazonlinux:*) + amazon-linux-extras install -y epel + yum install -y bison ccache cmake gcc-c++ flex ninja-build \ + {libedit,mariadb,ncurses,openssl,postgresql,systemd}-devel + + yum install -y bzip2 tar wget + wget https://boostorg.jfrog.io/artifactory/main/release/1.69.0/source/boost_1_69_0.tar.bz2 + tar -xjf boost_1_69_0.tar.bz2 + + ( + cd boost_1_69_0 + ./bootstrap.sh --with-libraries=context,coroutine,date_time,filesystem,iostreams,program_options,regex,system,test,thread + ./b2 + ) + + ln -vs /usr/bin/ninja-build /usr/local/bin/ninja + CMAKE_OPTS='-DBOOST_INCLUDEDIR=/boost_1_69_0 -DBOOST_LIBRARYDIR=/boost_1_69_0/stage/lib' + export LD_LIBRARY_PATH=/boost_1_69_0/stage/lib + ;; + + centos:*) + yum install -y centos-release-scl epel-release + yum install -y bison ccache cmake devtoolset-11-gcc-c++ flex ninja-build \ + {boost169,libedit,mariadb,ncurses,openssl,postgresql,systemd}-devel + + ln -vs /usr/bin/ccache /usr/lib64/ccache/g++ + CMAKE_OPTS='-DBOOST_INCLUDEDIR=/usr/include/boost169 -DBOOST_LIBRARYDIR=/usr/lib64/boost169' + ;; + + debian:*|ubuntu:*) + apt-get update + DEBIAN_FRONTEND=noninteractive apt-get install --no-install-{recommends,suggests} -y bison \ + ccache cmake flex g++ lib{boost-all,edit,mariadb,ncurses,pq,ssl,systemd}-dev ninja-build tzdata + ;; + + fedora:*) + dnf install -y bison ccache cmake flex gcc-c++ ninja-build \ + {boost,libedit,mariadb,ncurses,openssl,postgresql,systemd}-devel + ;; + + opensuse/*) + zypper in -y bison ccache cmake flex gcc-c++ ninja {lib{edit,mariadb,openssl},ncurses,postgresql,systemd}-devel \ + libboost_{context,coroutine,filesystem,iostreams,program_options,regex,system,test,thread}-devel + ;; + + rockylinux:*) + dnf install -y 'dnf-command(config-manager)' epel-release + + case "$DISTRO" in + *:8) + dnf config-manager --enable powertools + ;; + *) + dnf config-manager --enable crb + ;; + esac + + dnf install -y bison ccache cmake gcc-c++ flex ninja-build \ + {boost,libedit,mariadb,ncurses,openssl,postgresql,systemd}-devel + ;; +esac + +mkdir /icinga2/build +cd /icinga2/build + +cmake \ + -GNinja \ + -DCMAKE_BUILD_TYPE=Release \ + -DICINGA2_UNITY_BUILD=ON \ + -DUSE_SYSTEMD=ON \ + -DICINGA2_USER=$(id -un) \ + -DICINGA2_GROUP=$(id -gn) \ + $CMAKE_OPTS .. + +ccache -z +ninja +ccache -s + +ninja test +ninja install +icinga2 daemon -C diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 000000000..6294a5c60 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,51 @@ +name: Linux + +on: + push: + branches: + - master + - 'support/*' + pull_request: {} + +concurrency: + group: linux-${{ github.ref }} + cancel-in-progress: true + +jobs: + linux: + name: ${{ matrix.distro }} + runs-on: ubuntu-latest + + strategy: + fail-fast: false + max-parallel: 2 + matrix: + distro: + - amazonlinux:2 + - centos:7 # and RHEL 7 + - debian:10 + - debian:11 # and Raspbian 11 + - fedora:36 + - fedora:37 + - opensuse/leap:15.3 # and SLES 15.3 + - opensuse/leap:15.4 # and SLES 15.4 + - rockylinux:8 # RHEL 8 + - rockylinux:9 # RHEL 9 + - ubuntu:20.04 + - ubuntu:22.04 + - ubuntu:22.10 + + steps: + - name: Checkout HEAD + uses: actions/checkout@v3 + + - name: Restore/backup ccache + uses: actions/cache@v3 + with: + path: ccache + key: ccache/${{ matrix.distro }} + + - name: Build + run: >- + docker run --rm -v "$(pwd):/icinga2" -e DISTRO=${{ matrix.distro }} + ${{ matrix.distro }} /icinga2/.github/workflows/linux.bash diff --git a/.github/workflows/raspbian.yml b/.github/workflows/raspbian.yml deleted file mode 100644 index dcc6335c0..000000000 --- a/.github/workflows/raspbian.yml +++ /dev/null @@ -1,87 +0,0 @@ -name: Raspbian - -on: - push: - branches: - - master - - 'support/*' - pull_request: {} - -concurrency: - group: raspbian-${{ github.ref }} - cancel-in-progress: true - -jobs: - raspbian: - name: Raspbian - - strategy: - fail-fast: false - max-parallel: 1 - matrix: - codename: - - bullseye - - runs-on: ubuntu-latest - - steps: - - name: Checkout HEAD - uses: actions/checkout@v1 - - - name: qemu-user-static - run: | - set -exo pipefail - sudo apt-get update - DEBIAN_FRONTEND=noninteractive sudo apt-get install -y qemu-user-static - - - name: raspbian-icinga2 - run: | - set -exo pipefail - git clone https://git.icinga.com/packaging/raspbian-icinga2.git - chmod o+w raspbian-icinga2 - - - name: Restore/backup ccache - id: ccache - uses: actions/cache@v1 - with: - path: raspbian-icinga2/ccache - key: |- - raspbian/${{ matrix.codename }}-ccache-${{ hashFiles('raspbian-icinga2/ccache') }} - - - name: Binary - run: | - set -exo pipefail - git checkout -B master - if [ -e raspbian-icinga2/ccache ]; then - chmod -R o+w raspbian-icinga2/ccache - fi - docker run --rm \ - -v "$(pwd)/raspbian-icinga2:/raspbian-icinga2" \ - -v "$(pwd)/.git:/icinga2.git:ro" \ - -w /raspbian-icinga2 \ - -e ICINGA_BUILD_PROJECT=icinga2 \ - -e ICINGA_BUILD_TYPE=snapshot \ - -e UPSTREAM_GIT_URL=file:///icinga2.git \ - -e ICINGA_BUILD_DEB_DEFAULT_ARCH=armhf \ - registry.icinga.com/build-docker/raspbian/${{ matrix.codename }} \ - icinga-build-package - -# Setting up icinga2-bin (2.12.0+rc1.25.g5d1c82a3d.20200526.0754+buster-0) ... -# enabling default icinga2 features -# qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x6015c75c -# qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x6015c75c -# qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x600016ea -# dpkg: error processing package icinga2-bin (--configure): -# installed icinga2-bin package post-installation script subprocess returned error exit status 127 -# -# - name: Test -# run: | -# set -exo pipefail -# docker run --rm \ -# -v "$(pwd)/raspbian-icinga2:/raspbian-icinga2" \ -# -w /raspbian-icinga2 \ -# -e ICINGA_BUILD_PROJECT=icinga2 \ -# -e ICINGA_BUILD_TYPE=snapshot \ -# -e ICINGA_BUILD_DEB_DEFAULT_ARCH=armhf \ -# registry.icinga.com/build-docker/raspbian/${{ matrix.codename }} \ -# icinga-build-test diff --git a/.github/workflows/rpm.yml b/.github/workflows/rpm.yml index 9fa29aa69..13022168e 100644 --- a/.github/workflows/rpm.yml +++ b/.github/workflows/rpm.yml @@ -20,30 +20,9 @@ jobs: max-parallel: 1 matrix: distro: - - name: rhel - release: 8 - subscription: true - - name: rhel - release: 7 - subscription: true - - name: centos - release: 7 - subscription: false - - name: amazon-linux - release: al2:x86_64 - subscription: true - - name: fedora - release: 36 - subscription: false - - name: sles - release: '15.4' - subscription: true - name: sles release: '12.5' subscription: true - - name: opensuse - release: '15.4' - subscription: false runs-on: ubuntu-latest