Skip to content

Commit

Permalink
Add docker builds
Browse files Browse the repository at this point in the history
  • Loading branch information
svpcom committed Aug 16, 2024
1 parent bcc7041 commit 06a4734
Show file tree
Hide file tree
Showing 10 changed files with 709 additions and 10 deletions.
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Your setup (please complete the following information):**
- OS [e.g. Ubuntu 18.04, Raspbian]
- Hardware [e.g. x86, rpi, nanopi neo2 ]
- WiFi cards [e.g. rt28xx, rtl8812au]
- WiFi drivers [e.g. stock, patched from http://.. ]

**Additional context**
Add any other context about the problem here.

**Confirm you read**
- [ ] https://github.com/svpcom/wfb-ng/blob/master/README.md
- [ ] https://github.com/svpcom/wfb-ng/wiki/Setup-HOWTO
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: ⛔ Support Question
about: See https://github.com/svpcom/wfb-ng/discussions for questions about using WFB.

---

We use GitHub issues only to discuss WFB bugs and new features. For
questions about using WFB or related components, please use https://github.com/svpcom/wfb-ng/discussions

Thanks!


35 changes: 35 additions & 0 deletions .github/workflows/build_debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: WFB-ng-osd package builder for debian

on:
push:
branches: [ master, release-23.08 ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master, stable ]

jobs:
build_and_test:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
version: [11, 12]
arch: [ "arm32v7", "arm64v8", "amd64"]

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: build package
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 }}
- 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
- name: Output artifact URL
run: echo 'wfb-ng-osd-${{ github.ref_name }}-debian${{ matrix.version }}-${{ matrix.arch }} ${{ steps.artifact-upload-step.outputs.artifact-url }}'
36 changes: 36 additions & 0 deletions .github/workflows/build_pi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: WFB-ng-osd package builder for RPI and NanoPI

on:
push:
branches: [ master, release-23.08 ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master, stable ]

jobs:
build_and_test:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
docker-images:
- "2023-02-21-raspios-bullseye-armhf-lite"
- "2023-02-21-raspios-bullseye-arm64-lite"

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: build package
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=p2ptech/cross-build:${{ matrix.docker-images }}
- name: Archive production artifacts
uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: wfb-ng-osd-${{ github.ref_name }}-${{ matrix.docker-images }}
path: |
osd
- name: Output artifact URL
run: echo 'wfb-ng-osd-${{ github.ref_name }}-${{ matrix.docker-images }} ${{ steps.artifact-upload-step.outputs.artifact-url }}'
35 changes: 35 additions & 0 deletions .github/workflows/build_ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: WFB-ng-osd package builder for ubuntu

on:
push:
branches: [ master, release-23.08 ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master, stable ]

jobs:
build_and_test:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
version: [ "20.04", "22.04", "24.04" ]
arch: [ "arm32v7", "arm64v8", "amd64"]

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: build package
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 }}
- 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
- name: Output artifact URL
run: echo 'wfb-ng-osd-${{ github.ref_name }}-ubuntu${{ matrix.version }}-${{ matrix.arch }} ${{ steps.artifact-upload-step.outputs.artifact-url }}'
56 changes: 56 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ master, stable ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master, stable ]
schedule:
- cron: '41 12 * * 4'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-24.04

strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

- run: |
sudo apt update && sudo apt -y install build-essential libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
git submodule update --init
make osd
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
36 changes: 26 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
mode?=gst
mode ?= gst
ARCH ?= $(shell uname -i)
PYTHON ?= /usr/bin/python3
COMMIT ?= $(shell git rev-parse HEAD)
VERSION ?= $(shell $(PYTHON) ./version.py $(shell git show -s --format="%ct" $(shell git rev-parse HEAD)) $(shell git rev-parse --abbrev-ref HEAD))
SOURCE_DATE_EPOCH ?= $(shell git show -s --format="%ct" $(shell git rev-parse HEAD))
DOCKER_SRC_IMAGE ?= "p2ptech/cross-build:2023-02-21-raspios-bullseye-armhf-lite"

ifneq ("$(wildcard .git)","")
COMMIT ?= $(or $(shell git rev-parse HEAD), local)
VERSION ?= $(or $(shell $(PYTHON) ./version.py $(shell git show -s --format="%ct" $(shell git rev-parse HEAD)) $(shell git rev-parse --abbrev-ref HEAD)), 0.0.0)
SOURCE_DATE_EPOCH ?= $(or $(shell git show -s --format="%ct" $(shell git rev-parse HEAD)), $(shell date "+%s"))
else
COMMIT ?= local
VERSION ?= 0.0.0
SOURCE_DATE_EPOCH ?= $(shell date "+%s")
endif

export VERSION COMMIT SOURCE_DATE_EPOCH

CFLAGS += -DWFB_OSD_VERSION='"$(VERSION)-$(shell /bin/bash -c '_tmp=$(COMMIT); echo $${_tmp::8}')"'

ifeq ($(mode), gst)
CFLAGS += -Wall -pthread -std=gnu99 -D__GST_OPENGL__ -fPIC $(shell pkg-config --cflags glib-2.0) $(shell pkg-config --cflags gstreamer-1.0)
LDFLAGS += $(shell pkg-config --libs glib-2.0) $(shell pkg-config --libs gstreamer-1.0) $(shell pkg-config --libs gstreamer-video-1.0) -lgstapp-1.0 -lpthread -lrt -lm
OBJS = main.o osdrender.o osdmavlink.o graphengine.o UAVObj.o m2dlib.o math3d.o osdconfig.o osdvar.o fonts.o font_outlined8x14.o font_outlined8x8.o appsrc.o
CFLAGS += -Wall -pthread -std=gnu99 -D__GST_OPENGL__ -fPIC $(shell pkg-config --cflags glib-2.0) $(shell pkg-config --cflags gstreamer-1.0)
LDFLAGS += $(shell pkg-config --libs glib-2.0) $(shell pkg-config --libs gstreamer-1.0) $(shell pkg-config --libs gstreamer-video-1.0) -lgstapp-1.0 -lpthread -lrt -lm
OBJS = main.o osdrender.o osdmavlink.o graphengine.o UAVObj.o m2dlib.o math3d.o osdconfig.o osdvar.o fonts.o font_outlined8x14.o font_outlined8x8.o appsrc.o
else
CFLAGS += -Wall -pthread -std=gnu99 -D__BCM_OPENVG__ -I$(SYSROOT)/opt/vc/include/ -I$(SYSROOT)/opt/vc/include/interface/vcos/pthreads -I$(SYSROOT)/opt/vc/include/interface/vmcs_host/linux
LDFLAGS += -L$(SYSROOT)/opt/vc/lib/ -lbrcmGLESv2 -lbrcmEGL -lopenmaxil -lbcm_host -lvcos -lvchiq_arm -lpthread -lrt -lm
OBJS = main.o osdrender.o osdmavlink.o graphengine.o UAVObj.o m2dlib.o math3d.o osdconfig.o osdvar.o fonts.o font_outlined8x14.o font_outlined8x8.o oglinit.o
CFLAGS += -Wall -pthread -std=gnu99 -D__BCM_OPENVG__ -I$(SYSROOT)/opt/vc/include/ -I$(SYSROOT)/opt/vc/include/interface/vcos/pthreads -I$(SYSROOT)/opt/vc/include/interface/vmcs_host/linux
LDFLAGS += -L$(SYSROOT)/opt/vc/lib/ -lbrcmGLESv2 -lbrcmEGL -lopenmaxil -lbcm_host -lvcos -lvchiq_arm -lpthread -lrt -lm
OBJS = main.o osdrender.o osdmavlink.o graphengine.o UAVObj.o m2dlib.o math3d.o osdconfig.o osdvar.o fonts.o font_outlined8x14.o font_outlined8x8.o oglinit.o
endif

all: osd
Expand All @@ -27,6 +35,14 @@ all: osd
osd: $(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-osg: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)"
docker image ls -q "wfb-ng-osd:build-*" | tail -n+5 | while read i ; do docker rmi $$i; done

clean:
rm -f osd *.o *~
make -C fpv_video clean
Expand Down
9 changes: 9 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ARG SRC_IMAGE

FROM $SRC_IMAGE

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
Loading

0 comments on commit 06a4734

Please sign in to comment.