Skip to content

Commit 89ce5aa

Browse files
committed
Build Linux releases via Github Actions
1 parent f3e4c1a commit 89ce5aa

File tree

3 files changed

+102
-11
lines changed

3 files changed

+102
-11
lines changed

.github/workflows/build-linux.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build Linux packages
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- '*'
8+
pull_request:
9+
branches: [ "main" ]
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
include:
17+
- platform: "linux/amd64"
18+
name: "amd64"
19+
- platform: "linux/arm64"
20+
name: "aarch64"
21+
- platform: "linux/arm/v7"
22+
name: "armhf"
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
27+
- name: Setup QEMU
28+
uses: docker/setup-qemu-action@v3
29+
30+
- name: Setup Docker buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
- name: Compile
34+
run: |
35+
docker buildx build \
36+
-f Dockerfile \
37+
--platform ${{ matrix.platform }} \
38+
-o ${{ github.workspace }}/build \
39+
.
40+
# - name: Upload artifact
41+
# uses: actions/upload-artifact@v3
42+
# with:
43+
# name: gcfflasher-${{ matrix.name }}
44+
# path: build/src/*.deb
45+
46+
- name: Upload binaries to release
47+
if: startsWith(github.ref, 'refs/tags/v')
48+
uses: svenstaro/upload-release-action@v2
49+
with:
50+
repo_token: ${{ secrets.GITHUB_TOKEN }}
51+
release_name: ${{ github.ref_name }}
52+
file: build/src/*_linux_*
53+
tag: ${{ github.ref }}
54+
overwrite: true
55+
file_glob: true

CMakeLists.txt

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
cmake_minimum_required (VERSION 3.5)
22
project (GCFFlasher VERSION 4.3.0)
33

4-
add_executable(${PROJECT_NAME})
5-
target_compile_definitions(${PROJECT_NAME}
6-
PUBLIC
7-
APP_VERSION="\"\"${PROJECT_VERSION}-beta\"\"")
8-
9-
option(USE_FTD2XX "Use FTDI ftd2xx library on Windows" ON)
10-
114
set(COMMON_SRCS
125
gcf.c
136
buffer_helper.c
@@ -18,8 +11,15 @@ set(COMMON_SRCS
1811
u_mem.c
1912
)
2013

14+
add_executable(${PROJECT_NAME} ${COMMON_SRCS})
15+
target_compile_definitions(${PROJECT_NAME}
16+
PUBLIC
17+
APP_VERSION="\"\"${PROJECT_VERSION}-beta\"\"")
18+
19+
option(USE_FTD2XX "Use FTDI ftd2xx library on Windows" ON)
20+
2121
if (UNIX)
22-
target_sources(${PROJECT_NAME} PRIVATE ${COMMON_SRCS} main_posix.c)
22+
target_sources(${PROJECT_NAME} PRIVATE main_posix.c)
2323

2424
#----------------------------------------------------------------------
2525
if (${CMAKE_HOST_SYSTEM_NAME} MATCHES "Linux")
@@ -49,7 +49,7 @@ endif()
4949

5050
#----------------------------------------------------------------------
5151
if (WIN32)
52-
target_sources(${PROJECT_NAME} PRIVATE ${COMMON_SRCS} main_windows.c)
52+
target_sources(${PROJECT_NAME} PRIVATE main_windows.c)
5353

5454
if (MSVC)
5555
target_link_options(${PROJECT_NAME} PUBLIC "/NODEFAULTLIB:libcmt")
@@ -93,12 +93,23 @@ install(TARGETS ${PROJECT_NAME}
9393
# Debian .deb specifics
9494
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Manuel Pietschmann <[email protected]>")
9595
set(CPACK_DEBIAN_PACKAGE_SECTION "non-free / misc")
96-
set(CPACK_DEBIAN_PACKAGE_)
96+
97+
# keep arch names as used in the past
98+
set(PKG_ARCH ${CMAKE_SYSTEM_PROCESSOR})
99+
if (${PKG_ARCH} MATCHES "aarch64")
100+
set(PKG_ARCH "arm64")
101+
endif()
102+
if (${PKG_ARCH} MATCHES "armv7l")
103+
set(PKG_ARCH "armhf")
104+
endif()
105+
if (${PKG_ARCH} MATCHES "x86_64")
106+
set(PKG_ARCH "amd64")
107+
endif()
97108

98109
string(TOLOWER "${CMAKE_SYSTEM_NAME}" LOWERCASE_SYSTEM_NAME)
99110
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
100111
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/dresden-elektronik/gcfflasher")
101112
set(CPACK_PACKAGE_DESCRIPTION "Tool to flash firmware of RaspBee and ConBee.")
102-
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}_${PROJECT_VERSION}_${LOWERCASE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}")
113+
set(CPACK_PACKAGE_FILE_NAME "gcfflasher_${PROJECT_VERSION}_${LOWERCASE_SYSTEM_NAME}_${PKG_ARCH}")
103114

104115
include(CPack)

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM ubuntu:18.04 as builder
2+
3+
RUN apt-get update && \
4+
apt-get install --no-install-recommends -y \
5+
lsb-release \
6+
ca-certificates \
7+
build-essential \
8+
pkg-config \
9+
libgpiod-dev \
10+
dpkg-dev \
11+
fakeroot \
12+
cmake
13+
14+
WORKDIR /src
15+
16+
COPY . /src/gcfflasher/
17+
18+
RUN mkdir /src/build && cd /src/build \
19+
&& cmake -DCMAKE_BUILD_TYPE=Release ../gcfflasher \
20+
&& cmake --build . \
21+
&& cpack -G "DEB;TGZ" .
22+
23+
FROM scratch
24+
WORKDIR /src
25+
COPY --from=builder /src/build ./

0 commit comments

Comments
 (0)