Skip to content

Commit 603749e

Browse files
committed
GitHub: add workflows (build and tests, RPM, DEB) for GitHub Actions
1 parent aa94a23 commit 603749e

File tree

4 files changed

+146
-3
lines changed

4 files changed

+146
-3
lines changed

.github/workflows/main.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build and tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
image: ['ubuntu:18.04', 'ubuntu:19.04', 'ubuntu:20.04', 'debian:stretch', 'debian:buster', 'debian:bullseye', 'centos:7', 'centos:8', 'fedora:28', 'fedora:29', 'fedora:30', 'fedora:31']
12+
13+
name: Build on ${{ matrix.image }}
14+
container: ${{ matrix.image }}
15+
steps:
16+
- uses: actions/checkout@v1
17+
# Dependencies ---------------------------------------------------------------------------
18+
- name: Install dependencies (Ubuntu/Debian)
19+
if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')
20+
run: |
21+
apt-get update
22+
apt-get -y install git gcc g++ cmake make libxml2-dev liblz4-dev libzstd-dev
23+
- name: Install dependencies (CentOS)
24+
if: startsWith(matrix.image, 'centos')
25+
run: |
26+
yum -y install epel-release
27+
yum -y install git gcc gcc-c++ cmake make libxml2-devel lz4-devel libzstd-devel
28+
- name: Install depedencies (Fedora)
29+
if: startsWith(matrix.image, 'fedora')
30+
run: dnf -y install git gcc gcc-c++ cmake make libxml2-devel lz4-devel libzstd-devel
31+
# Build ----------------------------------------------------------------------------------
32+
# Note: Unit tests are disabled on CentOS7 due to outdated GCC version
33+
- name: Prepare for build
34+
run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTS=$TESTS
35+
env:
36+
TESTS: ${{ startsWith(matrix.image, 'centos:7') != true }}
37+
- name: Build the project
38+
run: cd build && make
39+
- name: Run tests
40+
if: startsWith(matrix.image, 'centos:7') != true
41+
run: cd build && make test

.github/workflows/package_deb.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build DEB package
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
rpm:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
image: ['ubuntu:18.04', 'ubuntu:19.04', 'ubuntu:20.04', 'debian:stretch', 'debian:buster', 'debian:bullseye']
12+
13+
name: Build on ${{ matrix.image }}
14+
container: ${{ matrix.image }}
15+
16+
steps:
17+
- uses: actions/checkout@v1
18+
- name: Define global variables
19+
run: echo "::set-output name=zip_file::libfds-${IMAGE//:/}-$GITHUB_SHA.zip"
20+
shell: bash
21+
env:
22+
IMAGE: ${{ matrix.image }}
23+
id: vars
24+
# Dependencies ---------------------------------------------------------------------------
25+
- name: Install dependencies (Ubuntu/Debian)
26+
run: |
27+
apt-get update
28+
apt-get -y install git gcc g++ cmake make libxml2-dev liblz4-dev libzstd-dev
29+
apt-get -y install debhelper pkg-config devscripts build-essential fakeroot zip
30+
# Build ----------------------------------------------------------------------------------
31+
- name: Prepare for build
32+
run: mkdir build && cd build && cmake .. -DPACKAGE_BUILDER_DEB=On -DCPACK_PACKAGE_CONTACT="GitHub actions <[email protected]>"
33+
- name: Build the RPM package
34+
run: cd build && make deb
35+
- name: Pack DEB packages
36+
working-directory: 'build/pkg/deb/debbuild/'
37+
run: zip "$GITHUB_WORKSPACE/$ZIP_FILE" *.deb *.ddeb *.tar.gz *.dsc
38+
env:
39+
ZIP_FILE: ${{ steps.vars.outputs.zip_file }}
40+
- name: Archive DEB packages
41+
if: github.event_name == 'push'
42+
uses: actions/upload-artifact@v1
43+
with:
44+
name: ${{ steps.vars.outputs.zip_file }}
45+
path: ${{ steps.vars.outputs.zip_file }}

.github/workflows/package_rpm.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build RPM package
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
rpm:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
image: ['centos:7', 'centos:8', 'fedora:28', 'fedora:29', 'fedora:30', 'fedora:31']
12+
13+
name: Build on ${{ matrix.image }}
14+
container: ${{ matrix.image }}
15+
16+
steps:
17+
- uses: actions/checkout@v1
18+
- name: Define global variables
19+
run: echo "::set-output name=zip_file::libfds-${IMAGE//:/}-$GITHUB_SHA.zip"
20+
env:
21+
IMAGE: ${{ matrix.image }}
22+
id: vars
23+
# Dependencies ---------------------------------------------------------------------------
24+
- name: Install dependencies (CentOS)
25+
if: startsWith(matrix.image, 'centos')
26+
run: |
27+
yum -y install epel-release
28+
yum -y install git gcc gcc-c++ cmake make libxml2-devel lz4-devel libzstd-devel rpm-build
29+
- name: Install depedencies (Fedora)
30+
if: startsWith(matrix.image, 'fedora')
31+
run: dnf -y install git gcc gcc-c++ cmake make libxml2-devel lz4-devel libzstd-devel rpm-build
32+
# Build ----------------------------------------------------------------------------------
33+
- name: Prepare for build
34+
run: mkdir build && cd build && cmake .. -DPACKAGE_BUILDER_RPM=On -DCPACK_PACKAGE_CONTACT="GitHub actions <[email protected]>"
35+
- name: Build the RPM package
36+
run: cd build && make rpm
37+
- name: Pack RPM packages
38+
working-directory: 'build/pkg/rpm/rpmbuild'
39+
run: zip -r "$GITHUB_WORKSPACE/$ZIP_FILE" RPMS SRPMS
40+
env:
41+
ZIP_FILE: ${{ steps.vars.outputs.zip_file }}
42+
- name: Archive RPM packages
43+
if: github.event_name == 'push'
44+
uses: actions/upload-artifact@v1
45+
with:
46+
name: ${{ steps.vars.outputs.zip_file }}
47+
path: ${{ steps.vars.outputs.zip_file }}

README.rst

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
============= =============
2+
Master branch |BuildMaster|
3+
------------- -------------
4+
Devel branch |BuildDevel|
5+
============= =============
6+
17
Flow Data Storage library
28
=========================
39

@@ -37,11 +43,11 @@ First of all, install build dependencies of the library
3743
* Note: if ZSTD library (``libzstd-devel``) is not available, you can try to
3844
add official EPEL repository (``yum -y install epel-release``) and install
3945
it again. Alternatively, it's also possible to use embedded version
40-
of the library by passing additional option ``-DUSE_SYSTEM_ZSTD=off``
46+
of the library by passing additional option ``-DUSE_SYSTEM_ZSTD=off``
4147
to ``cmake ..`` while building.
4248
* Note: if LZ4 library (``lz4-devel``) is not available for your distribution
4349
or you prefer to use libfds embedded version, you can pass additional
44-
option ``-DUSE_SYSTEM_LZ4=off`` to ``cmake ..``
50+
option ``-DUSE_SYSTEM_LZ4=off`` to ``cmake ..``
4551

4652
**Debian/Ubuntu:**
4753

@@ -53,7 +59,7 @@ First of all, install build dependencies of the library
5359
* Note: if ZSTD library (``libzstd-dev``) or LZ4 library (``liblz4-dev``),
5460
is not available for your distribution or you prefer to use embedded
5561
versions of these libraries, you can pass additional option
56-
``-DUSE_SYSTEM_LZ4=off``, resp. ``-DUSE_SYSTEM_ZSTD=off`` to ``cmake ..``
62+
``-DUSE_SYSTEM_LZ4=off``, resp. ``-DUSE_SYSTEM_ZSTD=off`` to ``cmake ..``
5763
while building.
5864

5965
Finally, build and install the library:
@@ -67,3 +73,7 @@ Finally, build and install the library:
6773
$ make
6874
# make install
6975
76+
.. |BuildMaster| image:: https://github.com/CESNET/libfds/workflows/Build%20and%20tests/badge.svg?branch=master
77+
:target: https://github.com/CESNET/libfds/tree/master
78+
.. |BuildDevel| image:: https://github.com/CESNET/libfds/workflows/Build%20and%20tests/badge.svg?branch=devel
79+
:target: https://github.com/CESNET/libfds/tree/devel

0 commit comments

Comments
 (0)