Skip to content

Commit

Permalink
Merge pull request #265 from mbrobbel/packages
Browse files Browse the repository at this point in the history
Add binary packages for Fletcher runtime and Fletchgen
  • Loading branch information
mbrobbel authored Jan 8, 2021
2 parents 47dea21 + cd5ea12 commit 47a7d2e
Show file tree
Hide file tree
Showing 3 changed files with 261 additions and 8 deletions.
149 changes: 148 additions & 1 deletion .github/workflows/assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,157 @@ on:
pull_request:

env:
CMAKE_VERSION: '3.17.3'
CMAKE_VERSION: '3.19.2'
ARROW_VERSION: '1.0.1'

jobs:
archive:
name: Linux
runs-on: ubuntu-latest
container: centos:7
strategy:
matrix:
source:
- runtime/cpp
- codegen/cpp/fletchgen
steps:
- name: Install dependencies
run: |
yum install -y epel-release centos-release-scl https://repo.ius.io/ius-release-el7.rpm
yum install -y curl make devtoolset-7-gcc-c++ rpm-build git224
echo "/opt/rh/devtoolset-7/root/bin/" >> $GITHUB_PATH
- name: Install CMake
run: curl -L https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz | tar xz --strip-components=1 -C /usr
- name: Install Apache Arrow
run: |
yum install -y https://apache.bintray.com/arrow/centos/$(cut -d: -f5 /etc/system-release-cpe)/apache-arrow-release-latest.rpm
yum install -y arrow-devel-$ARROW_VERSION-1.el7
- uses: actions/checkout@v2
with:
submodules: true
- name: Configure
run: cmake ${{ matrix.source }} -DCMAKE_BUILD_TYPE=Release
- name: Package
run: make -j package
- id: tarball
run: echo "##[set-output name=name;]$(ls fletch*.tar.gz)"
- name: Install
run: tar xvfz ./${{ steps.tarball.outputs.name }} -C /usr
- name: Upload tarball
uses: actions/upload-release-asset@v1
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.tarball.outputs.name }}
asset_name: ${{ steps.tarball.outputs.name }}
asset_content_type: application/octet-stream

centos:
name: CentOS
runs-on: ubuntu-latest
strategy:
matrix:
version:
- 7
- 8
source:
- runtime/cpp
- codegen/cpp/fletchgen
container: centos:${{ matrix.version }}
steps:
- name: Install dependencies
run: |
yum install -y epel-release
yum install -y curl make rpm-build
- name: Install CMake
run: curl -L https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz | tar xz --strip-components=1 -C /usr
- name: Install Apache Arrow
if: ${{ matrix.version == '7' }}
run: |
yum install -y https://repo.ius.io/ius-release-el7.rpm centos-release-scl
yum install -y git224 devtoolset-7-gcc-c++
echo "/opt/rh/devtoolset-7/root/bin/" >> $GITHUB_PATH
yum install -y https://apache.bintray.com/arrow/centos/$(cut -d: -f5 /etc/system-release-cpe)/apache-arrow-release-latest.rpm
yum install -y arrow-devel-$ARROW_VERSION-1.el${{ matrix.version }}
- name: Install Apache Arrow
if: ${{ matrix.version == '8' }}
run: |
dnf install -y git gcc-c++
dnf install -y https://apache.bintray.com/arrow/centos/$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1)/apache-arrow-release-latest.rpm
dnf config-manager --set-enabled epel || :
dnf config-manager --set-enabled powertools || :
dnf config-manager --set-enabled codeready-builder-for-rhel-$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1)-rhui-rpms || :
subscription-manager repos --enable codeready-builder-for-rhel-$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1)-$(arch)-rpms || :
dnf install -y arrow-devel-$ARROW_VERSION-1.el${{ matrix.version }}
- uses: actions/checkout@v2
with:
submodules: true
- name: Configure
run: cmake ${{ matrix.source }} -DCMAKE_BUILD_TYPE=Release
- name: Package
run: make -j package
- id: rpm
run: echo "##[set-output name=name;]$(ls fletch*.rpm)"
- name: Install
run: |
yum remove -y arrow-devel
yum autoremove -y
yum localinstall -y ./${{ steps.rpm.outputs.name }}
- name: Upload rpm
uses: actions/upload-release-asset@v1
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.rpm.outputs.name }}
asset_name: ${{ steps.rpm.outputs.name }}
asset_content_type: application/octet-stream

ubuntu:
name: Ubuntu
strategy:
matrix:
version:
- 18.04
- 20.04
source:
- runtime/cpp
- codegen/cpp/fletchgen
runs-on: ubuntu-${{ matrix.version }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Install Apache Arrow
run: |
wget https://apache.bintray.com/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-archive-keyring-latest-$(lsb_release --codename --short).deb
sudo apt-get install -y ./apache-arrow-archive-keyring-latest-$(lsb_release --codename --short).deb
sudo apt-get update
sudo apt-get install -y libarrow-dev=$ARROW_VERSION-1
- name: Configure
run: cmake ${{ matrix.source }} -DCMAKE_BUILD_TYPE=Release
- name: Package
run: make -j package
- id: deb
run: echo "##[set-output name=name;]$(ls fletch*.deb)"
- name: Install
run: |
sudo apt-get --purge autoremove libarrow-dev
sudo apt-get install -y ./${{ steps.deb.outputs.name }} libarrow-dev=${ARROW_VERSION}-1
- name: Upload deb
uses: actions/upload-release-asset@v1
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.deb.outputs.name }}
asset_name: ${{ steps.deb.outputs.name }}
asset_content_type: application/octet-stream

python:
name: Python
runs-on: ubuntu-latest
Expand Down
65 changes: 60 additions & 5 deletions codegen/cpp/fletchgen/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(fletchgen VERSION 0.0.16 LANGUAGES CXX)
project(fletchgen
VERSION 0.0.16
DESCRIPTION "The Fletcher design generator"
HOMEPAGE_URL "https://github.com/abs-tudelft/fletcher"
LANGUAGES CXX
)

find_package(Arrow 1.0 CONFIG REQUIRED)

Expand Down Expand Up @@ -30,19 +35,24 @@ if(NOT cerata_POPULATED)
set(BUILD_CERATA_DOT ON CACHE BOOL "")
set(BUILD_CERATA_VHDL ON CACHE BOOL "")
set(BUILD_CERATA_YAML ON CACHE BOOL "")
add_subdirectory(${cerata_SOURCE_DIR} ${cerata_BINARY_DIR})
add_subdirectory(${cerata_SOURCE_DIR} ${cerata_BINARY_DIR} EXCLUDE_FROM_ALL)
# https://gitlab.kitware.com/cmake/cmake/-/issues/20212
add_custom_target(exclude_cerata_tests ALL COMMAND rm -f "${cerata_BINARY_DIR}/CTestTestfile.cmake")
endif()

include(CompileUnits)

if(NOT TARGET fletcher::common)
add_subdirectory(../../../common/cpp common-cpp)
add_subdirectory(../../../common/cpp common-cpp EXCLUDE_FROM_ALL)
# https://gitlab.kitware.com/cmake/cmake/-/issues/20212
add_custom_target(exclude_fletcher_common_tests ALL COMMAND rm -f "common-cpp/CTestTestfile.cmake")
endif()
if(NOT TARGET fletcher::c)
add_subdirectory(../../../common/c common-c)
add_subdirectory(../../../common/c common-c EXCLUDE_FROM_ALL)
# https://gitlab.kitware.com/cmake/cmake/-/issues/20212
add_custom_target(exclude_fletcher_common_c_tests ALL COMMAND rm -f "common-c/CTestTestfile.cmake")
endif()


FetchContent_Declare(cmakerc
GIT_REPOSITORY https://github.com/vector-of-bool/cmrc.git
GIT_TAG master
Expand Down Expand Up @@ -134,6 +144,7 @@ add_compile_unit(
add_compile_unit(
NAME fletchgen
TYPE EXECUTABLE
COMPONENT binary
PRPS
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
Expand All @@ -147,3 +158,47 @@ compile_units()

configure_file(src/fletchgen/config.h.in fletchgen_config/config.h)
include_directories(${PROJECT_BINARY_DIR})

execute_process (
COMMAND bash -c "awk -F= '/^ID=/{print $2}' /etc/os-release |tr -d '\n' | tr -d '\"'"
OUTPUT_VARIABLE OS_NAME
)

execute_process (
COMMAND bash -c "awk -F= '/^VERSION_ID=/{print $2}' /etc/os-release |tr -d '\n' | tr -d '\"'"
OUTPUT_VARIABLE OS_VERSION
)

if(OS_NAME MATCHES "ubuntu")
set(CPACK_DEBIAN_PACKAGE_RELEASE "ubuntu${OS_VERSION}")
set(CPACK_GENERATOR "DEB")
elseif(OS_NAME MATCHES "centos")
set(CPACK_RPM_PACKAGE_RELEASE_DIST "el${OS_VERSION}")
if(OS_VERSION MATCHES "7")
set(CPACK_GENERATOR "RPM;TGZ")
else()
set(CPACK_GENERATOR "RPM")
endif()
endif()

set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_COMPONENTS_ALL binary)
set(CPACK_PACKAGE_VENDOR "Accelerated Big Data Systems, Delft University of Technology")
set(CPACK_PACKAGE_DESCRIPTION "The Fletcher design generator")
set(CPACK_PACKAGE_VERSION_MAJOR "${fletchgen_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${fletchgen_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${fletchgen_VERSION_PATCH}")
set(CPACK_PACKAGE_RELOCATABLE ON)

set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libarrow100")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR}")

set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
set(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}")
set(CPACK_RPM_PACKAGE_LICENSE "ASL 2.0")
set(CPACK_RPM_PACKAGE_REQUIRES "arrow-libs >= 1.0.1, arrow-libs < 2.0.0")

set(CPACK_ARCHIVE_BINARY_FILE_NAME "${CMAKE_PROJECT_NAME}-${fletchgen_VERSION}-${CMAKE_SYSTEM_NAME}")

include(CPack)
55 changes: 53 additions & 2 deletions runtime/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(fletcher VERSION 0.0.16 LANGUAGES CXX)
project(fletcher
VERSION 0.0.16
DESCRIPTION "The Fletcher runtime library"
HOMEPAGE_URL "https://github.com/abs-tudelft/fletcher"
LANGUAGES CXX
)

find_package(Arrow 1.0 CONFIG REQUIRED)
find_package(Arrow 1.0.1 CONFIG REQUIRED)

include(FetchContent)

Expand Down Expand Up @@ -35,6 +40,7 @@ endif()
add_compile_unit(
NAME fletcher
TYPE SHARED
COMPONENT library
PRPS
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
Expand Down Expand Up @@ -63,3 +69,48 @@ add_compile_unit(
)

compile_units()

execute_process (
COMMAND bash -c "awk -F= '/^ID=/{print $2}' /etc/os-release |tr -d '\n' | tr -d '\"'"
OUTPUT_VARIABLE OS_NAME
)

execute_process (
COMMAND bash -c "awk -F= '/^VERSION_ID=/{print $2}' /etc/os-release |tr -d '\n' | tr -d '\"'"
OUTPUT_VARIABLE OS_VERSION
)

if(OS_NAME MATCHES "ubuntu")
set(CPACK_DEBIAN_PACKAGE_RELEASE "ubuntu${OS_VERSION}")
set(CPACK_GENERATOR "DEB")
elseif(OS_NAME MATCHES "centos")
set(CPACK_RPM_PACKAGE_RELEASE_DIST "el${OS_VERSION}")
if(OS_VERSION MATCHES "7")
set(CPACK_GENERATOR "RPM;TGZ")
else()
set(CPACK_GENERATOR "RPM")
endif()
endif()

set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_COMPONENTS_ALL library)
set(CPACK_PACKAGE_VENDOR "Accelerated Big Data Systems, Delft University of Technology")
set(CPACK_PACKAGE_DESCRIPTION "The Fletcher C++ runtime library for Fletcher-based applications")
set(CPACK_PACKAGE_VERSION_MAJOR "${fletcher_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${fletcher_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${fletcher_VERSION_PATCH}")
set(CPACK_PACKAGE_RELOCATABLE ON)

set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libarrow-dev (>= 1.0.1), libarrow-dev (<< 2.0.0)")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR}")

set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
set(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}")
set(CPACK_RPM_PACKAGE_LICENSE "ASL 2.0")
# fletcher-devel
set(CPACK_RPM_PACKAGE_REQUIRES "arrow-devel >= 1.0.1, arrow-devel < 2.0.0")

set(CPACK_ARCHIVE_LIBRARY_FILE_NAME "${CMAKE_PROJECT_NAME}-${fletcher_VERSION}-${CMAKE_SYSTEM_NAME}")

include(CPack)

0 comments on commit 47a7d2e

Please sign in to comment.