mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
ci: introduce CI_LINT option
This will abort if lint programs are not found, and is meant primarily for the lint job in CI. Supersedes the REQUIRED argument in add_glob_target as it's a superior replacement by being a built-in solution.
This commit is contained in:
parent
4dc86477b6
commit
46e95909bf
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -48,7 +48,7 @@ jobs:
|
|||||||
cmake --build .deps
|
cmake --build .deps
|
||||||
|
|
||||||
- if: success() || failure() && steps.abort_job.outputs.status == 'success'
|
- if: success() || failure() && steps.abort_job.outputs.status == 'success'
|
||||||
run: cmake -B build -G Ninja
|
run: cmake -B build -G Ninja -D CI_LINT=ON
|
||||||
|
|
||||||
- if: "!cancelled()"
|
- if: "!cancelled()"
|
||||||
name: Determine if run should be aborted
|
name: Determine if run should be aborted
|
||||||
|
@ -229,11 +229,14 @@ endif()
|
|||||||
#
|
#
|
||||||
# Lint
|
# Lint
|
||||||
#
|
#
|
||||||
find_program(SHELLCHECK_PRG shellcheck)
|
option(CI_LINT "Abort if lint programs not found" OFF)
|
||||||
find_program(STYLUA_PRG stylua)
|
if(CI_LINT)
|
||||||
|
set(LINT_REQUIRED "REQUIRED")
|
||||||
|
endif()
|
||||||
|
find_program(SHELLCHECK_PRG shellcheck ${LINT_REQUIRED})
|
||||||
|
find_program(STYLUA_PRG stylua ${LINT_REQUIRED})
|
||||||
|
|
||||||
add_glob_target(
|
add_glob_target(
|
||||||
REQUIRED
|
|
||||||
TARGET lintlua-luacheck
|
TARGET lintlua-luacheck
|
||||||
COMMAND ${DEPS_BIN_DIR}/luacheck
|
COMMAND ${DEPS_BIN_DIR}/luacheck
|
||||||
FLAGS -q
|
FLAGS -q
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
# depends on the value of TOUCH_STRATEGY.
|
# depends on the value of TOUCH_STRATEGY.
|
||||||
#
|
#
|
||||||
# Options:
|
# Options:
|
||||||
# REQUIRED - Abort if COMMAND doesn't exist.
|
|
||||||
#
|
#
|
||||||
# Single value arguments:
|
# Single value arguments:
|
||||||
# TARGET - Name of the target
|
# TARGET - Name of the target
|
||||||
@ -53,7 +52,7 @@
|
|||||||
# files.
|
# files.
|
||||||
function(add_glob_target)
|
function(add_glob_target)
|
||||||
cmake_parse_arguments(ARG
|
cmake_parse_arguments(ARG
|
||||||
"REQUIRED"
|
""
|
||||||
"TARGET;COMMAND;GLOB_PAT;TOUCH_STRATEGY"
|
"TARGET;COMMAND;GLOB_PAT;TOUCH_STRATEGY"
|
||||||
"FLAGS;FILES;GLOB_DIRS;EXCLUDE"
|
"FLAGS;FILES;GLOB_DIRS;EXCLUDE"
|
||||||
${ARGN}
|
${ARGN}
|
||||||
@ -61,14 +60,8 @@ function(add_glob_target)
|
|||||||
|
|
||||||
if(NOT ARG_COMMAND)
|
if(NOT ARG_COMMAND)
|
||||||
add_custom_target(${ARG_TARGET})
|
add_custom_target(${ARG_TARGET})
|
||||||
if(ARG_REQUIRED)
|
add_custom_command(TARGET ${ARG_TARGET}
|
||||||
add_custom_command(TARGET ${ARG_TARGET}
|
COMMAND ${CMAKE_COMMAND} -E echo "${ARG_TARGET} SKIP: ${ARG_COMMAND} not found")
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo "${ARG_TARGET}: ${ARG_COMMAND} not found"
|
|
||||||
COMMAND false)
|
|
||||||
else()
|
|
||||||
add_custom_command(TARGET ${ARG_TARGET}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo "${ARG_TARGET} SKIP: ${ARG_COMMAND} not found")
|
|
||||||
endif()
|
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user