-
Notifications
You must be signed in to change notification settings - Fork 1
134 lines (116 loc) · 6.04 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
name: Build DigiLivolo software
on:
push:
branches: [ main, dev ]
tags:
- "v*.*.*"
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, 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 sudo git dialog python3 python3-pip python3-setuptools curl wget || yum install -y sudo git dialog python3 python3-pip python3-setuptools ninja-build make cmake3 libusb-devel libudev-devel curl wget
git --version
git config --global --add safe.directory /__w/DigiLivolo/DigiLivolo
echo
cat /etc/os-release
- 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: libudev-dev sudo gcc cmake build-essential make sudo libusb-dev libc6-dev pkg-config file ninja-build clang
- 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: >-
toolchain:p
cmake:p
ninja:p
- name: Install cross compiling toolchain and deps
if: ${{ matrix.sys.crosscompile != '' }}
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 }}