Merge pull request #101 from CESNET/bump-version #251
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build RPM/DEB packages | |
on: | |
# Ignore changes in extra plugins (as they are not tested here) | |
push: | |
paths-ignore: | |
- 'extra_plugins/**' | |
pull_request: | |
paths-ignore: | |
- 'extra_plugins/**' | |
jobs: | |
deb: | |
# Try to build DEB packages | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
image: ['ubuntu:20.04', 'ubuntu:22.04', 'debian:buster', 'debian:bullseye', 'debian:bookworm'] | |
name: Build DEBs on ${{ matrix.image }} | |
container: ${{ matrix.image }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Define variables | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
const sha = context.sha.substring(0, 8); | |
const image = `${{ matrix.image }}` | |
const distro = image.split('/').pop().replace(/:/g,'_'); | |
const zip = `ipfixcol2-${distro}-${sha}`; | |
core.exportVariable('ZIP_FILE', zip); | |
- name: Prepare environment | |
run: | | |
mkdir -p build/libfds_repo | |
# Dependencies --------------------------------------------------------------------------- | |
- name: Install dependencies for libfds and IPFIXcol2 (Ubuntu/Debian) | |
run: | | |
apt-get update | |
apt-get -y install git gcc g++ cmake make libxml2-dev liblz4-dev libzstd-dev | |
apt-get -y install python3-docutils zlib1g-dev pkg-config librdkafka-dev | |
apt-get -y install debhelper devscripts build-essential fakeroot zip | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
# Build LIBFDS DEB package --------------------------------------------------------------- | |
- name: Checkout libfds library - master branch | |
if: github.ref == 'refs/heads/master' | |
run: git clone --branch master https://github.com/CESNET/libfds.git build/libfds_repo | |
- name: Checkout libfds library - devel branch | |
if: github.ref != 'refs/heads/master' | |
run: git clone --branch devel https://github.com/CESNET/libfds.git build/libfds_repo | |
- name: Build DEBs of libfds library and install them | |
working-directory: 'build/libfds_repo' | |
run: | | |
mkdir build && cd build | |
cmake .. -DPACKAGE_BUILDER_DEB=On -DCPACK_PACKAGE_CONTACT="GitHub actions <[email protected]>" | |
make deb | |
apt -y install ./pkg/deb/debbuild/libfds*.deb | |
# Build IPFIXcol2 DEB package ------------------------------------------------------------ | |
- name: Build IPFIXcol2 DEBs and install them | |
run: | | |
cd build | |
cmake .. -DPACKAGE_BUILDER_DEB=On -DCPACK_PACKAGE_CONTACT="GitHub actions <[email protected]>" | |
make deb | |
apt -y install ./pkg/deb/debbuild/*.deb | |
- name: Try to run IPFIXcol2 | |
run: | | |
ipfixcol2 -V | |
ipfixcol2 -h | |
ipfixcol2 -L | |
- name: Archive DEB packages | |
if: github.event_name == 'push' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ env.ZIP_FILE }} | |
path: | | |
build/pkg/deb/debbuild/*.deb | |
build/pkg/deb/debbuild/*.ddeb | |
build/pkg/deb/debbuild/*.tar.gz | |
build/pkg/deb/debbuild/*.dsc | |
rpm: | |
# Try to build RPM packages | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
image: | |
- 'rockylinux:8' | |
- 'oraclelinux:8' | |
- 'oraclelinux:9' | |
name: Build RPMs on ${{ matrix.image }} | |
container: ${{ matrix.image }} | |
steps: | |
- name: Define variables | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
const sha = context.sha.substring(0, 8); | |
const image = `${{ matrix.image }}` | |
const distro = image.split('/').pop().replace(/:/g,'_'); | |
const zip = `ipfixcol2-${distro}-${sha}`; | |
core.exportVariable('ZIP_FILE', zip); | |
- name: Prepare environment | |
run: | | |
mkdir -p build/libfds_repo | |
# Dependencies --------------------------------------------------------------------------- | |
- name: Enable additional repositories (Rocky Linux) | |
if: contains(matrix.image, 'rockylinux') | |
run: | | |
dnf -y install 'dnf-command(config-manager)' | |
dnf config-manager --set-enabled appstream powertools | |
- name: Enable additional repositories (Oracle Linux 8) | |
if: contains(matrix.image, 'oraclelinux:8') | |
run: | | |
dnf -y install 'dnf-command(config-manager)' | |
dnf config-manager --set-enabled ol8_appstream ol8_codeready_builder | |
- name: Enable additional repositories (Oracle Linux 9) | |
if: contains(matrix.image, 'oraclelinux:9') | |
run: | | |
dnf -y install 'dnf-command(config-manager)' | |
dnf config-manager --set-enabled ol9_appstream ol9_codeready_builder | |
- name: Enable EPEL (Rocky Linux) | |
if: contains(matrix.image, 'Rocky Linux') | |
run: | | |
yum -y install epel-release | |
- name: Enable EPEL (Oracle Linux 8) | |
if: contains(matrix.image, 'oraclelinux:8') | |
run: | | |
dnf -y install oracle-epel-release-el8 | |
- name: Enable EPEL (Oracle Linux 9) | |
if: contains(matrix.image, 'oraclelinux:9') | |
run: | | |
dnf -y install oracle-epel-release-el9 | |
- name: Install dependencies for libfds and IPFIXcol2 (Rocky Linux, Oracle Linux) | |
if: contains(matrix.image, 'rockylinux') || contains(matrix.image, 'oraclelinux') | |
run: | | |
yum -y install git gcc gcc-c++ cmake make libxml2-devel lz4-devel libzstd-devel | |
yum -y install zlib-devel pkgconfig rpm-build librdkafka-devel | |
yum -y install python3-docutils || yum -y install python-docutils | |
# Checkout repository -------------------------------------------------------------------- | |
- uses: actions/checkout@v2 | |
# Build LIBFDS RPM package --------------------------------------------------------------- | |
- name: Checkout libfds library - master branch | |
if: github.ref == 'refs/heads/master' | |
run: git clone --branch master https://github.com/CESNET/libfds.git build/libfds_repo | |
- name: Checkout libfds library - devel branch | |
if: github.ref != 'refs/heads/master' | |
run: git clone --branch devel https://github.com/CESNET/libfds.git build/libfds_repo | |
- name: Build RPMs of libfds library and install it | |
working-directory: 'build/libfds_repo' | |
run: | | |
mkdir build && cd build | |
cmake .. -DPACKAGE_BUILDER_RPM=On -DCPACK_PACKAGE_CONTACT="GitHub actions <[email protected]>" | |
make rpm | |
yum -y install pkg/rpm/rpmbuild/RPMS/*/libfds-*.rpm | |
# Build IPFIXcol2 RPM package ------------------------------------------------------------ | |
- name: Build IPFIXcol2 RPMs and install them | |
run: | | |
cd build | |
cmake .. -DPACKAGE_BUILDER_RPM=On -DCPACK_PACKAGE_CONTACT="GitHub actions <[email protected]>" | |
make rpm | |
yum -y install pkg/rpm/rpmbuild/RPMS/*/ipfixcol2-*.rpm | |
- name: Try to run IPFIXcol2 | |
run: | | |
ipfixcol2 -V | |
ipfixcol2 -h | |
ipfixcol2 -L -v | |
- name: Archive RPM packages | |
if: github.event_name == 'push' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ env.ZIP_FILE }} | |
path: | | |
build/pkg/rpm/rpmbuild/RPMS/ | |
build/pkg/rpm/rpmbuild/SRPMS/ |