-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'yscope/main' into enable-exception
# Conflicts: # Taskfile.yml
- Loading branch information
Showing
10 changed files
with
203 additions
and
302 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: "lint" | ||
|
||
on: | ||
pull_request: | ||
types: ["opened", "reopened", "synchronize"] | ||
push: | ||
schedule: | ||
# Run daily at 00:15 UTC (the 15 is to avoid periods of high load) | ||
- cron: "15 0 * * *" | ||
workflow_dispatch: | ||
|
||
permissions: | ||
# So the workflow can cancel in-progress jobs | ||
contents: "write" | ||
|
||
concurrency: | ||
group: "${{github.workflow}}-${{github.ref}}" | ||
# Cancel in-progress jobs for efficiency | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint: | ||
strategy: | ||
matrix: | ||
os: ["macos-latest", "ubuntu-latest"] | ||
runs-on: "${{matrix.os}}" | ||
steps: | ||
- uses: "actions/checkout@v4" | ||
with: | ||
submodules: "recursive" | ||
|
||
- uses: "actions/setup-python@v5" | ||
with: | ||
python-version: "3.8" | ||
|
||
- name: "Install task" | ||
run: "npm install -g @go-task/cli" | ||
|
||
- if: "matrix.os == 'macos-latest'" | ||
name: "Install coreutils (for md5sum)" | ||
run: "brew install coreutils" | ||
|
||
- name: "Log tool versions" | ||
run: |- | ||
md5sum --version | ||
python --version | ||
tar --version | ||
task --version | ||
- name: "Run lint task" | ||
run: "task lint:check" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,10 @@ build | |
cmake-build-* | ||
dist | ||
|
||
# Generated lint configs | ||
.clang-format | ||
.clang-tidy | ||
|
||
# IDEs | ||
.idea | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Lock to v18.x until we can upgrade our code to meet v19's formatting standards. | ||
clang-format~=18.1 | ||
yamllint>=1.35.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
version: "3" | ||
|
||
vars: | ||
G_SRC_CLP_FFI_JS_DIR: "{{.ROOT_DIR}}/src/clp_ffi_js" | ||
G_LINT_VENV_DIR: "{{.G_BUILD_DIR}}/lint-venv" | ||
|
||
tasks: | ||
check: | ||
cmds: | ||
- task: "cpp-check" | ||
- task: "yml-check" | ||
|
||
fix: | ||
cmds: | ||
- task: "cpp-fix" | ||
- task: "yml-fix" | ||
|
||
cpp-configs: | ||
cmd: "{{.ROOT_DIR}}/tools/yscope-dev-utils/lint-configs/symlink-cpp-lint-configs.sh" | ||
|
||
cpp-check: | ||
sources: &cpp_source_files | ||
- "{{.G_SRC_CLP_FFI_JS_DIR}}/.clang-format" | ||
- "{{.G_SRC_CLP_FFI_JS_DIR}}/**/*.cpp" | ||
- "{{.G_SRC_CLP_FFI_JS_DIR}}/**/*.h" | ||
- "{{.G_SRC_CLP_FFI_JS_DIR}}/**/*.hpp" | ||
- "{{.TASKFILE}}" | ||
- "tools/yscope-dev-utils/lint-configs/.clang-format" | ||
cmds: | ||
- task: "clang-format" | ||
vars: | ||
FLAGS: "--dry-run" | ||
|
||
cpp-fix: | ||
sources: *cpp_source_files | ||
cmds: | ||
- task: "clang-format" | ||
vars: | ||
FLAGS: "-i" | ||
|
||
yml: | ||
aliases: | ||
- "yml-check" | ||
- "yml-fix" | ||
deps: ["venv"] | ||
cmds: | ||
- |- | ||
. "{{.G_LINT_VENV_DIR}}/bin/activate" | ||
yamllint \ | ||
--config-file "{{.ROOT_DIR}}/tools/yscope-dev-utils/lint-configs/.yamllint.yml" \ | ||
--strict \ | ||
.github \ | ||
lint-tasks.yml \ | ||
Taskfile.yml | ||
clang-format: | ||
internal: true | ||
requires: | ||
vars: ["FLAGS"] | ||
deps: ["cpp-configs", "venv"] | ||
cmds: | ||
- |- | ||
. "{{.G_LINT_VENV_DIR}}/bin/activate" | ||
find "{{.G_SRC_CLP_FFI_JS_DIR}}" \ | ||
-type f \ | ||
\( -iname "*.cpp" -o -iname "*.h" -o -iname "*.hpp" \) \ | ||
-print0 | \ | ||
xargs -0 clang-format {{.FLAGS}} -Werror | ||
venv: | ||
internal: true | ||
vars: | ||
CHECKSUM_FILE: "{{.G_BUILD_DIR}}/{{.TASK | replace \":\" \"#\"}}.md5" | ||
OUTPUT_DIR: "{{.G_LINT_VENV_DIR}}" | ||
sources: | ||
- "{{.ROOT_DIR}}/Taskfile.yml" | ||
- "{{.TASKFILE}}" | ||
- "lint-requirements.txt" | ||
generates: ["{{.CHECKSUM_FILE}}"] | ||
deps: | ||
- ":init" | ||
- task: ":utils:validate-checksum" | ||
vars: | ||
CHECKSUM_FILE: "{{.CHECKSUM_FILE}}" | ||
DATA_DIR: "{{.OUTPUT_DIR}}" | ||
cmds: | ||
- task: ":utils:create-venv" | ||
vars: | ||
LABEL: "lint" | ||
OUTPUT_DIR: "{{.OUTPUT_DIR}}" | ||
REQUIREMENTS_FILE: "lint-requirements.txt" | ||
# This command must be last | ||
- task: ":utils:compute-checksum" | ||
vars: | ||
DATA_DIR: "{{.OUTPUT_DIR}}" | ||
OUTPUT_FILE: "{{.CHECKSUM_FILE}}" |
Oops, something went wrong.