ci: add format checker
This commit is contained in:
parent
beddbb111e
commit
0ea106634e
2 changed files with 63 additions and 0 deletions
30
.github/actions/setup-arch/action.yml
vendored
Normal file
30
.github/actions/setup-arch/action.yml
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
name: Set up Arch Linux
|
||||
description: Install deps needed on Arch
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Get week
|
||||
id: date
|
||||
run: echo "week=$(date +%Y-%U)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /var/cache/pacman/pkg
|
||||
key: pacman-${{ steps.date.outputs.week }}-${{ hashFiles('.github/actions/setup-arch/action.yml') }}
|
||||
restore-keys: |
|
||||
pacman-${{ steps.date.outputs.week }}-
|
||||
pacman-
|
||||
|
||||
- name: Install deps
|
||||
run: |
|
||||
pacman -Syu --needed --noconfirm sudo base-devel cmake ninja fish git clang qt6-declarative python
|
||||
|
||||
- name: Install quickshell-git
|
||||
run: |
|
||||
useradd -m builder
|
||||
echo 'builder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
||||
sudo -u builder git clone https://aur.archlinux.org/quickshell-git.git /home/builder/quickshell-git
|
||||
cd /home/builder/quickshell-git
|
||||
sudo -u builder makepkg -si --noconfirm
|
||||
33
.github/workflows/check-format.yml
vendored
Normal file
33
.github/workflows/check-format.yml
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
name: Check formatting
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
check-format:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
container:
|
||||
image: archlinux:latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/setup-arch
|
||||
|
||||
- name: Check QML format
|
||||
shell: fish {0}
|
||||
run: |
|
||||
for file in (string match -v 'build/*' **.qml)
|
||||
/usr/lib/qt6/bin/qmlformat $file | diff -u $file - || exit 1
|
||||
end
|
||||
python3 scripts/qml-lint-conventions.py
|
||||
|
||||
- name: Check C++ format
|
||||
shell: fish {0}
|
||||
run: |
|
||||
for file in (string match -v 'build/*' **.cpp **.hpp)
|
||||
clang-format $file | diff -u $file - || exit 1
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue