Skip to content

Add /WX (warnings as errors) compile flag when compiling with MSVC. #632

Add /WX (warnings as errors) compile flag when compiling with MSVC.

Add /WX (warnings as errors) compile flag when compiling with MSVC. #632

name: "Verify C++ code formatting"
on:
push:
paths:
- "**/*.cpp"
- "**/*.h"
- "**/*.hpp"
- ".clang-format"
- "!**/catch.hpp"
pull_request:
paths:
- "**/*.cpp"
- "**/*.h"
- "**/*.hpp"
- ".clang-format"
- "!**/catch.hpp"
jobs:
verify-code-formatting:
runs-on: [ubuntu-22.04]
steps:
- name: "Checkout code"
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- name: "Verify formatting of all files"
if: github.ref == 'refs/heads/master'
run: |
find . -type f \( -iname '*.cpp' -o -iname '*.h' -o -iname '*.hpp' \) -a ! -iname "catch.hpp" | \
xargs bin/check-formatting.sh
- name: "Verify formatting of the PR's files"
if: github.ref != 'refs/heads/master' && github.event.pull_request.url
run: |
PULL_REQUEST_URL=$(jq -r ".pull_request.url" "$GITHUB_EVENT_PATH")
curl --url $"${PULL_REQUEST_URL}/files" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | \
jq -c '.[] | select(.status == "added" or .status == "modified") | select(.filename | match("(?<!catch)\\.(cpp|hpp|h)$")) | .filename' | \
xargs bin/check-formatting.sh