|
| 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 }} |
0 commit comments