Skip to content

Commit

Permalink
Merge pull request #9 from CESNET/devel
Browse files Browse the repository at this point in the history
Github Actions: merge workflows for RPM/DEB packages
  • Loading branch information
Lukas955 authored Jan 1, 2020
2 parents 1265965 + e81a6c4 commit dcb27c0
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 97 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ jobs:
strategy:
fail-fast: false
matrix:
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']
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']

name: Build on ${{ matrix.image }}
container: ${{ matrix.image }}
steps:
- uses: actions/checkout@v1

# Dependencies ---------------------------------------------------------------------------
- name: Install dependencies (Ubuntu/Debian)
if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')
Expand All @@ -28,14 +29,16 @@ jobs:
- name: Install depedencies (Fedora)
if: startsWith(matrix.image, 'fedora')
run: dnf -y install git gcc gcc-c++ cmake make libxml2-devel lz4-devel libzstd-devel

# Build ----------------------------------------------------------------------------------
# Note: Unit tests are disabled on CentOS7 due to outdated GCC version
- name: Prepare for build
run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTS=$TESTS
- name: Build the project
run: |
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTS=$TESTS
make && make install
env:
TESTS: ${{ startsWith(matrix.image, 'centos:7') != true }}
- name: Build the project
run: cd build && make
- name: Run tests
if: startsWith(matrix.image, 'centos:7') != true
run: cd build && make test
96 changes: 96 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Build RPM/DEB packages

on: [push, pull_request]

jobs:
deb:
# Try to build DEB packages
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image: ['ubuntu:18.04', 'ubuntu:19.04', 'ubuntu:20.04', 'debian:stretch', 'debian:buster', 'debian:bullseye']

name: Build DEBs on ${{ matrix.image }}
container: ${{ matrix.image }}

steps:
- uses: actions/checkout@v1
- name: Define global variables
run: echo "::set-output name=zip_file::libfds-${IMAGE//:/}-$GITHUB_SHA.zip"
shell: bash
env:
IMAGE: ${{ matrix.image }}
id: vars

# Dependencies ---------------------------------------------------------------------------
- name: Install dependencies (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 debhelper pkg-config devscripts build-essential fakeroot zip
# Build ----------------------------------------------------------------------------------
- name: Build DEB packages
run: |
mkdir build && cd build
cmake .. -DPACKAGE_BUILDER_DEB=On -DCPACK_PACKAGE_CONTACT="GitHub actions <[email protected]>"
make deb
- name: Pack DEB packages
working-directory: 'build/pkg/deb/debbuild/'
run: zip "$GITHUB_WORKSPACE/$ZIP_FILE" *.deb *.ddeb *.tar.gz *.dsc
env:
ZIP_FILE: ${{ steps.vars.outputs.zip_file }}
- name: Archive DEB packages
if: github.event_name == 'push'
uses: actions/upload-artifact@v1
with:
name: ${{ steps.vars.outputs.zip_file }}
path: ${{ steps.vars.outputs.zip_file }}

rpm:
# Try to build RPM packages
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image: ['centos:7', 'centos:8', 'fedora:29', 'fedora:30', 'fedora:31']

name: Build RPMs on ${{ matrix.image }}
container: ${{ matrix.image }}

steps:
- uses: actions/checkout@v1
- name: Define global variables
run: echo "::set-output name=zip_file::libfds-${IMAGE//:/}-$GITHUB_SHA.zip"
env:
IMAGE: ${{ matrix.image }}
id: vars

# Dependencies ---------------------------------------------------------------------------
- name: Install dependencies (CentOS)
if: startsWith(matrix.image, 'centos')
run: |
yum -y install epel-release
yum -y install git gcc gcc-c++ cmake make libxml2-devel lz4-devel libzstd-devel rpm-build
- name: Install depedencies (Fedora)
if: startsWith(matrix.image, 'fedora')
run: dnf -y install git gcc gcc-c++ cmake make libxml2-devel lz4-devel libzstd-devel rpm-build

# Build ----------------------------------------------------------------------------------
- name: Build RPM packages
run: |
mkdir build && cd build
cmake .. -DPACKAGE_BUILDER_RPM=On -DCPACK_PACKAGE_CONTACT="GitHub actions <[email protected]>"
make rpm
- name: Pack RPM packages
working-directory: 'build/pkg/rpm/rpmbuild'
run: zip -r "$GITHUB_WORKSPACE/$ZIP_FILE" RPMS SRPMS
env:
ZIP_FILE: ${{ steps.vars.outputs.zip_file }}
- name: Archive RPM packages
if: github.event_name == 'push'
uses: actions/upload-artifact@v1
with:
name: ${{ steps.vars.outputs.zip_file }}
path: ${{ steps.vars.outputs.zip_file }}
45 changes: 0 additions & 45 deletions .github/workflows/package_deb.yml

This file was deleted.

47 changes: 0 additions & 47 deletions .github/workflows/package_rpm.yml

This file was deleted.

0 comments on commit dcb27c0

Please sign in to comment.