Skip to content

Commit

Permalink
ci: dynamic os name for packages
Browse files Browse the repository at this point in the history
ci: add noble builder
ci: rm container build
  • Loading branch information
sithlord48 committed Feb 3, 2025
1 parent 0e32c82 commit 394a8a7
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 85 deletions.
63 changes: 12 additions & 51 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ jobs:
os: ubuntu-22.04-arm
debArch: arm64

- name: noble
os: ubuntu-24.04
debArch: amd64

- name: noble
os: ubuntu-24.04-arm
debArch: arm64

steps:
- uses: sithlord48/[email protected]
- name: Install Dependencies
Expand All @@ -63,10 +71,10 @@ jobs:
pip install --user spdx-tools
- name: Build
run: |
${{env.cmakeConfigure}} -DCMAKE_INSTALL_PREFIX=/usr -DCPACK_PACKAGE_VERSION="${{ needs.precheck.outputs.version }}" -DCPACK_DEBIAN_PACKAGE_RELEASE=${{github.run_attempt}}~${{matrix.config.name}} -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
${{env.cmakeConfigure}} -DCMAKE_INSTALL_PREFIX=/usr -DPACKAGE_VERSION_LABEL="${{ needs.precheck.outputs.version }}" -DCPACK_DEBIAN_PACKAGE_RELEASE=${{github.run_attempt}} -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
cmake --build build --target package
mv build/ff7tk[-_]*.* .
cpack -G DEB -C ${{env.BuildType}} --config build/CPackConfig.cmake
mv build/libff7tk[-_]*.deb .
- name: Upload
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -173,7 +181,7 @@ jobs:
pip install --user reuse
- name: Build ff7tk
run: |
${{env.cmakeConfigure}} -DCPACK_PACKAGE_VERSION="${{ needs.precheck.outputs.version }}" -DCPACK_IFW_ROOT=${{matrix.config.Qt_TOOL_PATH}} ${{matrix.config.extraCmakeConfig}}
${{env.cmakeConfigure}} -DPACKAGE_VERSION_LABEL="${{ needs.precheck.outputs.version }}" -DCPACK_IFW_ROOT=${{matrix.config.Qt_TOOL_PATH}} ${{matrix.config.extraCmakeConfig}}
cmake --build build --config ${{env.BuildType}} --target package
- name: Update Documentation
if: runner.os == 'Linux' && github.ref == 'refs/heads/master'
Expand All @@ -189,54 +197,9 @@ jobs:
${{ github.workspace }}/build/ff7tk[-_]*.*
${{ github.workspace }}/build/libff7tk[-_]*.*
container_build:
# The host should always be linux
runs-on: ubuntu-latest
name: Linux-${{matrix.config.arch}}-${{matrix.config.name}}
needs: precheck
strategy:
fail-fast: false
matrix:
config:
- {
name: "jammy"
, arch: armv7, distro: ubuntu22.04, debArch: armhf
}
steps:
- uses: sithlord48/[email protected]
- run: git fetch --tags --force
- uses: uraimo/[email protected]
name: Build artifact
with:
arch: ${{ matrix.config.arch }}
distro: ${{ matrix.config.distro }}
githubToken: ${{ github.token }}
setup: mkdir -p "${PWD}/artifacts"
dockerRunArgs: --volume "${PWD}/artifacts:/artifacts"
shell: /bin/sh
install: |
apt update -y > /dev/null
apt install -y -qqq ${{env.debianRequirments}} python3-pip > /dev/null
pip install --user ntia-conformance-checker
pip install --user spdx-tools
run: |
git config --global --add safe.directory /home/runner/work/ff7tk/ff7tk
${{env.cmakeConfigure}} -DCPACK_PACKAGE_VERSION="${{ needs.precheck.outputs.version }}" -DCPACK_DEBIAN_PACKAGE_RELEASE=${{github.run_attempt}}~${{matrix.config.name}} -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
cmake --build build --config ${{env.BuildType}} --target package
mv build/ff7tk[-_]*.* .
cpack -G DEB -C ${{env.BuildType}} --config build/CPackConfig.cmake
- name: Upload
uses: actions/upload-artifact@v4
with:
name: container-artifact-${{matrix.config.name}}-${{matrix.config.arch}}
path: |
ff7tk[-_]*.*
libff7tk*.deb
release_assets:
name: Release
needs: [main_build, container_build, deb_builder]
needs: [main_build, deb_builder]
runs-on: ubuntu-latest
steps:
- name: Download Files
Expand All @@ -251,7 +214,6 @@ jobs:
title: "Continuous Build"
files: |
artifact-*/*
container-artifact-*/*
debian-artifacts-*/*
- name: Deploy Release
if: contains(github.ref, '/tags/v')
Expand All @@ -261,5 +223,4 @@ jobs:
prerelease: false
files: |
artifact-*/*
container-artifact-*/*
debian-artifacts-*/*
82 changes: 81 additions & 1 deletion cmake/ff7tkMacros.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023 Chris Rizzitello <[email protected]>
# SPDX-FileCopyrightText: 2023, 2025 Chris Rizzitello <[email protected]>
# SPDX-License-Identifier: MIT

#Contains Various Macros to be included
Expand Down Expand Up @@ -273,3 +273,83 @@ macro (MAKE_TEST NAME FILE)
set_tests_properties(${NAME} PROPERTIES DEPENDS ${DEP_LIB})
set_property(GLOBAL APPEND PROPERTY ff7tk_tests ${NAME})
endmacro()


# Get OS INFO
macro (SET_OS_INFO)
if (APPLE)
set(OS_STRING "macos-${CMAKE_SYSTEM_PROCESSOR}")
elseif(WIN32)
if(CMAKE_SYSTEM_PROCESSOR MATCHES AMD64)
set(OS_STRING "win-x64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES ARM64)
set(OS_STRING "win-arm64")
else()
set(OS_STRING "win-${CMAKE_SYSTEM_PROCESSOR}")
endif()
elseif(UNIX AND NOT APPLE)
if(EXISTS "/etc/os-release")
FILE(STRINGS "/etc/os-release" RELEASE_FILE_CONTENTS)
else()
message(FATAL_ERROR "Unable to read file /etc/os-release")
endif()
foreach(LINE IN LISTS RELEASE_FILE_CONTENTS)
if( "${LINE}" MATCHES "^ID=")
string(REGEX REPLACE "^ID=" "" DISTRO_NAME ${LINE})
string(REGEX REPLACE "\"" "" DISTRO_NAME ${DISTRO_NAME})
message(DEBUG "Distro Name :${DISTRO_NAME}")
elseif( "${LINE}" MATCHES "^ID_LIKE=")
string(REGEX REPLACE "^ID_LIKE=" "" DISTRO_LIKE "${LINE}")
string(REGEX REPLACE "\"" "" DISTRO_LIKE ${DISTRO_LIKE})
message(DEBUG "Distro Like :${DISTRO_LIKE}")
elseif( "${LINE}" MATCHES "^VERSION_CODENAME=")
string(REGEX REPLACE "^VERSION_CODENAME=" "" DISTRO_CODENAME "${LINE}")
string(REGEX REPLACE "\"" "" DISTRO_CODENAME "${DISTRO_CODENAME}")
message(DEBUG "Distro Codename:${DISTRO_CODENAME}")
elseif( "${LINE}" MATCHES "^VERSION_ID=")
string(REGEX REPLACE "^VERSION_ID=" "" DISTRO_VERSION_ID "${LINE}")
string(REGEX REPLACE "\"" "" DISTRO_VERSION_ID "${DISTRO_VERSION_ID}")
message(DEBUG "Distro VersionID:${DISTRO_VERSION_ID}")
endif()
endforeach()

# Check if Debian-link
string(REGEX MATCH debian|buntu DEBTYPE "${DISTRO_LIKE}")
string(REGEX MATCH debian|deepin|uos DEBNAME "${DISTRO_NAME}")
if((NOT ("${DEBTYPE}" STREQUAL "")) OR (NOT ("${DEBNAME}" STREQUAL "")))
list(APPEND CPACK_GENERATOR "DEB")
endif()
# Check if Rpm-like
string(REGEX MATCH suse|fedora|rhel RPMTYPE "${DISTRO_LIKE}")
string(REGEX MATCH fedora|suse|rhel RPMNAME "${DISTRO_NAME}")
if((NOT ("${RPMTYPE}" STREQUAL "")) OR (NOT ("${RPMNAME}" STREQUAL "")))
list(APPEND CPACK_GENERATOR "RPM")
endif()

# Disto specific name adjustments
if("${DISTRO_NAME}" STREQUAL "opensuse-tumbleweed")
set(DISTRO_NAME "opensuse")
set(DISTRO_CODENAME "tumbleweed")
elseif("${DISTRO_NAME}" STREQUAL "arch")
# Arch linux is rolling the version id reported is the date of last iso.
set(DISTRO_VERSION_ID "")
endif()
# Determain the code name to be used if any
if(NOT "${DISTRO_VERSION_ID}" STREQUAL "")
set(CN_STRING "${DISTRO_VERSION_ID}-")
endif()

if(NOT "${DISTRO_CODENAME}" STREQUAL "")
set(CN_STRING "${DISTRO_CODENAME}-")
endif()

if("${DISTRO_NAME}" STREQUAL "")
if(${CMAKE_SYSTEM_NAME} MATCHES "|.*BSD")
set(DISTRO_NAME ${CMAKE_SYSTEM_NAME})
else()
set(DISTRO_NAME "linux")
endif()
endif()
set(OS_STRING "${DISTRO_NAME}-${CN_STRING}${CMAKE_SYSTEM_PROCESSOR}")
endif()
endmacro()
44 changes: 16 additions & 28 deletions packaging/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2022 - 2023 Chris Rizzitello <[email protected]>
# SPDX-FileCopyrightText: 2022 - 2023, 2025 Chris Rizzitello <[email protected]>
# SPDX-License-Identifier: MIT

include (CPackIFW)
Expand Down Expand Up @@ -26,26 +26,26 @@ set(CPACK_PACKAGE_VENDOR "sithlord48")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/sithlord48/ff7tk")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${CMAKE_PROJECT_DESCRIPTION})

## SET OS NAME
set(CPACK_PACKAGE_VERSION ${CMAKE_PROJECT_VERSION})

if(NOT PACKAGE_VERSION_LABEL)
set (PACKAGE_VERSION_LABEL "${CPACK_PACKAGE_VERSION}")
endif()

#Set base Generator Based on the system
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(OS_STRING "macos")
set(CPACK_GENERATOR "ZIP")
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(OS_STRING "win64")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(OS_STRING "win32")
endif()
set(CPACK_GENERATOR "7Z")
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(OS_STRING "linux_${CMAKE_SYSTEM_PROCESSOR}")
else()
set(OS_STRING ${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR})
set(CPACK_GENERATOR "TGZ")
endif()

if (NOT CPACK_PACKAGE_VERSION)
set(CPACK_PACKAGE_VERSION ${CMAKE_PROJECT_VERSION})
endif()
## SET OS NAME
include(${CMAKE_SOURCE_DIR}/cmake/ff7tkMacros.cmake)
SET_OS_INFO()

set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${OS_STRING}")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${PACKAGE_VERSION_LABEL}-${OS_STRING}")

set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION})
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING.TXT")
Expand Down Expand Up @@ -130,7 +130,7 @@ cpack_ifw_configure_component_group(ff7tk_i18n DEFAULT TRUE SORTING_PRIORITY 1)
cpack_ifw_configure_component_group(ff7tk_demos DEFAULT TRUE SORTING_PRIORITY 2)

# DEBIAN
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
# set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
set(DEBIAN_DEPENDS_STRING "libqt6widgets6 (>= ${REQUIRED_QT_VERSION}),libqt6qml6 (>= ${REQUIRED_QT_VERSION}), libqt6xml6 (>= ${REQUIRED_QT_VERSION}),libqt6gui6 (>= ${REQUIRED_QT_VERSION}), libqt6svg6 (>= ${REQUIRED_QT_VERSION}) ,libqt6core5compat6 (>= ${REQUIRED_QT_VERSION}),libqt6core6 (>= ${REQUIRED_QT_VERSION}),libqt6network6 (>= ${REQUIRED_QT_VERSION}), qt6-qpa-plugins, zlib1g")
if(SPLITPACKAGES)
Expand Down Expand Up @@ -204,18 +204,6 @@ set(CPACK_WIX_PRODUCT_GUID "DAF12CAD-2518-439C-B70A-2E3FADAE0F50")
set(CPACK_WIX_PROPERTY_ARPCOMMENTS ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
set(CPACK_WIX_PROPERTY_ARPURLUPDATEINFO "http://github.com/sithlord48/ff7tk/releases")

#Set base Name And Generator Based on the system
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CPACK_GENERATOR "ZIP")
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(CPACK_GENERATOR "7Z")
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CPACK_GENERATOR "TGZ")
if(EXISTS "/usr/bin/rpmbuild")
list(APPEND CPACK_GENERATOR "RPM")
endif()
endif()

if (CPACK_IFW_FRAMEWORK_VERSION)
list(APPEND CPACK_GENERATOR "IFW")
list(APPEND CPACK_PACKAGE_EXECUTABLES "ff7tk-install-tool;Modify ff7tk Install")
Expand Down
6 changes: 1 addition & 5 deletions packaging/cpackOptions.cmake.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2022 - 2023 Chris Rizzitello <[email protected]>
# SPDX-FileCopyrightText: 2022 - 2023, 2025 Chris Rizzitello <[email protected]>
# SPDX-License-Identifier: MIT

#This File is generated at CONFIGURE time
Expand Down Expand Up @@ -73,7 +73,3 @@ endif()
if(CPACK_GENERATOR MATCHES IFW|WIX|NSIS)
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}-installer)
endif()

if(CPACK_GENERATOR MATCHES DEB|WIX|RPM)
set(CPACK_PACKAGE_VERSION @CMAKE_PROJECT_VERSION@)
endif()

0 comments on commit 394a8a7

Please sign in to comment.