CI: Create full athena packages

This commit is contained in:
Luke Street 2021-04-12 19:39:36 -04:00
parent 79515ed6db
commit ec2675f130
8 changed files with 111 additions and 54 deletions

View File

@ -22,14 +22,13 @@ jobs:
key: ubuntu-20.04-gcc key: ubuntu-20.04-gcc
max-size: 1G max-size: 1G
- name: Build - name: Configure CMake
run: | run: |
mkdir build cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DClang_DIR=/usr/lib/cmake/clang-11 \
cd build -DATDNA_DYNAMIC_LLVM=OFF -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DClang_DIR=/usr/lib/cmake/clang-11 -DATDNA_DYNAMIC_LLVM=OFF \
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - name: Build
.. run: cmake --build build --target package --verbose
cmake --build .
- name: Test - name: Test
working-directory: build working-directory: build
@ -38,9 +37,9 @@ jobs:
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: atdna-linux-x86_64 name: atdna-{{env.ATHENA_VERSION}}-linux-x86_64
path: | path: |
build/atdna/atdna build/athena-*.tar.gz
test-linux-arm64: test-linux-arm64:
name: Build Linux (GCC aarch64) name: Build Linux (GCC aarch64)
@ -52,8 +51,7 @@ jobs:
submodules: recursive submodules: recursive
- uses: uraimo/run-on-arch-action@v2.0.9 - uses: uraimo/run-on-arch-action@v2.0.9
name: Build name: Build & test
id: build
with: with:
arch: aarch64 arch: aarch64
distro: ubuntu20.04 distro: ubuntu20.04
@ -64,19 +62,17 @@ jobs:
apt-get -y update apt-get -y update
apt-get -y install build-essential cmake ninja-build llvm-11-dev libclang-11-dev clang-11 apt-get -y install build-essential cmake ninja-build llvm-11-dev libclang-11-dev clang-11
run: | run: |
mkdir /workspace/build cmake -B build -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
cd /workspace/build
cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DClang_DIR=/usr/lib/cmake/clang-11 -DATDNA_DYNAMIC_LLVM=OFF .. -DClang_DIR=/usr/lib/cmake/clang-11 -DATDNA_DYNAMIC_LLVM=OFF ..
cmake --build . cmake --build build --target package --verbose
./atdna-test build/atdna-test
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: atdna-linux-aarch64 name: atdna-{{env.ATHENA_VERSION}}-linux-aarch64
path: | path: |
build/atdna/atdna build/athena-*.tar.gz
test-macos: test-macos:
name: Build macOS (AppleClang universal) name: Build macOS (AppleClang universal)
@ -108,9 +104,7 @@ jobs:
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache . -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .
- name: Build - name: Build
run: | run: cmake --build build --target package --verbose
cmake --build build
dsymutil build/atdna/atdna
- name: Test - name: Test
working-directory: build working-directory: build
@ -119,10 +113,9 @@ jobs:
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: atdna-macos-x86_64 name: athena-{{env.ATHENA_VERSION}}-macos-universal
path: | path: |
build/atdna/atdna build/athena-*.tar.gz
build/atdna/atdna.dSYM
test-windows-msvc: test-windows-msvc:
name: Build Windows (MSVC x86_64) name: Build Windows (MSVC x86_64)
@ -157,7 +150,7 @@ jobs:
-DLLVM_ROOT_DIR="$workspace/LLVM" . -DLLVM_ROOT_DIR="$workspace/LLVM" .
- name: Build - name: Build
run: cmake --build build run: cmake --build build --target package --verbose
- name: Test - name: Test
working-directory: build working-directory: build
@ -166,7 +159,6 @@ jobs:
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: atdna-win32-x86_64 name: athena-{{env.ATHENA_VERSION}}-win32-x86_64
path: | path: |
build/atdna/atdna.exe build/athena-*.7z
build/atdna/atdna.pdb

View File

@ -1,4 +1,4 @@
set(PACKAGE_VERSION "@ATHENA_VERSION@") set(PACKAGE_VERSION "@ATHENA_VERSION_STRING@")
# Check whether the requested PACKAGE_FIND_VERSION is compatible # Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")

View File

@ -5,12 +5,65 @@ cmake_policy(SET CMP0091 NEW)
################## ##################
# Athena Version # # Athena Version #
################## ##################
find_package(Git)
if (GIT_FOUND)
# make sure version information gets re-run when the current Git HEAD changes
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --git-path HEAD
OUTPUT_VARIABLE athena_git_head_filename
OUTPUT_STRIP_TRAILING_WHITESPACE)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${athena_git_head_filename}")
set(ATHENA_MAJOR_VERSION 2) execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --symbolic-full-name HEAD
set(ATHENA_MINOR_VERSION 3) OUTPUT_VARIABLE athena_git_head_symbolic
set(ATHENA_PATCH_VERSION 0) OUTPUT_STRIP_TRAILING_WHITESPACE)
set(ATHENA_VERSION execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
${ATHENA_MAJOR_VERSION}.${ATHENA_MINOR_VERSION}.${ATHENA_PATCH_VERSION}) COMMAND ${GIT_EXECUTABLE} rev-parse --git-path ${athena_git_head_symbolic}
OUTPUT_VARIABLE athena_git_head_symbolic_filename
OUTPUT_STRIP_TRAILING_WHITESPACE)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${athena_git_head_symbolic_filename}")
# defines ATHENA_WC_REVISION
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
OUTPUT_VARIABLE ATHENA_WC_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE)
# defines ATHENA_WC_DESCRIBE
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} describe --tag --long --dirty
OUTPUT_VARIABLE ATHENA_WC_DESCRIBE
OUTPUT_STRIP_TRAILING_WHITESPACE)
# remove hash (and trailing "-0" if needed) from description
string(REGEX REPLACE "(-0)?-[^-]+((-dirty)?)$" "\\2" ATHENA_WC_DESCRIBE "${ATHENA_WC_DESCRIBE}")
# defines ATHENA_WC_BRANCH
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
OUTPUT_VARIABLE ATHENA_WC_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE)
# defines ATHENA_WC_DATE
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} log -1 --format=%ad
OUTPUT_VARIABLE ATHENA_WC_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE)
else ()
message(STATUS "Unable to find git, commit information will not be available")
endif ()
if (ATHENA_WC_DESCRIBE)
string(REGEX REPLACE "v?([0-9]+)\.([0-9]+)\.([0-9]+)\-([0-9]+).*" "\\1.\\2.\\3.\\4" ATHENA_VERSION_STRING "${ATHENA_WC_DESCRIBE}")
string(REGEX REPLACE "v?([0-9]+)\.([0-9]+)\.([0-9]+).*" "\\1.\\2.\\3" ATHENA_VERSION "${ATHENA_VERSION_STRING}")
string(REGEX REPLACE "v?([0-9]+)\.([0-9]+)\.([0-9]+).*" "\\1" ATHENA_MAJOR_VERSION "${ATHENA_VERSION_STRING}")
string(REGEX REPLACE "v?([0-9]+)\.([0-9]+)\.([0-9]+).*" "\\2" ATHENA_MINOR_VERSION "${ATHENA_VERSION_STRING}")
string(REGEX REPLACE "v?([0-9]+)\.([0-9]+)\.([0-9]+).*" "\\3" ATHENA_PATCH_VERSION "${ATHENA_VERSION_STRING}")
else ()
set(ATHENA_WC_DESCRIBE "UNKNOWN-VERSION")
set(ATHENA_VERSION "0.0.0")
set(ATHENA_MAJOR_VERSION "0")
set(ATHENA_MINOR_VERSION "0")
set(ATHENA_PATCH_VERSION "0")
endif ()
# Add version information to CI environment variables
if(DEFINED ENV{GITHUB_ENV})
file(APPEND "$ENV{GITHUB_ENV}" "ATHENA_VERSION=${ATHENA_WC_DESCRIBE}")
endif()
project(athena VERSION ${ATHENA_VERSION} LANGUAGES C CXX) project(athena VERSION ${ATHENA_VERSION} LANGUAGES C CXX)
@ -351,25 +404,37 @@ endif()
include(InstallRequiredSystemLibraries) include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Athena") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Athena")
set(CPACK_PACKAGE_VENDOR "Antidote / Jackoalan") set(CPACK_PACKAGE_VENDOR "AxioDL Team")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR ${ATHENA_MAJOR_VERSION}) set(CPACK_PACKAGE_VERSION_MAJOR ${ATHENA_MAJOR_VERSION})
set(CPACK_PACKAGE_VERSION_MINOR ${ATHENA_MINOR_VERSION}) set(CPACK_PACKAGE_VERSION_MINOR ${ATHENA_MINOR_VERSION})
set(CPACK_PACKAGE_VERSION_PATCH ${ATHENA_PATCH_VERSION}) set(CPACK_PACKAGE_VERSION_PATCH ${ATHENA_PATCH_VERSION})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "athena") set(CPACK_PACKAGE_INSTALL_DIRECTORY "athena")
if(WIN32 AND NOT UNIX) set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
# There is a bug in NSI that does not handle full unix paths properly. Make
# sure there is at least one set of four (4) backlasshes. string(TOLOWER CMAKE_SYSTEM_PROCESSOR ARCHITECTURE_NAME)
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "athena") if (CMAKE_SYSTEM_NAME STREQUAL Windows)
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\AthenaNSIS.bmp") set(SYSTEM_NAME win32)
set(CPACK_NSIS_MODIFY_PATH ON) elseif (CMAKE_SYSTEM_NAME STREQUAL Darwin)
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\Athena.ico") set(SYSTEM_NAME macos)
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\Athena.ico") list(LENGTH CMAKE_OSX_ARCHITECTURES num_archs)
set(CPACK_NSIS_INSTALLED_ICON_NAME "Uninstall.exe") if (num_archs GREATER 1)
set(CPACK_NSIS_DISPLAY_NAME "Athena") set(ARCHITECTURE_NAME universal)
set(CPACK_NSIS_URL_INFO_ABOUT "http://libathena.github.io") elseif(num_archs EQUAL 1)
set(CPACK_NSIS_CONTACT "antidote.crk@gmail.com") set(ARCHITECTURE_NAME ${CMAKE_OSX_ARCHITECTURES})
endif() endif()
elseif (CMAKE_SYSTEM_NAME STREQUAL Linux)
set(SYSTEM_NAME linux)
else ()
set(SYSTEM_NAME "${CMAKE_SYSTEM_NAME}")
endif ()
set(CPACK_PACKAGE_FILE_NAME "athena-${ATHENA_WC_DESCRIBE}-${SYSTEM_NAME}-${ARCHITECTURE_NAME}")
if (WIN32)
set(CPACK_GENERATOR 7Z)
else ()
set(CPACK_GENERATOR TGZ)
endif ()
include(CPack) include(CPack)

View File

@ -1,7 +1,7 @@
# PKGBUILD for libAthena # PKGBUILD for libAthena
_pkgname=libathena _pkgname=libathena
pkgname=$_pkgname-git pkgname=$_pkgname-git
pkgver=@ATHENA_VERSION@ pkgver=@ATHENA_VERSION_STRING@
pkgrel=1 pkgrel=1
pkgdesc="Basic cross platform IO library" pkgdesc="Basic cross platform IO library"
arch=('i686' 'x86_64') arch=('i686' 'x86_64')

View File

@ -107,7 +107,7 @@ endif()
# Define installs # Define installs
install(TARGETS atdna DESTINATION ${INSTALL_BIN_DIR} EXPORT atdnaTargets COMPONENT atdna) install(TARGETS atdna DESTINATION ${INSTALL_BIN_DIR} EXPORT atdnaTargets COMPONENT atdna)
install(DIRECTORY ${CLANG_INCLUDE_DIR}/ DESTINATION ${INSTALL_INCLUDE_DIR}/athena/clang COMPONENT atdna) install(DIRECTORY ${LLVM_INCLUDE_DIR}/clang DESTINATION ${INSTALL_INCLUDE_DIR}/athena COMPONENT atdna)
################## ##################
# Package Export # # Package Export #

View File

@ -1,4 +1,4 @@
set(PACKAGE_VERSION "@ATHENA_VERSION@") set(PACKAGE_VERSION "@ATHENA_VERSION_STRING@")
# Check whether the requested PACKAGE_FIND_VERSION is compatible # Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")

View File

@ -17,12 +17,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Jackoalan / Antidote" VALUE "CompanyName", "Jackoalan / Antidote"
VALUE "FileDescription", "ATDNA" VALUE "FileDescription", "ATDNA"
VALUE "FileVersion", "@ATHENA_MAJOR_VERSION@.@ATHENA_MINOR_VERSION@.@ATHENA_PATCH_VERSION@" VALUE "FileVersion", "@ATHENA_VERSION@"
VALUE "LegalCopyright", "Copyright (C) 2016 Jackoalan / Antidote" VALUE "LegalCopyright", "Copyright (C) 2016 Jackoalan / Antidote"
VALUE "InternalName", "atdna" VALUE "InternalName", "atdna"
VALUE "OriginalFilename", "atdna.exe" VALUE "OriginalFilename", "atdna.exe"
VALUE "ProductName", "ATDNA" VALUE "ProductName", "ATDNA"
VALUE "ProductVersion", "@ATHENA_MAJOR_VERSION@.@ATHENA_MINOR_VERSION@.@ATHENA_PATCH_VERSION@" VALUE "ProductVersion", "@ATHENA_VERSION@"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -4,7 +4,7 @@ libdir=${prefix}/lib
Name: libAthena Name: libAthena
Description: Basic cross platform IO library Description: Basic cross platform IO library
Version: @ATHENA_VERSION@ Version: @ATHENA_VERSION_STRING@
Cflags: -I${includedir}/Athena Cflags: -I${includedir}/Athena
Libs: -L${libdir} -lathena-core -lathena-sakura -lathena-zelda -lathena-wiiSave Libs: -L${libdir} -lathena-core -lathena-sakura -lathena-zelda -lathena-wiiSave
Requires: zlib Requires: zlib