-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from syyyr/fix-tidy
Fix tidy
- Loading branch information
Showing
7 changed files
with
207 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Build and test | ||
description: "Build the project and run tests via CMake" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Build | ||
run: cmake --build '${{github.workspace}}/build' --parallel "$(nproc)" | ||
shell: bash | ||
|
||
- name: Test | ||
working-directory: '${{github.workspace}}/build' | ||
run: | | ||
# https://github.com/DiligentGraphics/github-action/commit/d2f7990b16def1efa337e5cc2fc8fa22b6fae55d | ||
PATH="/c/mingw64/bin:$PATH" | ||
ctest --output-on-failure -j"$(nproc)" | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Setup CMake | ||
description: "Invoke CMake and generate build files" | ||
inputs: | ||
additional_cmake_args: | ||
description: "Additional args to pass to CMake" | ||
default: "" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
# Linux deps | ||
- name: Install/cache clazy, and doctest | ||
if: runner.os != 'Windows' | ||
uses: awalsh128/[email protected] | ||
with: | ||
packages: doctest-dev clazy | ||
version: 1.0 | ||
|
||
# Windows deps | ||
- name: Install Windows deps | ||
if: runner.os == 'Windows' | ||
run: | | ||
vcpkg install doctest:x64-mingw-dynamic | ||
echo cmake_extra_args="'-DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake' '-DMINGW=ON' '-G MinGW Makefiles'" >> "$GITHUB_ENV" | ||
shell: bash | ||
|
||
- name: ccache | ||
uses: hendrikmuhs/[email protected] | ||
with: | ||
key: ${{ github.job }} | ||
|
||
- name: Configure CMake | ||
run: | | ||
CFLAGS="-Werror ${CFLAGS}" \ | ||
CXXFLAGS="-Werror ${CXXFLAGS}" \ | ||
cmake \ | ||
-S '${{github.workspace}}' \ | ||
-B '${{github.workspace}}/build' \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \ | ||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | ||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | ||
${{ env.cmake_extra_args }} \ | ||
${{ inputs.additional_cmake_args }} | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: run-linter | ||
description: "Run a linter on all changed files" | ||
inputs: | ||
lint_program_with_args: | ||
description: "Which program to run" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: ./.github/actions/cmake | ||
|
||
- uses: mjp41/workaround8649@c8550b715ccdc17f89c8d5c28d7a48eeff9c94a8 | ||
if: runner.os == 'Linux' | ||
with: | ||
os: ubuntu-latest | ||
|
||
- name: Copy compile_commands.json | ||
shell: bash | ||
run: cp build/compile_commands.json compile_commands.json | ||
|
||
- name: Run the linter | ||
shell: bash | ||
run: find -name '*.cpp' | parallel --verbose --jobs "$(nproc)" --plus _=[{#}/{##}] ${{ inputs.lint_program_with_args }} {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# vim: sw=2 | ||
name: Lint | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
clang-tidy: | ||
name: clang-tidy / Ubuntu 22.04 | ||
runs-on: ubuntu-22.04 | ||
env: | ||
CC: clang-15 | ||
CXX: clang++-15 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Run clang-tidy | ||
uses: ./.github/actions/run-linter | ||
with: | ||
lint_program_with_args: clang-tidy-15 --quiet --warnings-as-errors=* | ||
|
||
clazy: | ||
name: clazy / Ubuntu 22.04 | ||
runs-on: ubuntu-22.04 | ||
env: | ||
CC: clang-15 | ||
CXX: clang++-15 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Run clazy | ||
uses: ./.github/actions/run-linter | ||
with: | ||
lint_program_with_args: clazy-standalone --checks=level1,no-fully-qualified-moc-types,no-non-pod-global-static,no-range-loop-detach |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# vim: sw=2 | ||
name: Test | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
ubuntu-qt5: | ||
name: Qt 5.15.2 / Ubuntu 22.04 | ||
runs-on: ubuntu-22.04 | ||
env: | ||
CFLAGS: -fsanitize=address,undefined | ||
CXXFLAGS: -fsanitize=address,undefined | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup CMake | ||
uses: ./.github/actions/cmake | ||
|
||
- name: Build and test | ||
uses: ./.github/actions/build-and-test | ||
|
||
ubuntu-qt6: | ||
name: Qt 6.5.0 / Ubuntu 22.04 | ||
runs-on: ubuntu-22.04 | ||
env: | ||
CFLAGS: -fsanitize=address,undefined | ||
CXXFLAGS: -fsanitize=address,undefined | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup CMake | ||
uses: ./.github/actions/cmake | ||
|
||
- name: Build and test | ||
uses: ./.github/actions/build-and-test | ||
|
||
windows: | ||
name: Qt 6.5.0 / Windows | ||
runs-on: windows-2022 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup CMake | ||
uses: ./.github/actions/cmake | ||
with: | ||
additional_cmake_args: | | ||
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY='${{github.workspace}}/build/bin' \ | ||
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY='${{github.workspace}}/build/bin' | ||
- name: Build and test | ||
uses: ./.github/actions/build-and-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters