Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First github build flow #5

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Initial workflow for OE Builds

name: build

# Controls when the action will run.
on:
# push to any branch named wip-test-*
push:
branches:
- 'wip-test-*'

# Allow workflow to be manually run from the Actions tab
workflow_dispatch:
inputs:
target:
description: 'Which target'
required: true
default: 'genericarm64'
type: choice
options:
- 'ci/genericarm64.yml'
- 'ci/genericarm64-ly.yml'
- 'ci/generic-armv7a.yml'
- 'ci/qemuarm64.yml'
- 'for-ref/stm32mp157c-dk2.yml'
- 'for-ref/xilinx-vendor.sh'
quick_test:
description: 'Do only a quick test build'
type: boolean
default: off

jobs:
# This workflow contains a single job called "build"
build-x86:
# The type of runner that the job will run on
runs-on:
labels: big-job-x86-ubuntu-22.04

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4

- name: Setup Build Host
run: |
./scripts/build-host-setup.sh

- name: Info
run: |
echo "path: $PATH"
echo "target: ${{ inputs.target }}"
echo "quick_test: ${{ inputs.quick_test }}"

- name: Do build
run: |
TARGET="${{ inputs.target }}"

# if no target specified (ex. push to wip-test-*), find one
if [ -z "$TARGET" ]; then
for t in ci/ci-job.sh ci/ci-job.yml ci/genericarm64.yml; do
if [ -r "$t" ]; then
TARGET="$t"
break
fi
done
fi

# if this a "quick test"?
if [ x"${{ inputs.quick_test }}" == x"true" ]; then
QUICK_TEST_ARG=":mixins/quick-test.yml"
else
QUICK_TEST_ARG=""
fi

# now handle kas vs shell script
case $TARGET in
*.yml)
kas build ${TARGET}${QUICK_TEST_ARG}
;;
*.sh)
./$TARGET
;;
*)
echo "Unknown target type"
exit 2
;;
esac

- name: show file stats
run: |
du -sh build/sstate-cache/ || true
du -sh build/downloads/ || true
du -sh build/tmp/deploy/images/ || true
du -sh build/tmp/deploy/ipk || true
cat build/tmp/buildstats/20*/build_stats || true

- name: Archive Images
uses: actions/upload-artifact@v4
with:
name: images
path: |
build/tmp/deploy/images

- name: Archive Packages
uses: actions/upload-artifact@v4
with:
name: packages
path: |
build/tmp/deploy/ipk
44 changes: 44 additions & 0 deletions ci/ci-job-example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Example CI job for testing PRs
# This shows multiple PRs at the same time
# however normally only one would be done per job

header:
version: 9
# We include the base job here
includes:
- genericarm64.yml

# override the source of the layers
# kas will not pull directly from the SHA of the PR commit
# the repo and branch of the PR can be found from th gh command
# gh pr status --json "headRefName,headRepository,headRepositoryOwner" #49
# The info below is from meta-openamp #49
repos:
layers/poky:
url: https://git.yoctoproject.org/git/poky
refspec: yocto-5.0.1
layers/meta-openamp:
url: https://github.com/wmamills/meta-openamp.git
refspec: wam-update-open-amp-lic-md5

# override the commit of these source repos
# for libmetal and open-amp BRANCH must be blank
# the recipe .inc file will add nobranch=1
# for openamp-system-reference we explicitly add nobranch=1 here
# NOTE: any override has higher priority than the base var name
# therefore these work even if the base recipe has = and not ?=
# The commits below are:
# libmetal #302
# open-amp #605
# openamp-system-reference #45
# (They were valid at the time but may not be when you try this)
local_conf_header:
autorev: |
PREFERRED_PROVIDER_libmetal = "libmetal-dev"
SRCREV:pn-libmetal-dev = "c58d3721bc070a19e1ec1d145e0be2f979072f05"
BRANCH:pn-libmetal-dev = ""
PREFERRED_PROVIDER_open-amp = "open-amp-dev"
SRCREV:pn-open-amp-dev = "fb7fc82e65f14ee8cb6e340426a35d80fa1f8091"
BRANCH:pn-open-amp-dev = ""
OPENAMP_SYS_REF_SRCREV = "65b35eabaa5ebe8dd3806e54494c65677c6c19e2"
OPENAMP_SYS_REF_BRANCH = "none;nobranch=1"
19 changes: 9 additions & 10 deletions scripts/build-host-setup.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
#!/bin/bash

ME=$0
MY_DIR=$(dirname $ME)

# setup host for building
sudo apt-get update
sudo apt-get -qq update

if [ -r ~/.aws/credentials ]; then
sudo apt-get install -y s3fs
sudo apt-get install -qqy s3fs
mkdir -p ~/net/openamp-builds
s3fs -o profile=openamp-builds-rw openamp-builds ~/net/openamp-builds
fi

# Yocto/OE requirements
sudo apt-get install -y gawk wget git-core diffstat unzip texinfo \
sudo apt-get install -qqy gawk wget git-core diffstat unzip texinfo \
build-essential chrpath socat cpio python3 python3-pip \
python3-pexpect xz-utils debianutils iputils-ping curl git \
zstd libssl-dev lz4
zstd libssl-dev lz4 python3-pip python3-venv

# we need kas
if ! which kas; then
pip3 install kas
if ! which kas; then
# fix up for this time, assume .bashrc will get it next time
PATH=~/.local/bin:$PATH
fi
$MY_DIR/venv-wrapper install self-copy
$MY_DIR/venv-wrapper install kas kas
fi

111 changes: 111 additions & 0 deletions scripts/venv-wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#!/bin/bash

VENV_BASE=~/opt/venv
BIN_DIR=~/.local/bin

# Allow override of above settings
if [ -r ~/.prjinfo/venv-wrapper.conf ]; then
. ~/.prjinfo/venv-wrapper.conf
fi

ME=$0
MY_NAME=$(basename $ME)
ME_FULL=$(readlink -f $ME)

do_wrapper_cmd() {
SUB_CMD=$1
MY_NAME=$2
shift 2

case $SUB_CMD in
"install"|"create"|"purge"|"run")
do_$SUB_CMD "$@"
;;
*)
echo "Unknown command $SUB_CMD"
echo "usage: venv-wrapper install|create|purge|run <name> [<args>]"
;;
esac
}

# create and install to ~/.local/bin
do_install() {
mkdir -p $BIN_DIR

case $MY_NAME in
"self"|"self-link")
ln -fs $ME_FULL $BIN_DIR/venv-wrapper
return
;;
"self-copy")
rm -f $BIN_DIR/venv-wrapper
cp -p $ME_FULL $BIN_DIR/venv-wrapper
return
;;
esac

do_create "$@"
if [ ! -x $BIN_DIR/venv-wrapper ]; then
ln -s $ME_FULL $BIN_DIR/venv-wrapper
fi

if [ -e $BIN_DIR/$MY_NAME ]; then
RL=$(readlink $BIN_DIR/$MY_NAME)
if [ x"$RL" != x"venv-wrapper" ]; then
echo "$BIN_DIR/$MY_NAME already exists and is not a symlink to venv-wrapper"
exit 2
fi
else
ln -s venv-wrapper $BIN_DIR/$MY_NAME
fi
}

# create the venv and do pip install of any extra args
do_create() {
mkdir -p $VENV_BASE
python3 -m venv $VENV_BASE/$MY_NAME
if [ -n "$1" ]; then
(do_install_pip "$@")
fi
}

# do the pip install step in a sub-shell
do_install_pip() {
# in a sub-shell so env changed will not persist
. $VENV_BASE/$MY_NAME/bin/activate
pip3 install "$@"
}

# create and install to ~/.local/bin
do_purge() {
mkdir -p $BIN_DIR

# delete the venv
if [ -r $VENV_BASE/$MY_NAME/bin/activate ]; then
rm -rf $VENV_BASE/$MY_NAME
fi

# delete the symlink
if [ -e $BIN_DIR/$MY_NAME ]; then
RL=$(readlink $BIN_DIR/$MY_NAME)
if [ x"$RL" == x"venv-wrapper" ]; then
rm -f $BIN_DIR/$MY_NAME
else
echo "$BIN_DIR/$MY_NAME already exists and is not a symlink to venv-wrapper"
exit 2
fi
fi

hash -r
}

do_run() {
. $VENV_BASE/$MY_NAME/bin/activate
$VENV_BASE/$MY_NAME/bin/$MY_NAME "$@"
}

if [ "$MY_NAME" == "venv-wrapper" ]; then
do_wrapper_cmd "$@"
else
do_run "$@"
fi