Skip to content

workflow: add status badge to README.md #2

workflow: add status badge to README.md

workflow: add status badge to README.md #2

name: Build BISDN Linux
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch: # allow manual triggering from the GitHub web UI
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
machine: [generic-x86-64, generic-armel-iproc]
# Allow matrix jobs to continue regardless of failures in other
# jobs.
fail-fast: false
env:
KAS_CFG_FILES: "bisdn-linux.yaml:rm-work.yaml"
MACHINE: "${{ matrix.machine }}"
# Build full image (for faster pipeline tests, use "minimal")
TARGET: "full"
SSTATE_CACHE_DIR: "build/sstate-cache"
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Inspect build host
run: |
lscpu
echo .
free -h
echo .
df -h
- name: Free disk space
run: |
df -h /
echo .
del_dirs="\
"$AGENT_TOOLSDIRECTORY" \
/opt/ghc \
/opt/google \
/opt/microsoft \
/usr/lib/google-cloud-sdk \
/usr/lib/jvm \
/usr/local/lib/android \
/usr/local/lib/node_modules \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift \
"
# Ignore non-existent directories
echo "Space we are about to reclaim"
sudo du -msc $del_dirs 2>/dev/null || true
sudo rm -rf $del_dirs 2>/dev/null
echo .
df -h /
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
pip3 install kas
# The kas dump file records the current state of each source repo.
# We use it for the cache key in the next step.
- name: Create kas configuration dump file
run: |
export KAS_MACHINE=$MACHINE
export KAS_TARGET=$TARGET
kas-container dump "$KAS_CFG_FILES" --resolve-refs > dump
# sstate-cache saves a lot of time. Do not cache anything else (such
# as build/downloads) to at least have a chance to cache both
# MACHINEs without running into github's cache size limit.
# Current state: https://github.com/bisdn/bisdn-linux/actions/caches
- name: Cache BitBake directories
uses: actions/cache@v4
with:
path: |
build/sstate-cache
key: ${{ matrix.machine }}-${{ env.TARGET }}-${{ hashFiles('**/dump') }}
restore-keys: |
${{ matrix.machine }}-${{ env.TARGET }}-
${{ matrix.machine }}-
# On a machine with all build dependencies installed, this is the only
# command required to download the source repos and build the image.
- name: Build BISDN Linux
run: |
export KAS_MACHINE=$MACHINE
export KAS_TARGET=$TARGET
kas-container build "$KAS_CFG_FILES"
- name: Remove duplicates in sstate-cache
run: |
echo "##############################################################"
du -ms "$SSTATE_CACHE_DIR"
echo "Removing duplicates in sstate-cache."
./sources/poky/scripts/sstate-cache-management.sh \
--cache-dir="$SSTATE_CACHE_DIR" --remove-duplicated --yes
echo "##############################################################"
du -ms "$SSTATE_CACHE_DIR"