Skip to content

Commit b9877d6

Browse files
committed
Add raspberry pi checks to the CI
1 parent 7acf272 commit b9877d6

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Build and test on Virtualized Raspberry Pi OS
2+
3+
on:
4+
push:
5+
branches: [ master, develop ]
6+
pull_request:
7+
branches: [ master, develop ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 30
13+
permissions:
14+
id-token: write
15+
contents: read
16+
strategy:
17+
matrix:
18+
include:
19+
- os: bullseye
20+
image: ghcr.io/dtcooper/raspberrypi-os:python3.12-bullseye
21+
- os: bookworm
22+
image: ghcr.io/dtcooper/raspberrypi-os:python3.12-bookworm
23+
fail-fast: false
24+
25+
name: Build on ${{ matrix.os }}
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
- name: Set up QEMU
31+
uses: docker/setup-qemu-action@v3
32+
33+
- name: Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v3
35+
36+
- name: Configure AWS Credentials
37+
uses: aws-actions/configure-aws-credentials@v4
38+
with:
39+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
40+
role-session-name: ${{ secrets.AWS_ROLE_SESSION_NAME }}
41+
aws-region: ${{ secrets.AWS_REGION }}
42+
role-duration-seconds: 10800
43+
44+
- name: Build and Test
45+
env:
46+
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
47+
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
48+
AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }}
49+
AWS_REGION: ${{ env.AWS_REGION }}
50+
AWS_KVS_LOG_LEVEL: 2
51+
run: |
52+
docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace \
53+
-e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY \
54+
-e AWS_SESSION_TOKEN -e AWS_REGION -e AWS_KVS_LOG_LEVEL \
55+
--platform linux/arm64 \
56+
${{ matrix.image }} \
57+
/bin/bash -c '
58+
set -ex
59+
apt-get update
60+
apt-get install -y automake build-essential cmake git \
61+
gstreamer1.0-plugins-base-apps gstreamer1.0-plugins-bad \
62+
gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly \
63+
gstreamer1.0-tools gstreamer1.0-omx-generic \
64+
libcurl4-openssl-dev libgstreamer1.0-dev \
65+
libgstreamer-plugins-base1.0-dev liblog4cplus-dev \
66+
libssl-dev pkg-config
67+
68+
mkdir -p build
69+
cd build
70+
71+
cmake .. -DBUILD_GSTREAMER_PLUGIN=ON -DBUILD_DEPENDENCIES=OFF -DALIGNED_MEMORY_MODEL=ON
72+
make -j$(nproc)
73+
74+
export GST_PLUGIN_PATH=$(pwd)
75+
76+
set +e # Disable exit on error for the timeout command
77+
timeout --preserve-status --signal=SIGINT --kill-after=15s 30s \
78+
gst-launch-1.0 -v videotestsrc is-live=true \
79+
! video/x-raw,framerate=10/1,width=640,height=480 \
80+
! clockoverlay time-format="%a %B %d, %Y %I:%M:%S %p" \
81+
! x264enc bframes=0 key-int-max=10 \
82+
! h264parse \
83+
! kvssink stream-name="cpp-producer-rpi-${{ matrix.os }}"
84+
EXIT_CODE=$?
85+
set -e # Re-enable exit on error
86+
87+
# 0: Process exited after interrupt with code 0
88+
# 1: Process exited with error code 1
89+
# 137: Process killed by SIGKILL (if the --kill-after timeout is reached)
90+
echo "Command exited with code: $EXIT_CODE"
91+
if [ $EXIT_CODE -ne 0 ]; then
92+
echo "Command did not exit gracefully after interrupt."
93+
exit 1
94+
fi
95+
'

0 commit comments

Comments
 (0)