A thin wrapper around Siemens kas to build Yocto/OpenEmbedded projects with optimized caching and CI integration.
name: Yocto Build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest # or self-hosted for better performance and larger builds
steps:
- uses: actions/checkout@v4
- name: Build with kas
uses: gajeshbhat/kas-action@v1.0.0
with:
kas_file: kas.yml - name: Cache downloads and sstate
uses: actions/cache@v4
with:
path: |
dl_cache
sstate_cache
key: yocto-cache-${{ hashFiles('kas/*.yml') }}
restore-keys: yocto-cache-
- name: Build with kas
uses: gajeshbhat/kas-action@v1.0.0
with:
kas_file: kas.yml
dl_dir: dl_cache
sstate_dir: sstate_cache| Input | Description | Required | Default |
|---|---|---|---|
kas_file |
Space-separated kas YAML files | Yes | - |
kas_tag |
Kas container tag from ghcr.io/siemens/kas/kas | No | latest |
kas_cmd |
Kas command (build, shell, checkout, etc.) | No | build |
kas_args |
Additional arguments for kas command | No | "" |
bitbake_args |
Arguments passed to bitbake | No | "" |
dl_dir |
Download cache directory | No | dl_cache |
sstate_dir |
Shared state cache directory | No | sstate_cache |
parallelism |
Build parallelism (auto, number, or BB=4,MAKE=8) |
No | auto |
accept_licenses |
Space-separated licenses to accept | No | "" |
| Output | Description |
|---|---|
image_dir |
Path to built images directory |
build_dir |
Path to build directory |
- CI checks: Lints shell scripts and Dockerfile (see .github/workflows/ci.yml)
- Integration tests: Smoke tests using
kas dumpon a minimal config to keep runs fast (see .github/workflows/tests.yml) - Minimal Yocto image build: Manual, requires self-hosted runner (see .github/workflows/build-minimal.yml)
strategy:
matrix:
kas_file: [kas/qemux86-64.yml, kas/raspberrypi4-64.yml]
steps:
- uses: gajeshbhat/kas-action@v1.0.0
with:
kas_file: ${{ matrix.kas_file }}- name: Setup SSH for private repos
uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
- name: Add known hosts
run: ssh-keyscan github.com >> ~/.ssh/known_hosts
- uses: gajeshbhat/kas-action@v1.0.0
with:
kas_file: kas.yml
accept_licenses: "commercial proprietary"- uses: gajeshbhat/kas-action@v1.0.0
with:
kas_file: kas.yml
bitbake_args: "-c populate_sdk core-image-minimal"- Limitations: ~7GB RAM, ~14GB disk space
- Suitable for: Small builds and images similar to core-image-minimal
- Minimum: 16GB RAM, 100GB NVMe SSD, 8+ CPU cores
- Optimal: 32GB+ RAM, 500GB+ NVMe SSD, 16+ CPU cores
- Best for: Production builds, full distributions
- uses: actions/cache@v4
with:
path: |
dl_cache # ~1-5GB, highly reusable
sstate_cache # ~10-50GB, valuable for incremental builds
key: yocto-${{ hashFiles('kas/*.yml') }}-${{ github.run_number }}
restore-keys: |
yocto-${{ hashFiles('kas/*.yml') }}-
yocto-- DL_DIR (
dl_cache): Source downloads - always cache this - SSTATE_DIR (
sstate_cache): Build state - cache if disk allows - TMPDIR: Build workspace (~50-200GB) - usually too large to cache
Build fails with "No space left on device"
# Check available space
df -h
# Use self-hosted runner or clean upPrivate repository access denied
# Ensure SSH key is properly configured
- uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.DEPLOY_KEY }}Build is very slow
# Increase parallelism
- uses: gajeshbhat/kas-action@v1.0.0
with:
parallelism: "16" # or "BB=8,MAKE=16"# Checkout repositories only
- uses: gajeshbhat/kas-action@v1.0.0
with:
kas_file: kas.yml
kas_cmd: checkout
# Interactive shell (for debugging)
- uses: gajeshbhat/kas-action@v1.0.0
with:
kas_file: kas.yml
kas_cmd: shell
kas_args: "--keep-config-unchanged"
# Dump configuration
- uses: gajeshbhat/kas-action@v1.0.0
with:
kas_file: kas.yml
kas_cmd: dump- Documentation for Kas: https://kas.readthedocs.io/
- Report issues with this action: https://github.com/gajeshbhat/kas-action/issues
MIT - same as kas project