From 7355a5c9a458cc21c83759d660c40af8ea78b25e Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Mon, 20 May 2024 15:24:34 -0700 Subject: [PATCH] Add clang format to action --- .github/workflows/check.yml | 38 ++++++++++++++++++------------------- gui/adddictdialog.h | 4 ++-- gui/dictmodel.h | 4 ++-- gui/dictwidget.h | 4 ++-- gui/main.h | 10 +++++----- test/basic_test.cpp | 3 ++- test/main.cpp | 6 +++--- 7 files changed, 35 insertions(+), 34 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b6e6db6..26e9415 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,5 +1,4 @@ name: CI - on: push: branches: @@ -7,10 +6,21 @@ on: pull_request: branches: - master - jobs: + clang-format: + name: Check clang-format + runs-on: ubuntu-latest + container: archlinux:latest + steps: + - name: Install dependencies + run: | + pacman -Syu --noconfirm git clang diffutils + git config --global --add safe.directory $GITHUB_WORKSPACE + - uses: actions/checkout@v4 + - uses: fcitx/github-actions@clang-format check: name: Build and test + needs: clang-format runs-on: ubuntu-latest container: archlinux:latest strategy: @@ -37,20 +47,15 @@ jobs: uses: actions/cache@v4 with: path: 'fcitx5/**/*.tar.*' - key: ${{ runner.os }}-${{ hashFiles('fcitx5/src/modules/spell/CMakeLists.txt') }} + key: ${{ runner.os }}-${{ hashFiles('fcitx5/src/modules/spell/CMakeLists.txt') + }} - name: Build and Install fcitx5 uses: fcitx/github-actions@cmake with: path: fcitx5 cmake-option: >- - -DENABLE_KEYBOARD=Off - -DENABLE_X11=Off - -DENABLE_WAYLAND=Off - -DENABLE_ENCHANT=Off - -DENABLE_DBUS=Off - -DENABLE_SERVER=Off - -DENABLE_EMOJI=Off - -DUSE_SYSTEMD=Off + -DENABLE_KEYBOARD=Off -DENABLE_X11=Off -DENABLE_WAYLAND=Off -DENABLE_ENCHANT=Off + -DENABLE_DBUS=Off -DENABLE_SERVER=Off -DENABLE_EMOJI=Off -DUSE_SYSTEMD=Off - uses: actions/checkout@v4 with: repository: fcitx/fcitx5-qt @@ -61,9 +66,7 @@ jobs: repository: fcitx/fcitx5-qt path: fcitx5-qt cmake-option: >- - -DENABLE_QT4=Off - -DENABLE_QT5=Off - -DENABLE_QT6=On + -DENABLE_QT4=Off -DENABLE_QT5=Off -DENABLE_QT6=On - uses: actions/checkout@v4 with: repository: naokiri/cskk @@ -78,9 +81,7 @@ jobs: key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Build and install cskk shell: bash - run: | - cd cskk - cargo cinstall --release --prefix=/usr + run: "cd cskk\ncargo cinstall --release --prefix=/usr \n" - uses: actions/checkout@v4 with: path: fcitx5-cskk @@ -94,8 +95,7 @@ jobs: with: path: fcitx5-cskk cmake-option: >- - -DENABLE_QT=On - -DUSE_QT6=On + -DENABLE_QT=On -DUSE_QT6=On - name: Test run: | ctest --test-dir fcitx5-cskk/build diff --git a/gui/adddictdialog.h b/gui/adddictdialog.h index 24dd0d1..8e046e6 100644 --- a/gui/adddictdialog.h +++ b/gui/adddictdialog.h @@ -1,6 +1,6 @@ /* - * SPDX-FileCopyrightText: 2013~2022 CSSlayer , Naoaki Iwakiri - * + * SPDX-FileCopyrightText: 2013~2022 CSSlayer , Naoaki + * Iwakiri * * SPDX-License-Identifier: GPL-3.0-or-later * diff --git a/gui/dictmodel.h b/gui/dictmodel.h index 7d6ee9d..3d3fb49 100644 --- a/gui/dictmodel.h +++ b/gui/dictmodel.h @@ -1,6 +1,6 @@ /* - * SPDX-FileCopyrightText: 2013~2022 CSSlayer , Naoaki Iwakiri - * + * SPDX-FileCopyrightText: 2013~2022 CSSlayer , Naoaki + * Iwakiri * * SPDX-License-Identifier: GPL-3.0-or-later * diff --git a/gui/dictwidget.h b/gui/dictwidget.h index 8ec50bf..d6ff429 100644 --- a/gui/dictwidget.h +++ b/gui/dictwidget.h @@ -1,6 +1,6 @@ /* - * SPDX-FileCopyrightText: 2013~2022 CSSlayer , Naoaki Iwakiri - * + * SPDX-FileCopyrightText: 2013~2022 CSSlayer , Naoaki + * Iwakiri * * SPDX-License-Identifier: GPL-3.0-or-later * diff --git a/gui/main.h b/gui/main.h index 9afd4d6..baf60f1 100644 --- a/gui/main.h +++ b/gui/main.h @@ -13,12 +13,12 @@ namespace fcitx { class CskkConfigPlugin : public FcitxQtConfigUIPlugin { - Q_OBJECT + Q_OBJECT public: - Q_PLUGIN_METADATA(IID FcitxQtConfigUIFactoryInterface_iid FILE - "cskk-config.json") - explicit CskkConfigPlugin(QObject *parent = 0); - FcitxQtConfigUIWidget *create(const QString &key) override; + Q_PLUGIN_METADATA(IID FcitxQtConfigUIFactoryInterface_iid FILE + "cskk-config.json") + explicit CskkConfigPlugin(QObject *parent = 0); + FcitxQtConfigUIWidget *create(const QString &key) override; }; } // namespace fcitx diff --git a/test/basic_test.cpp b/test/basic_test.cpp index 3f1475b..ef1d16e 100644 --- a/test/basic_test.cpp +++ b/test/basic_test.cpp @@ -1,7 +1,8 @@ /* * Copyright (c) 2021 Naoaki Iwakiri * This program is released under GNU General Public License version 3 or later - * You should have received a copy of the GNU General Public License along with this program. If not, see . + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . * * Creation Date: 2021-05-08 * diff --git a/test/main.cpp b/test/main.cpp index 328176e..6e427d7 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -1,7 +1,8 @@ /* * Copyright (c) 2021 Naoaki Iwakiri * This program is released under GNU General Public License version 3 or later - * You should have received a copy of the GNU General Public License along with this program. If not, see . + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . * * Creation Date: 2021-05-08 * @@ -13,8 +14,7 @@ #include "gtest/gtest.h" -int main(int argc, char** argv) { +int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } -