ci: add lint workflow
This commit is contained in:
parent
9f3ef267ac
commit
e5972e789e
1 changed files with 42 additions and 0 deletions
42
.github/workflows/lint.yml
vendored
Normal file
42
.github/workflows/lint.yml
vendored
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Reference in a new issue