diff options
| author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2022-05-21 05:41:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-20 20:41:57 -0700 |
| commit | 045aacc38470114daa969c5751276c90a3158f9b (patch) | |
| tree | c52c1982858e63b843948d903c97d3765203dcce /.github/workflows | |
| parent | 4c97e17d3867418919800bdf4f8079601c79bc12 (diff) | |
| download | rneovim-045aacc38470114daa969c5751276c90a3158f9b.tar.gz rneovim-045aacc38470114daa969c5751276c90a3158f9b.tar.bz2 rneovim-045aacc38470114daa969c5751276c90a3158f9b.zip | |
ci: lint with uncrustify #18563
This lint job will ensure that the C codebase is properly formatted at
all times. This helps eliminate most of clint.py.
To save CI time, it's faster to manually compile uncrustify and cache
the binary instead of using homebrew (the apt-get package is too old).
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/ci.yml | 31 | ||||
| -rwxr-xr-x | .github/workflows/env.sh | 2 |
2 files changed, 33 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a98c6097c..4516d19fa6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,6 +66,32 @@ jobs: ninja-build \ pkg-config + + - name: Cache uncrustify + id: cache-uncrustify + uses: actions/cache@v3 + with: + path: ${{ env.CACHE_UNCRUSTIFY }} + key: ${{ env.UNCRUSTIFY_VERSION }} + + - name: Clone uncrustify + if: steps.cache-uncrustify.outputs.cache-hit != 'true' + uses: actions/checkout@v3 + with: + repository: uncrustify/uncrustify + ref: ${{ env.UNCRUSTIFY_VERSION }} + path: uncrustify + + - name: Install uncrustify + if: steps.cache-uncrustify.outputs.cache-hit != 'true' + run: | + source_dir=uncrustify + build_dir=uncrustify/build + cmake -S $source_dir -B $build_dir -G Ninja -DCMAKE_BUILD_TYPE=Release + cmake --build $build_dir + mkdir -p $HOME/.cache + cp $build_dir/uncrustify ${{ env.CACHE_UNCRUSTIFY }} + - name: Cache artifacts uses: actions/cache@v2 with: @@ -92,6 +118,11 @@ jobs: args: --check runtime/ - if: "!cancelled()" + name: uncrustify + run: | + ${{ env.CACHE_UNCRUSTIFY }} -c ./src/uncrustify.cfg -q --check $(find ./src/nvim -name "*.[ch]") >/dev/null + + - if: "!cancelled()" name: lualint run: ./ci/run_lint.sh lualint diff --git a/.github/workflows/env.sh b/.github/workflows/env.sh index fe7543510e..c3959ac104 100755 --- a/.github/workflows/env.sh +++ b/.github/workflows/env.sh @@ -19,6 +19,8 @@ NVIM_LOG_FILE=$GITHUB_WORKSPACE/build/.nvimlog VALGRIND_LOG=$GITHUB_WORKSPACE/build/log/valgrind-%p.log CACHE_NVIM_DEPS_DIR=$HOME/.cache/nvim-deps CACHE_MARKER=$HOME/.cache/nvim-deps/.ci_cache_marker +CACHE_UNCRUSTIFY=$HOME/.cache/uncrustify +UNCRUSTIFY_VERSION=uncrustify-0.75.0 CCACHE_BASEDIR=$GITHUB_WORKSPACE CCACHE_COMPRESS=1 CCACHE_SLOPPINESS=time_macros,file_macro |