-
Notifications
You must be signed in to change notification settings - Fork 8
88 lines (73 loc) · 3.07 KB
/
build.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
name: Build
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
# https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-generic-arm64.tar.xz
# https://github.com/OpenIPC/sbc-groundstations/releases/download/zero3w-v1.7.0/radxaZero3wrev2.img.xz
host=https://cloud.debian.org/images/cloud/bullseye
release=latest
system=debian-11-generic-arm64.tar
wget -nv ${host}/${release}/${system}.xz
# unxz -T4 ${system}.xz
tar -xf ${system}.xz
output=output
mkdir $output
# device=$(sudo losetup -P --show -f ${system})
# sudo mount ${device}p3 $output
device=$(sudo losetup -P --show -f disk.raw)
sudo mount ${device}p1 $output
cat > build.sh << EOL
#!/bin/bash
cd /home
# install radxa APT repo, see https://radxa-repo.github.io/bullseye/
keyring="/home/keyring.deb"
version="\$(curl -L https://github.com/radxa-pkg/radxa-archive-keyring/releases/latest/download/VERSION)"
curl -L --output "\$keyring" "https://github.com/radxa-pkg/radxa-archive-keyring/releases/download/\${version}/radxa-archive-keyring_\${version}_all.deb"
dpkg -i \$keyring
tee /etc/apt/sources.list.d/70-radxa.list <<< "deb [signed-by=/usr/share/keyrings/radxa-archive-keyring.gpg] https://radxa-repo.github.io/bullseye/ bullseye main"
tee /etc/apt/sources.list.d/80-rockchip.list <<< "deb [signed-by=/usr/share/keyrings/radxa-archive-keyring.gpg] https://radxa-repo.github.io/bullseye rockchip-bullseye main"
apt-get update
apt-get install -y cmake g++ git pkg-config librockchip-mpp-dev libcairo-dev libdrm-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libspdlog-dev
apt clean
cmake -B build
cmake --build build -j4 --target install
EOL
cat > run.sh <<EOL
#!/bin/bash
LD_LIBRARY_PATH=/usr/local/lib/ /usr/local/bin/pixelpilot \$@
EOL
chmod 755 build.sh run.sh
sudo cp -r build.sh run.sh CMakeLists.txt pixelpilot_config.h.in src $output/home
sudo rm $output/etc/resolv.conf
echo nameserver 1.1.1.1 | sudo tee -a $output/etc/resolv.conf
sudo chroot $output /home/build.sh
sudo chroot $output /home/run.sh --version
sudo cp $output/home/build/pixelpilot .
- name: Versioned release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: pixelpilot
- name: Upload latest
if: github.event_name != 'pull_request'
uses: softprops/action-gh-release@v2
with:
tag_name: latest
files: pixelpilot