Skip to content

Commit dcb27c0

Browse files
authored
Merge pull request #9 from CESNET/devel
Github Actions: merge workflows for RPM/DEB packages
2 parents 1265965 + e81a6c4 commit dcb27c0

File tree

4 files changed

+104
-97
lines changed

4 files changed

+104
-97
lines changed

.github/workflows/main.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ jobs:
88
strategy:
99
fail-fast: false
1010
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']
11+
image: ['ubuntu:18.04', 'ubuntu:19.04', 'ubuntu:20.04', 'debian:stretch', 'debian:buster', 'debian:bullseye', 'centos:7', 'centos:8', 'fedora:29', 'fedora:30', 'fedora:31']
1212

1313
name: Build on ${{ matrix.image }}
1414
container: ${{ matrix.image }}
1515
steps:
1616
- uses: actions/checkout@v1
17+
1718
# Dependencies ---------------------------------------------------------------------------
1819
- name: Install dependencies (Ubuntu/Debian)
1920
if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')
@@ -28,14 +29,16 @@ jobs:
2829
- name: Install depedencies (Fedora)
2930
if: startsWith(matrix.image, 'fedora')
3031
run: dnf -y install git gcc gcc-c++ cmake make libxml2-devel lz4-devel libzstd-devel
32+
3133
# Build ----------------------------------------------------------------------------------
3234
# 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+
- name: Build the project
36+
run: |
37+
mkdir build && cd build
38+
cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTS=$TESTS
39+
make && make install
3540
env:
3641
TESTS: ${{ startsWith(matrix.image, 'centos:7') != true }}
37-
- name: Build the project
38-
run: cd build && make
3942
- name: Run tests
4043
if: startsWith(matrix.image, 'centos:7') != true
4144
run: cd build && make test

.github/workflows/package.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Build RPM/DEB packages
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
deb:
7+
# Try to build DEB packages
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
image: ['ubuntu:18.04', 'ubuntu:19.04', 'ubuntu:20.04', 'debian:stretch', 'debian:buster', 'debian:bullseye']
13+
14+
name: Build DEBs on ${{ matrix.image }}
15+
container: ${{ matrix.image }}
16+
17+
steps:
18+
- uses: actions/checkout@v1
19+
- name: Define global variables
20+
run: echo "::set-output name=zip_file::libfds-${IMAGE//:/}-$GITHUB_SHA.zip"
21+
shell: bash
22+
env:
23+
IMAGE: ${{ matrix.image }}
24+
id: vars
25+
26+
# Dependencies ---------------------------------------------------------------------------
27+
- name: Install dependencies (Ubuntu/Debian)
28+
run: |
29+
apt-get update
30+
apt-get -y install git gcc g++ cmake make libxml2-dev liblz4-dev libzstd-dev
31+
apt-get -y install debhelper pkg-config devscripts build-essential fakeroot zip
32+
33+
# Build ----------------------------------------------------------------------------------
34+
- name: Build DEB packages
35+
run: |
36+
mkdir build && cd build
37+
cmake .. -DPACKAGE_BUILDER_DEB=On -DCPACK_PACKAGE_CONTACT="GitHub actions <[email protected]>"
38+
make deb
39+
- name: Pack DEB packages
40+
working-directory: 'build/pkg/deb/debbuild/'
41+
run: zip "$GITHUB_WORKSPACE/$ZIP_FILE" *.deb *.ddeb *.tar.gz *.dsc
42+
env:
43+
ZIP_FILE: ${{ steps.vars.outputs.zip_file }}
44+
- name: Archive DEB packages
45+
if: github.event_name == 'push'
46+
uses: actions/upload-artifact@v1
47+
with:
48+
name: ${{ steps.vars.outputs.zip_file }}
49+
path: ${{ steps.vars.outputs.zip_file }}
50+
51+
rpm:
52+
# Try to build RPM packages
53+
runs-on: ubuntu-latest
54+
strategy:
55+
fail-fast: false
56+
matrix:
57+
image: ['centos:7', 'centos:8', 'fedora:29', 'fedora:30', 'fedora:31']
58+
59+
name: Build RPMs on ${{ matrix.image }}
60+
container: ${{ matrix.image }}
61+
62+
steps:
63+
- uses: actions/checkout@v1
64+
- name: Define global variables
65+
run: echo "::set-output name=zip_file::libfds-${IMAGE//:/}-$GITHUB_SHA.zip"
66+
env:
67+
IMAGE: ${{ matrix.image }}
68+
id: vars
69+
70+
# Dependencies ---------------------------------------------------------------------------
71+
- name: Install dependencies (CentOS)
72+
if: startsWith(matrix.image, 'centos')
73+
run: |
74+
yum -y install epel-release
75+
yum -y install git gcc gcc-c++ cmake make libxml2-devel lz4-devel libzstd-devel rpm-build
76+
- name: Install depedencies (Fedora)
77+
if: startsWith(matrix.image, 'fedora')
78+
run: dnf -y install git gcc gcc-c++ cmake make libxml2-devel lz4-devel libzstd-devel rpm-build
79+
80+
# Build ----------------------------------------------------------------------------------
81+
- name: Build RPM packages
82+
run: |
83+
mkdir build && cd build
84+
cmake .. -DPACKAGE_BUILDER_RPM=On -DCPACK_PACKAGE_CONTACT="GitHub actions <[email protected]>"
85+
make rpm
86+
- name: Pack RPM packages
87+
working-directory: 'build/pkg/rpm/rpmbuild'
88+
run: zip -r "$GITHUB_WORKSPACE/$ZIP_FILE" RPMS SRPMS
89+
env:
90+
ZIP_FILE: ${{ steps.vars.outputs.zip_file }}
91+
- name: Archive RPM packages
92+
if: github.event_name == 'push'
93+
uses: actions/upload-artifact@v1
94+
with:
95+
name: ${{ steps.vars.outputs.zip_file }}
96+
path: ${{ steps.vars.outputs.zip_file }}

.github/workflows/package_deb.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/package_rpm.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)