Merge pull request #8018 from Icinga/feature/github-actions

GitHub actions: build packages
This commit is contained in:
Noah Hilverling 2020-05-19 11:26:07 +02:00 committed by GitHub
commit f71be9e802
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 141 additions and 42 deletions

141
.github/workflows/packages.yml vendored Normal file
View File

@ -0,0 +1,141 @@
name: Packages
on:
push:
branches:
- master
pull_request: {}
jobs:
deb:
name: .deb
strategy:
matrix:
distro:
- debian/buster
- debian/stretch
- debian/jessie
- ubuntu/focal
- ubuntu/bionic
- ubuntu/xenial
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 }} \
icinga-build-deb-source
- name: Restore/backup ccache
id: ccache
uses: actions/cache@v1
with:
path: deb-icinga2/ccache
key: '${{ matrix.distro }}-ccache'
- name: Binary
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 }} \
icinga-build-deb-binary
- name: Test
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 }} \
icinga-build-test
rpm:
name: .rpm
strategy:
matrix:
distro:
- centos/8
- centos/7
- centos/6
- fedora/32
- fedora/31
- fedora/30
- fedora/29
- opensuse/15.1
- opensuse/15.0
runs-on: ubuntu-latest
steps:
- name: Checkout HEAD
uses: actions/checkout@v1
- name: rpm-icinga2
run: |
set -exo pipefail
git clone https://git.icinga.com/packaging/rpm-icinga2.git
chmod o+w rpm-icinga2
- name: Restore/backup ccache
id: ccache
uses: actions/cache@v1
with:
path: rpm-icinga2/ccache
key: '${{ matrix.distro }}-ccache'
- name: Binary
run: |
set -exo pipefail
git checkout -B master
if [ -e rpm-icinga2/ccache ]; then
chmod -R o+w rpm-icinga2/ccache
fi
docker run --rm \
-v "$(pwd)/rpm-icinga2:/rpm-icinga2" \
-v "$(pwd)/.git:/icinga2.git:ro" \
-w /rpm-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 }} \
icinga-build-package
- name: Test
run: |
set -exo pipefail
docker run --rm \
-v "$(pwd)/rpm-icinga2:/rpm-icinga2" \
-w /rpm-icinga2 \
-e ICINGA_BUILD_PROJECT=icinga2 \
-e ICINGA_BUILD_TYPE=snapshot \
registry.icinga.com/build-docker/${{ matrix.distro }} \
icinga-build-test

View File

@ -1,42 +0,0 @@
dist: xenial
sudo: false
language: cpp
cache: ccache
addons:
apt:
sources:
- sourceline: 'deb http://packages.icinga.com/ubuntu icinga-xenial main'
key_url: 'https://packages.icinga.com/icinga.key'
packages:
- libboost1.67-icinga-all-dev
- flex
- bison
- libssl-dev
- libpq-dev
- libmysqlclient-dev
- libedit-dev
before_script:
- arch=$(uname -m)
- mkdir build
- cd build
- >
cmake ..
-DCMAKE_BUILD_TYPE=Debug
-DICINGA2_UNITY_BUILD=Off
-DCMAKE_INSTALL_PREFIX=/tmp/icinga2
-DICINGA2_PLUGINDIR=/tmp/icinga2/sbin
-DBoost_NO_BOOST_CMAKE=TRUE
-DBoost_NO_SYSTEM_PATHS=TRUE
-DBOOST_LIBRARYDIR=/usr/lib/${arch}-linux-gnu/icinga-boost
-DBOOST_INCLUDEDIR=/usr/include/icinga-boost
-DCMAKE_INSTALL_RPATH=/usr/lib/${arch}-linux-gnu/icinga-boost
script:
- make
- make test
- make install
- /tmp/icinga2/sbin/icinga2 --version
- /tmp/icinga2/sbin/icinga2 daemon -C -DRunAsUser=$(id -u -n) -DRunAsGroup=$(id -g -n)