Mark BitBake tasks as network-enabled on CI runners #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: BitBake CI | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| build-and-test: | |
| name: ${{ matrix.target }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: static | |
| build_recipe: build-static | |
| test_recipe: test-static | |
| - target: dynamic | |
| build_recipe: build-dynamic | |
| test_recipe: test-dynamic | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential git | |
| - name: Install BitBake | |
| run: | | |
| git clone --depth 1 https://github.com/openembedded/bitbake.git "$RUNNER_TEMP/bitbake" | |
| echo "PATH=$RUNNER_TEMP/bitbake/bin:$PATH" >> "$GITHUB_ENV" | |
| echo "PYTHONPATH=$RUNNER_TEMP/bitbake/lib:${PYTHONPATH:-}" >> "$GITHUB_ENV" | |
| - name: Verify BitBake installation | |
| run: bitbake --version | |
| - name: Ensure BitBake CI config exists | |
| working-directory: build | |
| run: | | |
| mkdir -p conf | |
| if [ ! -f conf/local.conf ]; then | |
| { | |
| echo 'MACHINE = "qemux86"' | |
| echo 'BB_NUMBER_THREADS = "2"' | |
| echo 'PARALLEL_MAKE = "-j2"' | |
| } > conf/local.conf | |
| fi | |
| # GitHub-hosted runners can block uid/gid map writes used by | |
| # BitBake's network namespace isolation path (/proc/self/uid_map). | |
| # Force-disable network unsharing for CI tasks. | |
| if ! grep -q '^BB_UNSHARE_NETWORK = "0"$' conf/local.conf; then | |
| echo 'BB_UNSHARE_NETWORK = "0"' >> conf/local.conf | |
| fi | |
| - name: Build and test (${{ matrix.target }}) | |
| working-directory: build | |
| run: | | |
| bitbake "${{ matrix.build_recipe }}" | |
| bitbake "${{ matrix.test_recipe }}" |