Update build-test-recipe.yml #22
This file contains 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: build-test-recipe | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- 'master' | ||
- 'master-next' | ||
paths: | ||
- '**.bb' | ||
- '**.inc' | ||
jobs: | ||
generate-matrix: | ||
name: Generate matrix for build | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Check changed files | ||
id: diff | ||
run: | | ||
# See https://github.community/t/check-pushed-file-changes-with-git-diff-tree-in-github-actions/17220/10 | ||
if [ $GITHUB_BASE_REF ]; then | ||
# Pull Request | ||
git fetch origin $GITHUB_BASE_REF --depth=1 | ||
export DIFF=$( git diff --name-only origin/$GITHUB_BASE_REF $GITHUB_SHA ) | ||
echo "Diff between origin/$GITHUB_BASE_REF and $GITHUB_SHA" | ||
else | ||
# Push | ||
git fetch origin ${{ github.event.before }} --depth=1 | ||
export DIFF=$( git diff --name-only ${{ github.event.before }} $GITHUB_SHA ) | ||
echo "Diff between ${{ github.event.before }} and $GITHUB_SHA" | ||
fi | ||
echo "$DIFF" | ||
echo "diff=$( echo "$DIFF" | | tr -d '\n' )" >> $GITHUB_OUTPUT | ||
- name: Get recipe names to build | ||
run: | | ||
echo ${{ steps.diff.outputs.diff }} | sed 's!.*/!!' | sed 's!.bb!!' | sed 's!_.*!!' | sort | uniq | sed -z $'s/\\\n/ /g' | ||
build: | ||
needs: generate-matrix | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
device: | ||
- qemuarm | ||
- qemuarm64 | ||
- qemux86-64 | ||
image: | ||
- aws-iot-greengrass-demo-image | ||
runs-on: ${{ vars.CODEBUILD_RUNNER_NAME }}-${{ github.run_id }}-${{ github.run_attempt }} | ||
steps: | ||
name: build | ||
runs-on: codebuild-${{ vars.CODEBUILD_RUNNER_NAME }}-${{ github.run_id }}-${{ github.run_attempt }} | ||
steps: | ||
- name: Checkout meta-aws | ||
uses: actions/checkout@v4 | ||
with: | ||
path: ${{ github.workspace }}/meta-aws | ||
- name: Checkout meta-oe | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: openembedded/meta-openembedded | ||
path: ${{ github.workspace }}/meta-openembedded | ||
- name: Checkout poky | ||
run: | | ||
git clone git://git.yoctoproject.org/poky --single-branch ${{ github.workspace }}/poky | ||
- name: Run build | ||
run: | | ||
apt-get -y install sudo | ||
chown yoctouser /sstate-cache | ||
chown yoctouser /downloads | ||
chown -R yoctouser . | ||
sysctl vm.mmap_min_addr=65536 | ||
env | ||
sudo -u yoctouser bash -c '\ | ||
whoami && \ | ||
id && \ | ||
cd ${{ github.workspace }} && | ||
source poky/oe-init-build-env build | ||
bitbake-layers add-layer ../meta-openembedded/meta-oe && | ||
bitbake-layers add-layer ../meta-openembedded/meta-python && | ||
bitbake-layers add-layer ../meta-openembedded/meta-networking && | ||
bitbake-layers add-layer ../meta-openembedded/meta-multimedia && | ||
bitbake-layers add-layer ../meta-aws && | ||
export SSTATE_DIR=/sstate-cache && \ | ||
export DL_DIR=/downloads && \ | ||
export BB_ENV_PASSTHROUGH_ADDITIONS="$BB_ENV_PASSTHROUGH_ADDITIONS SSTATE_DIR DL_DIR" && \ | ||
bitbake aws-cli ' | ||