diff --git a/hacking/clang-format/.clang-format b/.clang-format similarity index 100% rename from hacking/clang-format/.clang-format rename to .clang-format diff --git a/.clang-format-ignore b/.clang-format-ignore new file mode 100644 index 00000000..3dc1c74f --- /dev/null +++ b/.clang-format-ignore @@ -0,0 +1,4 @@ +*bitrotate* +*hash* +*xalloc-oversized* +*erofs_fs* diff --git a/.clang-format-include b/.clang-format-include new file mode 100644 index 00000000..e20fdf57 --- /dev/null +++ b/.clang-format-include @@ -0,0 +1,2 @@ +libcomposefs/**/* +tools/**/* diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 19d0260e..d8af6d2d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -6,6 +6,20 @@ permissions: actions: read jobs: + clang-format: + # To pick up a newer clang + runs-on: ubuntu-24.04 + name: "clang-format" + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install dependencies + run: sudo ./hacking/installdeps.sh + - name: Configure + run: meson setup build --prefix=/usr + - name: clang-format + run: ninja -C build clang-format-check + # This build doesn't enable ASAN, which e.g. makes it easier to use with Rust build: runs-on: ubuntu-latest name: "Build with ASAN" @@ -31,6 +45,12 @@ jobs: with: name: composefs.tar path: composefs.tar + - name: Upload log + uses: actions/upload-artifact@v4 + if: always() + with: + name: testlog-asan.txt + path: build/meson-logs/testlog.txt # This build doesn't enable ASAN, which e.g. makes it easier to use with Rust build-noasan: runs-on: ubuntu-latest @@ -51,6 +71,12 @@ jobs: with: name: composefs-noasan.tar path: composefs.tar + - name: Upload log + uses: actions/upload-artifact@v4 + if: always() + with: + name: testlog-noasan.txt + path: build/meson-logs/testlog.txt build-baseline: runs-on: ubuntu-latest name: "Build on Ubuntu Focal" @@ -148,19 +174,6 @@ jobs: run: cargo test - name: Rust (all features) run: cargo test -F v1_0_4 - clang-format: - runs-on: ubuntu-24.04 - steps: - - name: checkout - uses: actions/checkout@v2 - - name: install dependencies - run: | - sudo apt-get update -y - sudo apt-get install -y make clang-format - - name: check formatting - run: | - sudo docker build -t clang-format hacking/clang-format - sudo docker run --rm -w /src -v ${PWD}:/src clang-format distcheck: runs-on: ubuntu-latest steps: diff --git a/hacking/clang-format/Dockerfile b/hacking/clang-format/Dockerfile deleted file mode 100644 index 33bd6e49..00000000 --- a/hacking/clang-format/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM fedora:latest - -RUN dnf install -y git make clang-tools-extra - -WORKDIR /src - -COPY run-tests.sh /usr/local/bin -ENTRYPOINT /usr/local/bin/run-tests.sh diff --git a/hacking/clang-format/Makefile b/hacking/clang-format/Makefile deleted file mode 100644 index 6b2c58c7..00000000 --- a/hacking/clang-format/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -all: - -clang-format: - # do not format files that were copied into the source directory. - git ls-files ../../libcomposefs ../../tools | grep -Ee "\\.[hc]" | grep -v "bitrotate\|hash\|xalloc-oversized\|erofs_fs" | xargs clang-format -style=file -i - -.PHONY: clang-format diff --git a/hacking/clang-format/run-tests.sh b/hacking/clang-format/run-tests.sh deleted file mode 100755 index 81435202..00000000 --- a/hacking/clang-format/run-tests.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -set -e -x - -cd /src - -# Recent git complains that the directory is owned by someone else, -# which happens if we run it via a Dockefile with a volume mounted. -git config --global --add safe.directory "$(pwd)" - -make -C hacking/clang-format clang-format -git diff --ignore-submodules --exit-code