From 46fea17646f553cd654c272d978ebc77a4dfa446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonard=20G=C3=B6hrs?= Date: Mon, 19 Feb 2024 08:20:11 +0100 Subject: [PATCH] CI: add a linting step for all of our custom bitbake recipes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Leonard Göhrs --- .github/workflows/oe-stylize.sh | 31 +++++++++++++++++++++++++++++++ .github/workflows/oe-stylize.yaml | 18 ++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100755 .github/workflows/oe-stylize.sh create mode 100644 .github/workflows/oe-stylize.yaml diff --git a/.github/workflows/oe-stylize.sh b/.github/workflows/oe-stylize.sh new file mode 100755 index 00000000..8cb5794b --- /dev/null +++ b/.github/workflows/oe-stylize.sh @@ -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}" diff --git a/.github/workflows/oe-stylize.yaml b/.github/workflows/oe-stylize.yaml new file mode 100644 index 00000000..d9bf9195 --- /dev/null +++ b/.github/workflows/oe-stylize.yaml @@ -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