From 615fa435908a11028083e26e25edadfa41319734 Mon Sep 17 00:00:00 2001 From: Vladislav Nepogodin Date: Sun, 20 Nov 2022 04:15:24 +0400 Subject: [PATCH] Add CI --- .clang-format | 2 +- .github/workflows/build.yml | 41 +++++++++++++++++++++++++++ .github/workflows/checks.yml | 52 +++++++++++++++++++++++++++++++++++ .github/workflows/labeler.yml | 12 ++++++++ 4 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/checks.yml create mode 100644 .github/workflows/labeler.yml diff --git a/.clang-format b/.clang-format index 3ab4962..c56f98c 100644 --- a/.clang-format +++ b/.clang-format @@ -13,6 +13,6 @@ PointerAlignment: Left FixNamespaceComments: true SpaceBeforeCpp11BracedList: false SpacesBeforeTrailingComments: 2 -Standard: c++17 +Standard: c++20 TabWidth: 4 UseTab: Never diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7cd981f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,41 @@ +name: Build +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +env: + BUILD_TYPE: Debug + CTEST_OUTPUT_ON_FAILURE: 1 + +jobs: + build: + name: Build + runs-on: ubuntu-latest + container: archlinux + steps: + - uses: actions/checkout@v3 + + - name: install deps + run: | + sudo pacman -Syu --noconfirm + shell: bash + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCOS_INSTALLER_BUILD_TESTS=ON + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Test + working-directory: ${{github.workspace}}/build + # Execute tests defined by the CMake configuration. + run: ./tests/test-initcpio diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 0000000..6750a5d --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,52 @@ +name: Checks + +on: + push: + paths-ignore: + - '.github/ISSUE_TEMPLATE/**' + - 'LICENSE' + branches: + - master + pull_request: + branches: + - master + +concurrency: + group: checks-${{ github.ref }} + cancel-in-progress: true + +jobs: + cpp-linter: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Configure CMake + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Debug + + - uses: cpp-linter/cpp-linter-action@v2.2.4 + id: linter + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + style: file + version: '14' + database: ${{github.workspace}}/build + + - name: Fail fast?! + if: steps.linter.outputs.checks-failed > 0 + run: | + echo "Some files failed the linting checks!" + # for actual deployment + # run: exit 1 + + check_clang_format: + name: "Check C++ style" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Run clang-format style check for C/C++/Protobuf programs. + uses: jidicula/clang-format-action@v4.9.0 + with: + clang-format-version: '14' + check-path: 'src' + diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 0000000..58da89a --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,12 @@ +name: "PR Labeler" + +on: +- pull_request_target + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v4 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}"