|
| 1 | +name: Build RPM/DEB packages |
| 2 | + |
| 3 | +on: |
| 4 | + # Ignore changes in extra plugins (as they are not tested here) |
| 5 | + push: |
| 6 | + paths-ignore: |
| 7 | + - 'extra_plugins/**' |
| 8 | + pull_request: |
| 9 | + paths-ignore: |
| 10 | + - 'extra_plugins/**' |
| 11 | + |
| 12 | +jobs: |
| 13 | + deb: |
| 14 | + # Try to build DEB packages |
| 15 | + runs-on: ubuntu-latest |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + image: ['ubuntu:18.04', 'ubuntu:19.04', 'ubuntu:20.04', 'debian:stretch', 'debian:buster', 'debian:bullseye'] |
| 20 | + |
| 21 | + name: Build DEBs on ${{ matrix.image }} |
| 22 | + container: ${{ matrix.image }} |
| 23 | + |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v1 |
| 26 | + - name: Define global variables |
| 27 | + run: echo "::set-output name=zip_file::libfds-${IMAGE//:/}-$GITHUB_SHA.zip" |
| 28 | + shell: bash |
| 29 | + env: |
| 30 | + IMAGE: ${{ matrix.image }} |
| 31 | + id: vars |
| 32 | + |
| 33 | + # Dependencies --------------------------------------------------------------------------- |
| 34 | + - name: Install dependencies for libfds and IPFIXcol2 (Ubuntu/Debian) |
| 35 | + run: | |
| 36 | + apt-get update |
| 37 | + apt-get -y install git gcc g++ cmake make libxml2-dev liblz4-dev libzstd-dev |
| 38 | + apt-get -y install python3-docutils zlib1g-dev pkg-config |
| 39 | + apt-get -y install debhelper devscripts build-essential fakeroot zip |
| 40 | +
|
| 41 | + # Build LIBFDS DEB package --------------------------------------------------------------- |
| 42 | + - name: Checkout libfds library - master branch |
| 43 | + if: github.ref == 'refs/heads/master' |
| 44 | + run: git clone --branch master https://github.com/CESNET/libfds.git build/libfds_repo |
| 45 | + - name: Checkout libfds library - devel branch |
| 46 | + if: github.ref != 'refs/heads/master' |
| 47 | + run: git clone --branch devel https://github.com/CESNET/libfds.git build/libfds_repo |
| 48 | + - name: Build DEBs of libfds library and install them |
| 49 | + working-directory: 'build/libfds_repo' |
| 50 | + run: | |
| 51 | + mkdir build && cd build |
| 52 | + cmake .. -DPACKAGE_BUILDER_DEB=On -DCPACK_PACKAGE_CONTACT="GitHub actions <[email protected]>" |
| 53 | + make deb |
| 54 | + apt -y install ./pkg/deb/debbuild/libfds*.deb |
| 55 | +
|
| 56 | + # Build IPFIXcol2 DEB package ------------------------------------------------------------ |
| 57 | + - name: Build IPFIXcol2 DEBs and install them |
| 58 | + run: | |
| 59 | + cd build |
| 60 | + cmake .. -DPACKAGE_BUILDER_DEB=On -DCPACK_PACKAGE_CONTACT="GitHub actions <[email protected]>" |
| 61 | + make deb |
| 62 | + apt -y install ./pkg/deb/debbuild/*.deb |
| 63 | + - name: Try to run IPFIXcol2 |
| 64 | + run: | |
| 65 | + ipfixcol2 -V |
| 66 | + ipfixcol2 -h |
| 67 | + ipfixcol2 -L |
| 68 | + - name: Pack IPFIXcol2 DEB packages |
| 69 | + working-directory: 'build/pkg/deb/debbuild/' |
| 70 | + run: zip "$GITHUB_WORKSPACE/$ZIP_FILE" *.deb *.ddeb *.tar.gz *.dsc |
| 71 | + env: |
| 72 | + ZIP_FILE: ${{ steps.vars.outputs.zip_file }} |
| 73 | + - name: Archive DEB packages |
| 74 | + if: github.event_name == 'push' |
| 75 | + uses: actions/upload-artifact@v1 |
| 76 | + with: |
| 77 | + name: ${{ steps.vars.outputs.zip_file }} |
| 78 | + path: ${{ steps.vars.outputs.zip_file }} |
| 79 | + |
| 80 | + rpm: |
| 81 | + # Try to build RPM packages |
| 82 | + runs-on: ubuntu-latest |
| 83 | + strategy: |
| 84 | + fail-fast: false |
| 85 | + matrix: |
| 86 | + image: ['centos:7', 'centos:8', 'fedora:29', 'fedora:30', 'fedora:31'] |
| 87 | + |
| 88 | + name: Build RPMs on ${{ matrix.image }} |
| 89 | + container: ${{ matrix.image }} |
| 90 | + |
| 91 | + steps: |
| 92 | + - uses: actions/checkout@v1 |
| 93 | + - name: Prepare environment and variables |
| 94 | + run: | |
| 95 | + echo "::set-output name=zip_file::libfds-${IMAGE//:/}-$GITHUB_SHA.zip" |
| 96 | + mkdir -p build/libfds_repo |
| 97 | + env: |
| 98 | + IMAGE: ${{ matrix.image }} |
| 99 | + id: vars |
| 100 | + |
| 101 | + # Dependencies --------------------------------------------------------------------------- |
| 102 | + - name: Install dependencies for libfds and IPFIXcol2 (CentOS) |
| 103 | + if: startsWith(matrix.image, 'centos') |
| 104 | + run: | |
| 105 | + yum -y install epel-release |
| 106 | + yum -y install git gcc gcc-c++ cmake make libxml2-devel lz4-devel libzstd-devel |
| 107 | + yum -y install zlib-devel pkgconfig rpm-build |
| 108 | + yum -y install python3-docutils || yum -y install python-docutils |
| 109 | + - name: Install depedencies for libfds and IPFIXcol2 (Fedora) |
| 110 | + if: startsWith(matrix.image, 'fedora') |
| 111 | + run: | |
| 112 | + dnf -y install git gcc gcc-c++ cmake make libxml2-devel lz4-devel libzstd-devel |
| 113 | + dnf -y install python3-docutils zlib-devel pkgconfig rpm-build |
| 114 | +
|
| 115 | + # Build LIBFDS RPM package --------------------------------------------------------------- |
| 116 | + - name: Checkout libfds library - master branch |
| 117 | + if: github.ref == 'refs/heads/master' |
| 118 | + run: git clone --branch master https://github.com/CESNET/libfds.git build/libfds_repo |
| 119 | + - name: Checkout libfds library - devel branch |
| 120 | + if: github.ref != 'refs/heads/master' |
| 121 | + run: git clone --branch devel https://github.com/CESNET/libfds.git build/libfds_repo |
| 122 | + - name: Build RPMs of libfds library and install it |
| 123 | + working-directory: 'build/libfds_repo' |
| 124 | + run: | |
| 125 | + mkdir build && cd build |
| 126 | + cmake .. -DPACKAGE_BUILDER_RPM=On -DCPACK_PACKAGE_CONTACT="GitHub actions <[email protected]>" |
| 127 | + make rpm |
| 128 | + yum -y install pkg/rpm/rpmbuild/RPMS/*/libfds-*.rpm |
| 129 | +
|
| 130 | + # Build IPFIXcol2 RPM package ------------------------------------------------------------ |
| 131 | + - name: Build IPFIXcol2 RPMs and install them |
| 132 | + run: | |
| 133 | + cd build |
| 134 | + cmake .. -DPACKAGE_BUILDER_RPM=On -DCPACK_PACKAGE_CONTACT="GitHub actions <[email protected]>" |
| 135 | + make rpm |
| 136 | + yum -y install pkg/rpm/rpmbuild/RPMS/*/ipfixcol2-*.rpm |
| 137 | + - name: Try to run IPFIXcol2 |
| 138 | + run: | |
| 139 | + ipfixcol2 -V |
| 140 | + ipfixcol2 -h |
| 141 | + ipfixcol2 -L -v |
| 142 | + - name: Pack IPFIXcol2 RPM packages |
| 143 | + working-directory: 'build/pkg/rpm/rpmbuild' |
| 144 | + run: zip -r "$GITHUB_WORKSPACE/$ZIP_FILE" RPMS SRPMS |
| 145 | + env: |
| 146 | + ZIP_FILE: ${{ steps.vars.outputs.zip_file }} |
| 147 | + - name: Archive RPM packages |
| 148 | + if: github.event_name == 'push' |
| 149 | + uses: actions/upload-artifact@v1 |
| 150 | + with: |
| 151 | + name: ${{ steps.vars.outputs.zip_file }} |
| 152 | + path: ${{ steps.vars.outputs.zip_file }} |
0 commit comments