Skip to content

Commit

Permalink
Fix CI cross build
Browse files Browse the repository at this point in the history
  • Loading branch information
svpcom committed Dec 24, 2024
1 parent 5e737a9 commit aa6a938
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/build_debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
version: [11, 12]
arch: [ "arm32v7", "arm64v8", "amd64"]
arch: [ "armhf.arm32v7", "arm64.arm64v8", "amd64.amd64" ]

steps:
- name: Checkout repository
Expand All @@ -23,13 +23,15 @@ jobs:
run: |
curl -s -L https://github.com/svpcom/wfb-ng/releases/download/wifibroadcast-17.10/qemu-7.2.13-fixed.tar.gz | sudo tar xzv -C /
git submodule update --init
make osd_docker DOCKER_SRC_IMAGE=${{ matrix.arch }}/debian:${{ matrix.version }}
make osd_docker mode=gst DOCKER_ARCH=$(echo ${{ matrix.arch}} | cut -f1 -d.) DOCKER_SRC_IMAGE=$(echo ${{ matrix.arch }} | cut -f2 -d.)/debian:${{ matrix.version }}
make osd_docker mode=rockchip DOCKER_ARCH=$(echo ${{ matrix.arch}} | cut -f1 -d.) DOCKER_SRC_IMAGE=$(echo ${{ matrix.arch }} | cut -f2 -d.)/debian:${{ matrix.version }}
- name: Archive production artifacts
uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: wfb-ng-osd-${{ github.ref_name }}-debian${{ matrix.version }}-${{ matrix.arch }}
path: |
osd
osd.gst
osd.rockchip
- name: Output artifact URL
run: echo 'wfb-ng-osd-${{ github.ref_name }}-debian${{ matrix.version }}-${{ matrix.arch }} ${{ steps.artifact-upload-step.outputs.artifact-url }}'
4 changes: 2 additions & 2 deletions .github/workflows/build_pi.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: WFB-ng-osd package builder for RPI and NanoPI
name: WFB-ng-osd package builder for RPI

on:
push:
Expand Down Expand Up @@ -31,6 +31,6 @@ jobs:
with:
name: wfb-ng-osd-${{ github.ref_name }}-${{ matrix.docker-images }}
path: |
osd
osd.gst
- name: Output artifact URL
run: echo 'wfb-ng-osd-${{ github.ref_name }}-${{ matrix.docker-images }} ${{ steps.artifact-upload-step.outputs.artifact-url }}'
8 changes: 5 additions & 3 deletions .github/workflows/build_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
version: [ "20.04", "22.04", "24.04" ]
arch: [ "arm32v7", "arm64v8", "amd64"]
arch: [ "armhf.arm32v7", "arm64.arm64v8", "amd64.amd64"]

steps:
- name: Checkout repository
Expand All @@ -23,13 +23,15 @@ jobs:
run: |
curl -s -L https://github.com/svpcom/wfb-ng/releases/download/wifibroadcast-17.10/qemu-7.2.13-fixed.tar.gz | sudo tar xzv -C /
git submodule update --init
make osd_docker DOCKER_SRC_IMAGE=${{ matrix.arch }}/ubuntu:${{ matrix.version }}
make osd_docker mode=gst DOCKER_ARCH=$(echo ${{ matrix.arch}} | cut -f1 -d.) DOCKER_SRC_IMAGE=$(echo ${{ matrix.arch }} | cut -f2 -d.)/ubuntu:${{ matrix.version }}
make osd_docker mode=rockchip DOCKER_ARCH=$(echo ${{ matrix.arch}} | cut -f1 -d.) DOCKER_SRC_IMAGE=$(echo ${{ matrix.arch }} | cut -f2 -d.)/ubuntu:${{ matrix.version }}
- name: Archive production artifacts
uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: wfb-ng-osd-${{ github.ref_name }}-ubuntu${{ matrix.version }}-${{ matrix.arch }}
path: |
osd
osd.gst
osd.rockchip
- name: Output artifact URL
run: echo 'wfb-ng-osd-${{ github.ref_name }}-ubuntu${{ matrix.version }}-${{ matrix.arch }} ${{ steps.artifact-upload-step.outputs.artifact-url }}'
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mode ?= gst
ARCH ?= $(shell uname -i)
PYTHON ?= /usr/bin/python3
PYTHON ?= python3
DOCKER_ARCH ?= amd64
DOCKER_SRC_IMAGE ?= "p2ptech/cross-build:2023-02-21-raspios-bullseye-armhf-lite"

ifneq ("$(wildcard .git)","")
Expand Down Expand Up @@ -35,21 +36,23 @@ endif

all: osd

osd: osd.$(mode)

%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<

osd: $(OBJS)
osd.$(mode): $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS)


osd_docker: /opt/qemu/bin
@if ! [ -d /opt/qemu ]; then echo "Docker cross build requires patched QEMU!\nApply ./docker/qemu.patch to qemu-7.2.0 and build it:\n ./configure --prefix=/opt/qemu --static --disable-system && make && sudo make install"; exit 1; fi
if ! ls /proc/sys/fs/binfmt_misc | grep -q qemu ; then sudo ./docker/qemu-binfmt-conf.sh --qemu-path /opt/qemu/bin --persistent yes; fi
TAG="wfb-ng-osd:build-`date +%s`"; docker build -t $$TAG docker --build-arg SRC_IMAGE=$(DOCKER_SRC_IMAGE) && \
docker run -i --rm -v $(PWD):/build $$TAG bash -c "trap 'chown -R --reference=. .' EXIT; export VERSION=$(VERSION) COMMIT=$(COMMIT) SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) && cd /build && make clean && make osd mode=$(mode)"
TAG="wfb-ng-osd:build-`date +%s`"; docker build --platform linux/$(DOCKER_ARCH) -t $$TAG docker --build-arg SRC_IMAGE=$(DOCKER_SRC_IMAGE) && \
docker run -i --rm --platform linux/$(DOCKER_ARCH) -v $(PWD):/build $$TAG bash -c "trap 'chown -R --reference=. .' EXIT; export VERSION=$(VERSION) COMMIT=$(COMMIT) SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) && cd /build && make clean && make osd mode=$(mode)"
docker image ls -q "wfb-ng-osd:build-*" | uniq | tail -n+6 | while read i ; do docker rmi -f $$i; done

clean:
rm -f osd *.o *~
rm -f osd.$(mode) *.o *~
make -C fpv_video clean

3 changes: 2 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y build-essential git wget \
virtualenv fakeroot debhelper \
libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev \
libdrm-dev pkg-config

0 comments on commit aa6a938

Please sign in to comment.