Skip to content

Commit 47a7d2e

Browse files
authored
Merge pull request #265 from mbrobbel/packages
Add binary packages for Fletcher runtime and Fletchgen
2 parents 47dea21 + cd5ea12 commit 47a7d2e

File tree

3 files changed

+261
-8
lines changed

3 files changed

+261
-8
lines changed

.github/workflows/assets.yml

Lines changed: 148 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,157 @@ on:
77
pull_request:
88

99
env:
10-
CMAKE_VERSION: '3.17.3'
10+
CMAKE_VERSION: '3.19.2'
1111
ARROW_VERSION: '1.0.1'
1212

1313
jobs:
14+
archive:
15+
name: Linux
16+
runs-on: ubuntu-latest
17+
container: centos:7
18+
strategy:
19+
matrix:
20+
source:
21+
- runtime/cpp
22+
- codegen/cpp/fletchgen
23+
steps:
24+
- name: Install dependencies
25+
run: |
26+
yum install -y epel-release centos-release-scl https://repo.ius.io/ius-release-el7.rpm
27+
yum install -y curl make devtoolset-7-gcc-c++ rpm-build git224
28+
echo "/opt/rh/devtoolset-7/root/bin/" >> $GITHUB_PATH
29+
- name: Install CMake
30+
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
31+
- name: Install Apache Arrow
32+
run: |
33+
yum install -y https://apache.bintray.com/arrow/centos/$(cut -d: -f5 /etc/system-release-cpe)/apache-arrow-release-latest.rpm
34+
yum install -y arrow-devel-$ARROW_VERSION-1.el7
35+
- uses: actions/checkout@v2
36+
with:
37+
submodules: true
38+
- name: Configure
39+
run: cmake ${{ matrix.source }} -DCMAKE_BUILD_TYPE=Release
40+
- name: Package
41+
run: make -j package
42+
- id: tarball
43+
run: echo "##[set-output name=name;]$(ls fletch*.tar.gz)"
44+
- name: Install
45+
run: tar xvfz ./${{ steps.tarball.outputs.name }} -C /usr
46+
- name: Upload tarball
47+
uses: actions/upload-release-asset@v1
48+
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
with:
52+
upload_url: ${{ github.event.release.upload_url }}
53+
asset_path: ${{ steps.tarball.outputs.name }}
54+
asset_name: ${{ steps.tarball.outputs.name }}
55+
asset_content_type: application/octet-stream
56+
57+
centos:
58+
name: CentOS
59+
runs-on: ubuntu-latest
60+
strategy:
61+
matrix:
62+
version:
63+
- 7
64+
- 8
65+
source:
66+
- runtime/cpp
67+
- codegen/cpp/fletchgen
68+
container: centos:${{ matrix.version }}
69+
steps:
70+
- name: Install dependencies
71+
run: |
72+
yum install -y epel-release
73+
yum install -y curl make rpm-build
74+
- name: Install CMake
75+
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
76+
- name: Install Apache Arrow
77+
if: ${{ matrix.version == '7' }}
78+
run: |
79+
yum install -y https://repo.ius.io/ius-release-el7.rpm centos-release-scl
80+
yum install -y git224 devtoolset-7-gcc-c++
81+
echo "/opt/rh/devtoolset-7/root/bin/" >> $GITHUB_PATH
82+
yum install -y https://apache.bintray.com/arrow/centos/$(cut -d: -f5 /etc/system-release-cpe)/apache-arrow-release-latest.rpm
83+
yum install -y arrow-devel-$ARROW_VERSION-1.el${{ matrix.version }}
84+
- name: Install Apache Arrow
85+
if: ${{ matrix.version == '8' }}
86+
run: |
87+
dnf install -y git gcc-c++
88+
dnf install -y https://apache.bintray.com/arrow/centos/$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1)/apache-arrow-release-latest.rpm
89+
dnf config-manager --set-enabled epel || :
90+
dnf config-manager --set-enabled powertools || :
91+
dnf config-manager --set-enabled codeready-builder-for-rhel-$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1)-rhui-rpms || :
92+
subscription-manager repos --enable codeready-builder-for-rhel-$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1)-$(arch)-rpms || :
93+
dnf install -y arrow-devel-$ARROW_VERSION-1.el${{ matrix.version }}
94+
- uses: actions/checkout@v2
95+
with:
96+
submodules: true
97+
- name: Configure
98+
run: cmake ${{ matrix.source }} -DCMAKE_BUILD_TYPE=Release
99+
- name: Package
100+
run: make -j package
101+
- id: rpm
102+
run: echo "##[set-output name=name;]$(ls fletch*.rpm)"
103+
- name: Install
104+
run: |
105+
yum remove -y arrow-devel
106+
yum autoremove -y
107+
yum localinstall -y ./${{ steps.rpm.outputs.name }}
108+
- name: Upload rpm
109+
uses: actions/upload-release-asset@v1
110+
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
111+
env:
112+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
with:
114+
upload_url: ${{ github.event.release.upload_url }}
115+
asset_path: ${{ steps.rpm.outputs.name }}
116+
asset_name: ${{ steps.rpm.outputs.name }}
117+
asset_content_type: application/octet-stream
118+
119+
ubuntu:
120+
name: Ubuntu
121+
strategy:
122+
matrix:
123+
version:
124+
- 18.04
125+
- 20.04
126+
source:
127+
- runtime/cpp
128+
- codegen/cpp/fletchgen
129+
runs-on: ubuntu-${{ matrix.version }}
130+
steps:
131+
- uses: actions/checkout@v2
132+
with:
133+
submodules: true
134+
- name: Install Apache Arrow
135+
run: |
136+
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
137+
sudo apt-get install -y ./apache-arrow-archive-keyring-latest-$(lsb_release --codename --short).deb
138+
sudo apt-get update
139+
sudo apt-get install -y libarrow-dev=$ARROW_VERSION-1
140+
- name: Configure
141+
run: cmake ${{ matrix.source }} -DCMAKE_BUILD_TYPE=Release
142+
- name: Package
143+
run: make -j package
144+
- id: deb
145+
run: echo "##[set-output name=name;]$(ls fletch*.deb)"
146+
- name: Install
147+
run: |
148+
sudo apt-get --purge autoremove libarrow-dev
149+
sudo apt-get install -y ./${{ steps.deb.outputs.name }} libarrow-dev=${ARROW_VERSION}-1
150+
- name: Upload deb
151+
uses: actions/upload-release-asset@v1
152+
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
153+
env:
154+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
155+
with:
156+
upload_url: ${{ github.event.release.upload_url }}
157+
asset_path: ${{ steps.deb.outputs.name }}
158+
asset_name: ${{ steps.deb.outputs.name }}
159+
asset_content_type: application/octet-stream
160+
14161
python:
15162
name: Python
16163
runs-on: ubuntu-latest

codegen/cpp/fletchgen/CMakeLists.txt

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
22

3-
project(fletchgen VERSION 0.0.16 LANGUAGES CXX)
3+
project(fletchgen
4+
VERSION 0.0.16
5+
DESCRIPTION "The Fletcher design generator"
6+
HOMEPAGE_URL "https://github.com/abs-tudelft/fletcher"
7+
LANGUAGES CXX
8+
)
49

510
find_package(Arrow 1.0 CONFIG REQUIRED)
611

@@ -30,19 +35,24 @@ if(NOT cerata_POPULATED)
3035
set(BUILD_CERATA_DOT ON CACHE BOOL "")
3136
set(BUILD_CERATA_VHDL ON CACHE BOOL "")
3237
set(BUILD_CERATA_YAML ON CACHE BOOL "")
33-
add_subdirectory(${cerata_SOURCE_DIR} ${cerata_BINARY_DIR})
38+
add_subdirectory(${cerata_SOURCE_DIR} ${cerata_BINARY_DIR} EXCLUDE_FROM_ALL)
39+
# https://gitlab.kitware.com/cmake/cmake/-/issues/20212
40+
add_custom_target(exclude_cerata_tests ALL COMMAND rm -f "${cerata_BINARY_DIR}/CTestTestfile.cmake")
3441
endif()
3542

3643
include(CompileUnits)
3744

3845
if(NOT TARGET fletcher::common)
39-
add_subdirectory(../../../common/cpp common-cpp)
46+
add_subdirectory(../../../common/cpp common-cpp EXCLUDE_FROM_ALL)
47+
# https://gitlab.kitware.com/cmake/cmake/-/issues/20212
48+
add_custom_target(exclude_fletcher_common_tests ALL COMMAND rm -f "common-cpp/CTestTestfile.cmake")
4049
endif()
4150
if(NOT TARGET fletcher::c)
42-
add_subdirectory(../../../common/c common-c)
51+
add_subdirectory(../../../common/c common-c EXCLUDE_FROM_ALL)
52+
# https://gitlab.kitware.com/cmake/cmake/-/issues/20212
53+
add_custom_target(exclude_fletcher_common_c_tests ALL COMMAND rm -f "common-c/CTestTestfile.cmake")
4354
endif()
4455

45-
4656
FetchContent_Declare(cmakerc
4757
GIT_REPOSITORY https://github.com/vector-of-bool/cmrc.git
4858
GIT_TAG master
@@ -134,6 +144,7 @@ add_compile_unit(
134144
add_compile_unit(
135145
NAME fletchgen
136146
TYPE EXECUTABLE
147+
COMPONENT binary
137148
PRPS
138149
CXX_STANDARD 17
139150
CXX_STANDARD_REQUIRED ON
@@ -147,3 +158,47 @@ compile_units()
147158

148159
configure_file(src/fletchgen/config.h.in fletchgen_config/config.h)
149160
include_directories(${PROJECT_BINARY_DIR})
161+
162+
execute_process (
163+
COMMAND bash -c "awk -F= '/^ID=/{print $2}' /etc/os-release |tr -d '\n' | tr -d '\"'"
164+
OUTPUT_VARIABLE OS_NAME
165+
)
166+
167+
execute_process (
168+
COMMAND bash -c "awk -F= '/^VERSION_ID=/{print $2}' /etc/os-release |tr -d '\n' | tr -d '\"'"
169+
OUTPUT_VARIABLE OS_VERSION
170+
)
171+
172+
if(OS_NAME MATCHES "ubuntu")
173+
set(CPACK_DEBIAN_PACKAGE_RELEASE "ubuntu${OS_VERSION}")
174+
set(CPACK_GENERATOR "DEB")
175+
elseif(OS_NAME MATCHES "centos")
176+
set(CPACK_RPM_PACKAGE_RELEASE_DIST "el${OS_VERSION}")
177+
if(OS_VERSION MATCHES "7")
178+
set(CPACK_GENERATOR "RPM;TGZ")
179+
else()
180+
set(CPACK_GENERATOR "RPM")
181+
endif()
182+
endif()
183+
184+
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
185+
set(CPACK_COMPONENTS_ALL binary)
186+
set(CPACK_PACKAGE_VENDOR "Accelerated Big Data Systems, Delft University of Technology")
187+
set(CPACK_PACKAGE_DESCRIPTION "The Fletcher design generator")
188+
set(CPACK_PACKAGE_VERSION_MAJOR "${fletchgen_VERSION_MAJOR}")
189+
set(CPACK_PACKAGE_VERSION_MINOR "${fletchgen_VERSION_MINOR}")
190+
set(CPACK_PACKAGE_VERSION_PATCH "${fletchgen_VERSION_PATCH}")
191+
set(CPACK_PACKAGE_RELOCATABLE ON)
192+
193+
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
194+
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libarrow100")
195+
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR}")
196+
197+
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
198+
set(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}")
199+
set(CPACK_RPM_PACKAGE_LICENSE "ASL 2.0")
200+
set(CPACK_RPM_PACKAGE_REQUIRES "arrow-libs >= 1.0.1, arrow-libs < 2.0.0")
201+
202+
set(CPACK_ARCHIVE_BINARY_FILE_NAME "${CMAKE_PROJECT_NAME}-${fletchgen_VERSION}-${CMAKE_SYSTEM_NAME}")
203+
204+
include(CPack)

runtime/cpp/CMakeLists.txt

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
22

3-
project(fletcher VERSION 0.0.16 LANGUAGES CXX)
3+
project(fletcher
4+
VERSION 0.0.16
5+
DESCRIPTION "The Fletcher runtime library"
6+
HOMEPAGE_URL "https://github.com/abs-tudelft/fletcher"
7+
LANGUAGES CXX
8+
)
49

5-
find_package(Arrow 1.0 CONFIG REQUIRED)
10+
find_package(Arrow 1.0.1 CONFIG REQUIRED)
611

712
include(FetchContent)
813

@@ -35,6 +40,7 @@ endif()
3540
add_compile_unit(
3641
NAME fletcher
3742
TYPE SHARED
43+
COMPONENT library
3844
PRPS
3945
CXX_STANDARD 11
4046
CXX_STANDARD_REQUIRED ON
@@ -63,3 +69,48 @@ add_compile_unit(
6369
)
6470

6571
compile_units()
72+
73+
execute_process (
74+
COMMAND bash -c "awk -F= '/^ID=/{print $2}' /etc/os-release |tr -d '\n' | tr -d '\"'"
75+
OUTPUT_VARIABLE OS_NAME
76+
)
77+
78+
execute_process (
79+
COMMAND bash -c "awk -F= '/^VERSION_ID=/{print $2}' /etc/os-release |tr -d '\n' | tr -d '\"'"
80+
OUTPUT_VARIABLE OS_VERSION
81+
)
82+
83+
if(OS_NAME MATCHES "ubuntu")
84+
set(CPACK_DEBIAN_PACKAGE_RELEASE "ubuntu${OS_VERSION}")
85+
set(CPACK_GENERATOR "DEB")
86+
elseif(OS_NAME MATCHES "centos")
87+
set(CPACK_RPM_PACKAGE_RELEASE_DIST "el${OS_VERSION}")
88+
if(OS_VERSION MATCHES "7")
89+
set(CPACK_GENERATOR "RPM;TGZ")
90+
else()
91+
set(CPACK_GENERATOR "RPM")
92+
endif()
93+
endif()
94+
95+
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
96+
set(CPACK_COMPONENTS_ALL library)
97+
set(CPACK_PACKAGE_VENDOR "Accelerated Big Data Systems, Delft University of Technology")
98+
set(CPACK_PACKAGE_DESCRIPTION "The Fletcher C++ runtime library for Fletcher-based applications")
99+
set(CPACK_PACKAGE_VERSION_MAJOR "${fletcher_VERSION_MAJOR}")
100+
set(CPACK_PACKAGE_VERSION_MINOR "${fletcher_VERSION_MINOR}")
101+
set(CPACK_PACKAGE_VERSION_PATCH "${fletcher_VERSION_PATCH}")
102+
set(CPACK_PACKAGE_RELOCATABLE ON)
103+
104+
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
105+
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libarrow-dev (>= 1.0.1), libarrow-dev (<< 2.0.0)")
106+
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR}")
107+
108+
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
109+
set(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}")
110+
set(CPACK_RPM_PACKAGE_LICENSE "ASL 2.0")
111+
# fletcher-devel
112+
set(CPACK_RPM_PACKAGE_REQUIRES "arrow-devel >= 1.0.1, arrow-devel < 2.0.0")
113+
114+
set(CPACK_ARCHIVE_LIBRARY_FILE_NAME "${CMAKE_PROJECT_NAME}-${fletcher_VERSION}-${CMAKE_SYSTEM_NAME}")
115+
116+
include(CPack)

0 commit comments

Comments
 (0)