From e5972e789e6669731f22afbd2f1639429116ff01 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sun, 22 Mar 2026 01:46:24 +1100 Subject: [PATCH] ci: add lint workflow --- .github/workflows/lint.yml | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..64e2abf8 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,42 @@ +name: Lint code + +on: + push: + branches: + - main + pull_request: + +jobs: + check-format: + runs-on: ubuntu-latest + + container: + image: ghcr.io/${{ github.repository_owner }}/shell-arch-env:latest + + steps: + - uses: actions/checkout@v6 + + - name: Build + run: | + cmake -B build -G Ninja -DCMAKE_CXX_COMPILER=clazy -DCMAKE_CXX_FLAGS=-Werror + cmake --build build + + - name: Lint QML + shell: fish {0} + run: | + # Generate tooling + touch .qmlls.ini + QT_QPA_PLATFORM=offscreen QML2_IMPORT_PATH="$PWD/build/qml:$QML2_IMPORT_PATH" timeout 2 qs -p . + + # Construct linter args + set -l build_dir (grep -oP "(?<=buildDir=\")(.*)(?=\")" .qmlls.ini) + set -l import_paths (grep -oP "(?<=importPaths=\")(.*)(?=\")" .qmlls.ini | string split :) + set -l args -I $build_dir + for path in $import_paths + set -a args -I $path + end + set -l qml_files (string match -vr '(build|modules/controlcenter)/.*' **.qml) + + # Lint + set -l lint_out (qmllint --import disable $args $qml_files 2>&1 | tee /dev/stderr) + test -z "$lint_out" || exit 1