Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: condition for job skipping #29

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/bazel_buildifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,15 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run Buildifier
run: |-
echo "${{ steps.changed_files.outputs.all }}"
if echo "${{ steps.changed_files.outputs.all }}" | grep -qE '(BUILD|WORKSPACE|MODULE\.bazel|\.bazelrc)$'; then
IFS=' ' read -r -a files <<< "${{ steps.changed_files.outputs.all }}"
bazel_files=()
for file in "${files[@]}"; do
if [[ "$file" == BUILD || "$file" == WORKSPACE || "$file" == MODULE\.bazel || "$file" == \.bazelrc ]]; then
bazel_files+=("$file")
fi
done
if [ ${#bazel_files[@]} -gt 0 ]; then
echo "Running bazel buildifier"
bazel run //bazel:buildifier_check
else
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/clang_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,18 @@ jobs:
- name: Set up clang-format
run: sudo apt-get install clang-format
- name: Run clang-format
run: |
if echo "${{ steps.changed_files.outputs.all }}" | grep -qE '\.(cpp|h|hpp|cc|cxx|hxx)$'; then
run: |-
IFS=' ' read -r -a files <<< "${{ steps.changed_files.outputs.all }}"
cpp_files=()
for file in "${files[@]}"; do
if [[ "$file" == *.cpp || "$file" == *.h || "$file" == *.hpp || "$file" == *.cc || "$file" == *.cxx || "$file" == *.hxx ]]; then
cpp_files+=("$file")
fi
done
if [ ${#cpp_files[@]} -gt 0 ]; then
echo -e "Running clang-format"
find . -name "*.cpp" -o -name "*.h" -o -name "*.hpp" -o -name "*.cc" -o -name "*.cxx" -o -name "*.hxx" | xargs clang-format --dry-run --Werror
clang-format --dry-run --Werror "${cpp_files[@]}"
else
echo -e "Skipping clang-format since no source files were changed."
fi
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/clang_tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,16 @@ jobs:
format: space-delimited
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run Clang-Tidy
run: |
if echo "${{ steps.changed_files.outputs.all }}" | grep -qE '\.(cpp|h|hpp|cc|cxx|hxx)$'; then
run: |-
IFS=' ' read -r -a files <<< "${{ steps.changed_files.outputs.all }}"
cpp_files=()
for file in "${files[@]}"; do
if [[ "$file" == *.cpp || "$file" == *.h || "$file" == *.hpp || "$file" == *.cc || "$file" == *.cxx || "$file" == *.hxx ]]; then
cpp_files+=("$file")
fi
done
if [ ${#cpp_files[@]} -gt 0 ]; then
echo -e "Running clang-tidy"
bazel build //... \
--aspects @bazel_clang_tidy//clang_tidy:clang_tidy.bzl%clang_tidy_aspect \
Expand Down
Loading