Skip to content

Commit

Permalink
Merge pull request #3236 from cgwalters/clang-format
Browse files Browse the repository at this point in the history
ci: Only run clang-format on ubuntu-stable GH runner
  • Loading branch information
cgwalters authored May 2, 2024
2 parents cb13977 + a33c7d2 commit 64ab098
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 20 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ jobs:
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Test style
run: ./ci/ci-commitmessage-submodules.sh
clang-format:
name: "clang-format"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
# https://github.com/actions/checkout/issues/760
- name: Mark git checkout as safe
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- run: sudo apt install clang-format
- name: Test style
run: ./ci/clang-format.sh
build-integration:
runs-on: ubuntu-latest
container: quay.io/coreos-assembler/fcos-buildroot:testing-devel
Expand Down
20 changes: 20 additions & 0 deletions ci/clang-format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Tests that validate structure of the source code;
# can be run without building it.
set -euo pipefail

clang_ver=$(clang-format --version)
clang_min_ver=15
version_re=" version ([0-9]+)."
if [[ $clang_ver =~ $version_re ]]; then
if test "${BASH_REMATCH[1]}" -ge "${clang_min_ver}"; then
echo -n "checking clang-format... "
git ls-files '**.c' '**.cxx' '**.h' '**.hpp' | xargs clang-format --Werror --dry-run
echo "ok"
else
echo "notice: clang-format ${clang_ver}" is too old
fi
else
echo "failed to parse clang-format version ${clang_ver}" 1>&2
exit 1
fi
18 changes: 0 additions & 18 deletions ci/codestyle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,6 @@ done
echo "ok"
fi

if command -v clang-format; then
clang_ver=$(clang-format --version)
clang_min_ver=15
version_re=" version ([0-9]+)."
if [[ $clang_ver =~ $version_re ]]; then
if test "${BASH_REMATCH[1]}" -ge "${clang_min_ver}"; then
echo -n "checking clang-format... "
git ls-files '**.c' '**.cxx' '**.h' '**.hpp' | xargs clang-format --Werror --dry-run
echo "ok"
else
echo "notice: clang-format ${clang_ver}" is too old
fi
else
echo "failed to parse clang-format version ${clang_ver}" 1>&2
exit 1
fi
fi

echo -n 'grep-based static analysis... '
patterns=(glnx_fd_close)
for pat in "${patterns[@]}"; do
Expand Down
4 changes: 2 additions & 2 deletions src/libostree/ostree-sysroot.c
Original file line number Diff line number Diff line change
Expand Up @@ -2239,9 +2239,9 @@ ostree_sysroot_deployment_unlock (OstreeSysroot *self, OstreeDeployment *deploym
g_autofree char *devpath
= unlocked_state == OSTREE_DEPLOYMENT_UNLOCKED_DEVELOPMENT
? _ostree_sysroot_get_runstate_path (
deployment, _OSTREE_SYSROOT_DEPLOYMENT_RUNSTATE_FLAG_DEVELOPMENT)
deployment, _OSTREE_SYSROOT_DEPLOYMENT_RUNSTATE_FLAG_DEVELOPMENT)
: _ostree_sysroot_get_runstate_path (
deployment, _OSTREE_SYSROOT_DEPLOYMENT_RUNSTATE_FLAG_TRANSIENT);
deployment, _OSTREE_SYSROOT_DEPLOYMENT_RUNSTATE_FLAG_TRANSIENT);
g_autofree char *devpath_parent = dirname (g_strdup (devpath));

if (!glnx_shutil_mkdir_p_at (AT_FDCWD, devpath_parent, 0755, cancellable, error))
Expand Down

0 comments on commit 64ab098

Please sign in to comment.