From 9bebe4a7ba2ef82715163812d22b39301e9db49a Mon Sep 17 00:00:00 2001 From: s3rj1k Date: Mon, 29 Jan 2024 22:10:00 +0100 Subject: [PATCH] Add CMake support for RPM builds and set uniform PACKAGE_RELEASE for DEB,RPM CMake builds. --- .github/workflows/ci-deb-packages-v2.yml | 9 +++++--- .github/workflows/ci-rpm-packages.yml | 26 ++++++++++++++++++++---- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-deb-packages-v2.yml b/.github/workflows/ci-deb-packages-v2.yml index 03aa58a5..d2e1613b 100644 --- a/.github/workflows/ci-deb-packages-v2.yml +++ b/.github/workflows/ci-deb-packages-v2.yml @@ -72,7 +72,7 @@ jobs: cat << EOF | tee /tmp/$GITHUB_RUN_ID/run.sh #!/bin/bash - set -o pipefail + set -euo pipefail # tweak git config inside builder git config --global --add safe.directory '*' || true @@ -114,12 +114,15 @@ jobs: cat << EOF | tee /tmp/$GITHUB_RUN_ID/run.sh #!/bin/bash - set -o pipefail + set -euo pipefail # tweak git config inside builder git config --global --add safe.directory '*' || true - PACKAGE_RELEASE="$GITHUB_RUN_ID" cmake . -DCMAKE_BUILD_TYPE=${{ inputs.CMAKE_BUILD_TYPE }} -DCMAKE_INSTALL_PREFIX=${{ inputs.CMAKE_INSTALL_PREFIX }} && make package + # eval inside runner + hash=$(echo $GITHUB_SHA | cut -c1-10) + + PACKAGE_RELEASE="$GITHUB_RUN_ID.\${hash}" cmake . -DCMAKE_BUILD_TYPE=${{ inputs.CMAKE_BUILD_TYPE }} -DCMAKE_INSTALL_PREFIX=${{ inputs.CMAKE_INSTALL_PREFIX }} && make package EOF diff --git a/.github/workflows/ci-rpm-packages.yml b/.github/workflows/ci-rpm-packages.yml index 6d0b597f..26e9ba79 100644 --- a/.github/workflows/ci-rpm-packages.yml +++ b/.github/workflows/ci-rpm-packages.yml @@ -35,6 +35,21 @@ on: description: Artifact name. default: centos type: string + USE_CMAKE: + required: false + type: boolean + default: false + description: Use CMAKE for building + CMAKE_BUILD_TYPE: + required: false + type: string + default: 'Release' + description: Set СMAKE_BUILD_TYPE variable + CMAKE_INSTALL_PREFIX: + required: false + type: string + default: '/usr' + description: Set CMAKE_INSTALL_PREFIX variable secrets: DOCKERHUB_USERNAME: required: false @@ -58,7 +73,10 @@ jobs: with: project_name: ${{inputs.PROJECT_NAME}} packager: ${{inputs.PACKAGER}} - + use_cmake: ${{ inputs.USE_CMAKE }} + cmake_build_type: ${{ inputs.CMAKE_BUILD_TYPE }} + cmake_install_prefix: ${{ inputs.CMAKE_INSTALL_PREFIX }} + - name: Generate hash file run: echo $GITHUB_SHA > hash.txt env: @@ -66,15 +84,15 @@ jobs: - name: Compress files run: | - tar -czvf ${{inputs.TARGET_ARTIFACT_NAME}}.tar.gz $(ls | grep '.rpm\|hash.txt') + tar -czvf ${{ inputs.TARGET_ARTIFACT_NAME }}.tar.gz $(ls | grep '.rpm\|hash.txt') - name: Generate SHA checksum run: | - sha512sum ${{inputs.TARGET_ARTIFACT_NAME}}.tar.gz > ${{inputs.TARGET_ARTIFACT_NAME}}.sha1 + sha512sum ${{ inputs.TARGET_ARTIFACT_NAME }}.tar.gz > ${{ inputs.TARGET_ARTIFACT_NAME }}.sha1 - uses: actions/upload-artifact@v4 with: - name: rpm-${{inputs.PLATFORM}}-artifact + name: rpm-${{ inputs.PLATFORM }}-artifact path: | *.tar.gz *.sha1