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

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
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")

View File

@ -5,12 +5,65 @@ cmake_policy(SET CMP0091 NEW)
##################
# 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)
set(ATHENA_MINOR_VERSION 3)
set(ATHENA_PATCH_VERSION 0)
set(ATHENA_VERSION
${ATHENA_MAJOR_VERSION}.${ATHENA_MINOR_VERSION}.${ATHENA_PATCH_VERSION})
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --symbolic-full-name HEAD
OUTPUT_VARIABLE athena_git_head_symbolic
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
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)
@ -351,25 +404,37 @@ endif()
include(InstallRequiredSystemLibraries)
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_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR ${ATHENA_MAJOR_VERSION})
set(CPACK_PACKAGE_VERSION_MINOR ${ATHENA_MINOR_VERSION})
set(CPACK_PACKAGE_VERSION_PATCH ${ATHENA_PATCH_VERSION})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "athena")
if(WIN32 AND NOT UNIX)
# 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.
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "athena")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\AthenaNSIS.bmp")
set(CPACK_NSIS_MODIFY_PATH ON)
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\Athena.ico")
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\Athena.ico")
set(CPACK_NSIS_INSTALLED_ICON_NAME "Uninstall.exe")
set(CPACK_NSIS_DISPLAY_NAME "Athena")
set(CPACK_NSIS_URL_INFO_ABOUT "http://libathena.github.io")
set(CPACK_NSIS_CONTACT "antidote.crk@gmail.com")
endif()
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
string(TOLOWER CMAKE_SYSTEM_PROCESSOR ARCHITECTURE_NAME)
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
set(SYSTEM_NAME win32)
elseif (CMAKE_SYSTEM_NAME STREQUAL Darwin)
set(SYSTEM_NAME macos)
list(LENGTH CMAKE_OSX_ARCHITECTURES num_archs)
if (num_archs GREATER 1)
set(ARCHITECTURE_NAME universal)
elseif(num_archs EQUAL 1)
set(ARCHITECTURE_NAME ${CMAKE_OSX_ARCHITECTURES})
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)

View File

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

View File

@ -107,7 +107,7 @@ endif()
# Define installs
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 #

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
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")

View File

@ -17,12 +17,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Jackoalan / Antidote"
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 "InternalName", "atdna"
VALUE "OriginalFilename", "atdna.exe"
VALUE "ProductName", "ATDNA"
VALUE "ProductVersion", "@ATHENA_MAJOR_VERSION@.@ATHENA_MINOR_VERSION@.@ATHENA_PATCH_VERSION@"
VALUE "ProductVersion", "@ATHENA_VERSION@"
END
END
BLOCK "VarFileInfo"

View File

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