Skip to content

Commit

Permalink
CI: add a linting step for all of our custom bitbake recipes
Browse files Browse the repository at this point in the history
Signed-off-by: Leonard Göhrs <[email protected]>
  • Loading branch information
hnez committed Jul 26, 2024
1 parent 119d78f commit 46fea17
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/oe-stylize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

set -e -u -o pipefail

FILES="$(find meta-lxatac-bsp/ meta-lxatac-software/ -type f -name \*.bb)"

result="0"

while read -r recipe
do
# The oe-stylize script is not parameterizable, so we can not tell it not
# to output warnings about variables it does not know.
# Use grep to remove the warnings from its output.
python3 meta-oe/contrib/oe-stylize.py "${recipe}" | \
grep -v "## Warning: unknown variable/routine" > "${recipe}.linted"

diff --color=always "${recipe}" "${recipe}.linted" > "${recipe}.diff" \
&& file_result="ok" || file_result="error"

if [[ "x${file_result}" != "xok" ]]
then
# Group the output in the GitHub log as it can become quite unwieldy
echo "::group::${recipe}"
cat "${recipe}.diff"
echo "::endgroup::"

result="1"
fi
done <<< "${FILES}"

exit "${result}"
18 changes: 18 additions & 0 deletions .github/workflows/oe-stylize.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: oe-stylize

on:
create: # tags and branches
pull_request:
push:
jobs:
check:
name: lint recipes
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Run oe-stylize for all recipes
run: .github/workflows/oe-stylize.sh

0 comments on commit 46fea17

Please sign in to comment.