-
Notifications
You must be signed in to change notification settings - Fork 1
135 lines (116 loc) · 6.6 KB
/
build-software.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Build DigiLivolo software
on:
push:
branches: [ main, dev ]
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
pull_request:
branches: [ main, dev ]
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.sys.os }}
container: ${{ matrix.sys.container }}
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false
matrix:
sys:
- { os: ubuntu-latest, container: 'ghcr.io/phusion/holy-build-box/hbb-64', shell: bash , c_compiler: gcc , binary_orig: digilivolo }
- { os: ubuntu-latest, container: 'debian:10' , shell: bash , c_compiler: gcc , binary_orig: digilivolo }
- { os: ubuntu-20.04 , shell: bash , c_compiler: gcc , binary_orig: digilivolo , binary_release: digilivolo-linux-x86_64 }
- { os: ubuntu-latest , shell: 'alpine.sh {0}', crosscompile: i386 , binary_orig: digilivolo , binary_release: digilivolo-linux-static-i386 }
- { os: ubuntu-latest, container: 'debian' , shell: bash , crosscompile: armhf, binary_orig: digilivolo , binary_release: digilivolo-linux-armhf }
- { os: ubuntu-latest, container: 'debian' , shell: bash , crosscompile: arm64, binary_orig: digilivolo , binary_release: digilivolo-linux-arm64 }
- { os: ubuntu-20.04 , shell: bash , c_compiler: clang , binary_orig: digilivolo }
- { os: windows-latest , shell: 'msys2 {0}' , c_compiler: gcc , binary_orig: digilivolo.exe, binary_release: digilivolo-win-x86_64.exe }
- { os: windows-latest , shell: pwsh , c_compiler: gcc , binary_orig: digilivolo.exe }
- { os: windows-latest , shell: pwsh , c_compiler: clang , binary_orig: digilivolo.exe }
build_type: [Release]
defaults:
run:
shell: ${{ matrix.sys.shell }}
steps:
- name: Install required prerequisite packages on the container and configure git
if: matrix.sys.container != ''
run: |
apt update || yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
apt -y full-upgrade || yum update -y
apt install -y curl dialog git python3 python3-pip python3-setuptools sudo wget || yum install -y cmake3 curl dialog git libudev-devel libusb-devel make ninja-build python3 python3-pip python3-setuptools sudo wget
git --version
git config --global --add safe.directory /__w/DigiLivolo/DigiLivolo
echo
cat /etc/os-release
- name: Install & configure Alpine Linux build environment for i386 build
uses: jirutka/setup-alpine@v1
if: matrix.sys.crosscompile == 'i386'
with:
arch: x86
packages: build-base cmake curl dialog eudev eudev-dev eudev-libs git libusb-dev linux-headers make ninja-build pkgconf pkgconf-dev py3-pip py3-setuptools python3 samurai sudo wget
- name: Install packages required for the workflow and build deps
uses: ConorMacBride/install-package@v1
if: matrix.sys.container != 'ghcr.io/phusion/holy-build-box/hbb-64'
with:
apt: build-essential clang cmake file gcc libc6-dev libudev-dev make ninja-build pkg-config sudo
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: '[HBB] Create symlink cmake -> cmake3'
if: matrix.sys.container == 'ghcr.io/phusion/holy-build-box/hbb-64'
run: ln -s /usr/bin/cmake3 /usr/bin/cmake
- name: Install Ninja
if: matrix.sys.shell == 'pwsh'
uses: turtlesec-no/get-ninja@main
- name: Setup MSYS2 UCRT64
if: matrix.sys.shell == 'msys2 {0}'
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: git make mingw-w64-ucrt-x86_64-gcc
pacboy: cmake:p ninja:p toolchain:p
- name: Install cross compiling toolchain and deps
if: matrix.sys.crosscompile != '' && matrix.sys.crosscompile != 'i386'
shell: bash
run: |
echo "Installing cross toolchain for ${{ matrix.sys.crosscompile }}"
sudo dpkg --add-architecture ${{ matrix.sys.crosscompile }}
sudo apt update
sudo apt install -y crossbuild-essential-${{ matrix.sys.crosscompile }}
sudo apt install -y libudev-dev:${{ matrix.sys.crosscompile }} libusb-dev:${{ matrix.sys.crosscompile }} libc6-dev:${{ matrix.sys.crosscompile }} pkg-config:${{ matrix.sys.crosscompile }}
- name: Configure CMake project
run: >
cmake -B software/build ${{ env.CMAKE_TOOLCHAIN_FILE_OPT }} ${{ env.CMAKE_C_COMPILER_OPT }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DUSE_SYSTEM_HIDAPI=false
-G Ninja
-S software
env:
CMAKE_TOOLCHAIN_FILE_OPT: ${{ matrix.sys.crosscompile == '' && ' ' || format('-DCMAKE_TOOLCHAIN_FILE=cmake/{0}-linux-toolchain.cmake', matrix.sys.crosscompile) }}
CMAKE_C_COMPILER_OPT: ${{ matrix.sys.c_compiler == '' && ' ' || format('-DCMAKE_C_COMPILER={0}', matrix.sys.c_compiler) }}
- name: Build software
run: cmake --build software/build
- name: Print some info on compiled binary
shell: bash
run: |
echo "=== objdump -x ==="
objdump -x software/build/${{ matrix.sys.binary_orig }} || /bin/true
echo "=== size -A ==="
size -A software/build/${{ matrix.sys.binary_orig }} || /bin/true
echo "=== ldd -v ==="
ldd -v software/build/${{ matrix.sys.binary_orig }} || /bin/true
echo "=== file & ls ==="
file software/build/${{ matrix.sys.binary_orig }} || /bin/true
ls -l software/build/${{ matrix.sys.binary_orig }} || /bin/true
- name: Rename binary to release target
if: ${{ matrix.sys.binary_release != '' }}
shell: bash
run: mv software/build/${{ matrix.sys.binary_orig }} software/build/${{ matrix.sys.binary_release }}
- name: Make and upload release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && matrix.sys.binary_release != ''
with:
fail_on_unmatched_files: false
generate_release_notes: true
files: software/build/${{ matrix.sys.binary_release }}