From 144de4f8c868d1e53137e34939ab3a0726b86007 Mon Sep 17 00:00:00 2001 From: Jiri Hnidek Date: Mon, 27 Sep 2021 15:48:06 +0200 Subject: [PATCH] GitHub Actions: add building of RPMS * Added another GitHub action step * RPMs are built, when PR is created against master branch * RPMs are built using Fedora container * Building of RPMs is triggered only in situation, when building of source is successful * The tito is used for building RPMs * Generated RPMs are stored as artifacts * Renamed cmake.yml to build.yml --- .github/workflows/{cmake.yml => build.yml} | 37 ++++++++++++++++++++-- .tito/packages/daemon | 1 + 2 files changed, 36 insertions(+), 2 deletions(-) rename .github/workflows/{cmake.yml => build.yml} (53%) diff --git a/.github/workflows/cmake.yml b/.github/workflows/build.yml similarity index 53% rename from .github/workflows/cmake.yml rename to .github/workflows/build.yml index 4a6615a..eb486dd 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: CMake +name: Continuous Integration on: push: @@ -33,4 +33,37 @@ jobs: - name: Build # Build your program with the given configuration run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - + + build-rpm: + needs: build + runs-on: ubuntu-latest + container: + image: fedora:rawhide + options: --security-opt seccomp=unconfined + steps: + # Install git and other tools first to be able to use 'actions/checkout@v2' properly + - name: Install required packages + run: dnf install --nogpgcheck -y tito gcc gcc-c++ make cmake git-core + + # Clone repository and set everything for building of RPMs + - name: Checkout + uses: actions/checkout@v2 + + - name: Create build directory + run: rm -rf ./rpm_build; mkdir ./rpm_build + + - name: Build RPM package + run: tito build --test --rpm --verbose --debug -o ./rpm_build --no-cleanup + + - name: Store source RPM as artifact + uses: actions/upload-artifact@v2 + with: + name: Source RPM + path: ./rpm_build/*.rpm + + - name: Store binary RPMs as artifacts + uses: actions/upload-artifact@v2 + with: + name: Binary RPMs + # TODO: replace x86_64 with result of 'uname -m' + path: ./rpm_build/x86_64/*.rpm diff --git a/.tito/packages/daemon b/.tito/packages/daemon index e69de29..1ce4df0 100644 --- a/.tito/packages/daemon +++ b/.tito/packages/daemon @@ -0,0 +1 @@ +0.2-1 ./