Skip to content

Commit 2637d90

Browse files
committed
Mark BitBake tasks as network-enabled on CI runners
1 parent cf57708 commit 2637d90

5 files changed

Lines changed: 75 additions & 0 deletions

File tree

.github/workflows/bitbake-ci.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: BitBake CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-and-test:
10+
name: ${{ matrix.target }}
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
- target: static
17+
build_recipe: build-static
18+
test_recipe: test-static
19+
- target: dynamic
20+
build_recipe: build-dynamic
21+
test_recipe: test-dynamic
22+
23+
steps:
24+
- name: Check out repository
25+
uses: actions/checkout@v4
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: '3.12'
31+
32+
- name: Install system dependencies
33+
run: |
34+
sudo apt-get update
35+
sudo apt-get install -y build-essential git
36+
37+
- name: Install BitBake
38+
run: |
39+
git clone --depth 1 https://github.com/openembedded/bitbake.git "$RUNNER_TEMP/bitbake"
40+
echo "PATH=$RUNNER_TEMP/bitbake/bin:$PATH" >> "$GITHUB_ENV"
41+
echo "PYTHONPATH=$RUNNER_TEMP/bitbake/lib:${PYTHONPATH:-}" >> "$GITHUB_ENV"
42+
43+
- name: Verify BitBake installation
44+
run: bitbake --version
45+
46+
- name: Ensure BitBake CI config exists
47+
working-directory: build
48+
run: |
49+
mkdir -p conf
50+
if [ ! -f conf/local.conf ]; then
51+
{
52+
echo 'MACHINE = "qemux86"'
53+
echo 'BB_NUMBER_THREADS = "2"'
54+
echo 'PARALLEL_MAKE = "-j2"'
55+
} > conf/local.conf
56+
fi
57+
58+
# GitHub-hosted runners can block uid/gid map writes used by
59+
# BitBake's network namespace isolation path (/proc/self/uid_map).
60+
# Force-disable network unsharing for CI tasks.
61+
if ! grep -q '^BB_UNSHARE_NETWORK = "0"$' conf/local.conf; then
62+
echo 'BB_UNSHARE_NETWORK = "0"' >> conf/local.conf
63+
fi
64+
65+
- name: Build and test (${{ matrix.target }})
66+
working-directory: build
67+
run: |
68+
bitbake "${{ matrix.build_recipe }}"
69+
bitbake "${{ matrix.test_recipe }}"

meta-dynamic/recipes-dynamic/build-dynamic/build-dynamic_0.1.bb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
DESCRIPTION = "Building the HMM library dynamically"
22
PR = "r1"
3+
do_build[network] = "1"
4+
35
do_build () {
46
local dir="${TOPDIR}/../project-files"
57

meta-static/recipes-static/build-static/build-static_0.1.bb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
DESCRIPTION = "Building the HMM library statically"
22
PR = "r1"
3+
do_build[network] = "1"
4+
35
do_build () {
46
local dir="${TOPDIR}/../project-files"
57

meta-test/recipes-test/test-dynamic/test-dynamic_1.0.bb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
DESCRIPTION = "Testing HMM dynamically"
22
PR = "r1"
3+
do_build[network] = "1"
34

45
do_build() {
56
# Set the paths to the files

meta-test/recipes-test/test-static/test-static_1.0.bb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
DESCRIPTION = "Testing HMM statically"
22
PR = "r1"
3+
do_build[network] = "1"
34

45
do_build() {
56
# Set the paths to the files

0 commit comments

Comments
 (0)