feat: added c and cpp setup actions and added to format
This commit is contained in:
parent
434e113e61
commit
b825911353
4 changed files with 56 additions and 0 deletions
11
.github/actions/setup-c/action.yml
vendored
Normal file
11
.github/actions/setup-c/action.yml
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
name: Setup C++ Development Environment
|
||||||
|
description: Install and configure clang-format and other C++ tools
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Install clang-format
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y clang-format
|
||||||
11
.github/actions/setup-cpp/action.yml
vendored
Normal file
11
.github/actions/setup-cpp/action.yml
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
name: Setup C++ Development Environment
|
||||||
|
description: Install and configure clang-format and other C++ tools
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Install clang-format
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y clang-format
|
||||||
14
.github/workflows/format-nix.yml
vendored
14
.github/workflows/format-nix.yml
vendored
|
|
@ -66,6 +66,20 @@ jobs:
|
||||||
"rust")
|
"rust")
|
||||||
(cd "$TARGET_DIR" && cargo fmt --all)
|
(cd "$TARGET_DIR" && cargo fmt --all)
|
||||||
;;
|
;;
|
||||||
|
"cpp")
|
||||||
|
if find "$TARGET_DIR" -type f \( -name "*.cpp" -o -name "*.hpp" \) -not -path "*/extern/*" | grep -q .; then
|
||||||
|
find "$TARGET_DIR" -type f \( -name "*.cpp" -o -name "*.hpp" \) -not -path "*/extern/*" -exec clang-format -i --style=file {} \;
|
||||||
|
else
|
||||||
|
echo "No C++ files found in $TARGET_DIR. Skipping clang-format."
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"c")
|
||||||
|
if find "$TARGET_DIR" -type f \( -name "*.c" -o -name "*.h" \) -not -path "*/extern/*" | grep -q .; then
|
||||||
|
find "$TARGET_DIR" -type f \( -name "*.c" -o -name "*.h" \) -not -path "*/extern/*" -exec clang-format -i --style=file {} \;
|
||||||
|
else
|
||||||
|
echo "No C files found in $TARGET_DIR. Skipping clang-format."
|
||||||
|
fi
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "unsupported language: ${{ inputs.language }}"
|
echo "unsupported language: ${{ inputs.language }}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
20
.github/workflows/format.yml
vendored
20
.github/workflows/format.yml
vendored
|
|
@ -32,6 +32,12 @@ jobs:
|
||||||
- name: set up csharp
|
- name: set up csharp
|
||||||
if: inputs.language == 'csharp'
|
if: inputs.language == 'csharp'
|
||||||
uses: c4patino/actions/.github/actions/setup-csharp@main
|
uses: c4patino/actions/.github/actions/setup-csharp@main
|
||||||
|
- name: set up c
|
||||||
|
if: inputs.language == 'c'
|
||||||
|
uses: c4patino/actions/.github/actions/setup-c@main
|
||||||
|
- name: set up cpp
|
||||||
|
if: inputs.language == 'cpp'
|
||||||
|
uses: c4patino/actions/.github/actions/setup-cpp@main
|
||||||
- name: set up go
|
- name: set up go
|
||||||
if: inputs.language == 'go'
|
if: inputs.language == 'go'
|
||||||
uses: c4patino/actions/.github/actions/setup-go@main
|
uses: c4patino/actions/.github/actions/setup-go@main
|
||||||
|
|
@ -94,6 +100,20 @@ jobs:
|
||||||
"rust")
|
"rust")
|
||||||
(cd "$TARGET_DIR" && cargo fmt --all)
|
(cd "$TARGET_DIR" && cargo fmt --all)
|
||||||
;;
|
;;
|
||||||
|
"cpp")
|
||||||
|
if find "$TARGET_DIR" -type f \( -name "*.cpp" -o -name "*.hpp" \) -not -path "*/extern/*" | grep -q .; then
|
||||||
|
find "$TARGET_DIR" -type f \( -name "*.cpp" -o -name "*.hpp" \) -not -path "*/extern/*" -exec clang-format -i --style=file {} \;
|
||||||
|
else
|
||||||
|
echo "No C++ files found in $TARGET_DIR. Skipping clang-format."
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"c")
|
||||||
|
if find "$TARGET_DIR" -type f \( -name "*.c" -o -name "*.h" \) -not -path "*/extern/*" | grep -q .; then
|
||||||
|
find "$TARGET_DIR" -type f \( -name "*.c" -o -name "*.h" \) -not -path "*/extern/*" -exec clang-format -i --style=file {} \;
|
||||||
|
else
|
||||||
|
echo "No C files found in $TARGET_DIR. Skipping clang-format."
|
||||||
|
fi
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "unsupported language: ${{ inputs.language }}"
|
echo "unsupported language: ${{ inputs.language }}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue