diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0ac4a1a..d397682 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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') @@ -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 diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 0000000..d55479c --- /dev/null +++ b/.github/workflows/package.yml @@ -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 " + 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 " + 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 }} diff --git a/.github/workflows/package_deb.yml b/.github/workflows/package_deb.yml deleted file mode 100644 index 656372c..0000000 --- a/.github/workflows/package_deb.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Build DEB package - -on: [push, pull_request] - -jobs: - rpm: - 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 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: Prepare for build - run: mkdir build && cd build && cmake .. -DPACKAGE_BUILDER_DEB=On -DCPACK_PACKAGE_CONTACT="GitHub actions " - - name: Build the RPM package - run: cd build && 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 }} diff --git a/.github/workflows/package_rpm.yml b/.github/workflows/package_rpm.yml deleted file mode 100644 index 36a6bee..0000000 --- a/.github/workflows/package_rpm.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Build RPM package - -on: [push, pull_request] - -jobs: - rpm: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - image: ['centos:7', 'centos:8', 'fedora:28', 'fedora:29', 'fedora:30', 'fedora:31'] - - name: Build 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: Prepare for build - run: mkdir build && cd build && cmake .. -DPACKAGE_BUILDER_RPM=On -DCPACK_PACKAGE_CONTACT="GitHub actions " - - name: Build the RPM package - run: cd build && 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 }}