Skip to content

Commit

Permalink
Add CMake support for RPM builds and set uniform PACKAGE_RELEASE for …
Browse files Browse the repository at this point in the history
…DEB,RPM CMake builds.
  • Loading branch information
s3rj1k committed Jan 29, 2024
1 parent f4b43cf commit 9bebe4a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/ci-deb-packages-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
26 changes: 22 additions & 4 deletions .github/workflows/ci-rpm-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -58,23 +73,26 @@ 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:
GITHUB_SHA: ${{ github.sha }}

- 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

0 comments on commit 9bebe4a

Please sign in to comment.