-
Notifications
You must be signed in to change notification settings - Fork 58
101 lines (95 loc) · 3.96 KB
/
build_linux_rpi.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
name: Builds for RPi on RaspiOS
on:
workflow_call:
inputs:
target:
description: 'RPi base_image target'
# see https://github.com/pguyot/arm-runner-action
required: true
default: 'raspios_lite:latest'
type: string
# type: choice
# options:
# - raspios_lite:latest
# - raspios_lite_arm64:latest
# - raspi_1_bullseye:20220121
artifact_archive:
required: true
type: string
workflow_dispatch:
inputs:
target:
description: 'RPi base_image target'
# see https://github.com/pguyot/arm-runner-action
required: true
default: 'raspios_lite:latest'
type: choice
options:
- raspios_lite:latest
- raspios_lite_arm64:latest
- raspi_1_bullseye:20220121
artifact_archive:
required: true
type: string
default: artifacts-build_raspios
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Hack around https://github.com/actions/checkout/issues/290
run: |
git fetch --tags --force
- name: Build on RaspiOs
uses: pguyot/arm-runner-action@e04ca3becb581a2b52cabe31e53835ada344522f
with:
image_additional_mb: 1024
base_image: ${{ inputs.target }}
copy_artifact_path: build
import_github_env: true
commands: |
apt-get update -y --allow-releaseinfo-change
apt-get install -y build-essential git cmake libxml2-dev python3-docutils zip checkinstall
mkdir build
cmake -S . -B ./build -DCMAKE_C_FLAGS="-Wall" -DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build ./build
ARCH="$(dpkg --print-architecture)"
echo "ARCH=${ARCH}" > ./build/env
BUILD_DIR="./build"
echo "BUILD_DIR=${BUILD_DIR}" >> ./build/env
VERSION=$(sed -n -e '/^#define VERSION /{s/#define VERSION "\(.*\)"/\1/;s/unknown/'"$(date +0.0.%Y%m%d)"'/g;p}' ${BUILD_DIR}/version.h)
echo "VERSION=${VERSION}" >> ./build/env
GH_REPO=$(echo -n "${GITHUB_REPOSITORY}" | cut -d "/" -f 2)
echo "GH_REPO=${GH_REPO}" >> ./build/env
GH_USER=$(echo -n "${GITHUB_REPOSITORY}" | cut -d "/" -f 1)
echo "GH_USER=${GH_USER}" >> ./build/env
DEPLOYFILEPREFIX="${GH_REPO}_${VERSION}"
echo DEPLOYFILEPREFIX="${DEPLOYFILEPREFIX}" >> ./build/env
DEPLOYFILEPREFIX_BIN="${DEPLOYFILEPREFIX}-${GITHUB_RUN_NUMBER}_${ARCH}"
echo DEPLOYFILEPREFIX_BIN="${DEPLOYFILEPREFIX_BIN}" >> ./build/env
sudo checkinstall --strip=no --install=no --pkgname="${GH_REPO}" --pkgversion="${VERSION}" --pkgrelease=${GITHUB_RUN_NUMBER} --arch="${ARCH}" --maintainer="${GH_USER}@GitHub" --pkgsource="https://github.com/${GH_USER}/${GH_REPO}/releases/download/v${VERSION}/${DEPLOYFILEPREFIX}.orig.tar.gz" --pkgaltsource="https://github.com/${GH_USER}/${GH_REPO}/" --pkglicense="GPLv3" --pakdir=./build/ -D -y cmake --build ./build/ --target install
- name: Set env vars
run: |
source ./build/env
cat ./build/env >> ${GITHUB_ENV}
cat ${GITHUB_ENV}
- name: Collect files
run: |
sudo chown -R $USER:$USER ./build/
for FILE in ./build/doc/man/*.1 ; do gzip ${FILE} ; done
zip -j ./build/${DEPLOYFILEPREFIX_BIN}.zip ./build/vcontrold ./build/vclient ./build/doc/man/vcontrold.1.gz ./build/doc/man/vclient.1.gz COPYING README.md
dpkg --info "./build/${DEPLOYFILEPREFIX_BIN}.deb"
dpkg --contents "./build/${DEPLOYFILEPREFIX_BIN}.deb"
mkdir artifact-upload
mv ./build/*.zip ./build/*.deb ./artifact-upload/
ls -laF ./artifact-upload/
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifact_archive }}
path: |
artifact-upload/*
if-no-files-found: error