Skip to content

Commit

Permalink
Merge branch 'main' into user_npmrc
Browse files Browse the repository at this point in the history
  • Loading branch information
robertshuford authored Sep 26, 2024
2 parents ede87c7 + 7b058e2 commit b676c9d
Show file tree
Hide file tree
Showing 102 changed files with 4,205 additions and 4,720 deletions.
1,539 changes: 0 additions & 1,539 deletions .docker/chrome.json

This file was deleted.

14 changes: 0 additions & 14 deletions .docker/chromium.pref

This file was deleted.

8 changes: 0 additions & 8 deletions .docker/copy-bun-binary.sh

This file was deleted.

3 changes: 0 additions & 3 deletions .docker/debian.list

This file was deleted.

34 changes: 0 additions & 34 deletions .docker/dockerfile-common.sh

This file was deleted.

11 changes: 0 additions & 11 deletions .docker/pull.sh

This file was deleted.

47 changes: 0 additions & 47 deletions .docker/run-dockerfile.sh

This file was deleted.

9 changes: 0 additions & 9 deletions .docker/run-test.sh

This file was deleted.

5 changes: 0 additions & 5 deletions .docker/runner.sh

This file was deleted.

5 changes: 0 additions & 5 deletions .docker/unit-tests.sh

This file was deleted.

9 changes: 5 additions & 4 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ jobs:
- name: Install LLVM
run: |
curl -fsSL https://apt.llvm.org/llvm.sh | sudo bash -s -- ${{ env.LLVM_VERSION_MAJOR }} all
sudo apt-get update
sudo apt-get install -y ninja-build ccache
- name: Format
- name: Clang Format
env:
ENABLE_CCACHE: OFF
LLVM_VERSION: ${{ env.LLVM_VERSION }}
run: |
bun run clang-format -DLLVM_VERSION=${{ env.LLVM_VERSION }}
bun run clang-format:diff
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: clang-tidy

permissions:
contents: write

on:
workflow_call:
workflow_dispatch:
pull_request:
paths:
- ".github/workflows/clang-tidy.yml"
- ".clang-tidy"
- "package.json"
- "scripts/**"
- "cmake/**"
- "src/**/*.c"
- "src/**/*.cpp"
- "src/**/*.h"
- "packages/**/*.c"
- "packages/**/*.cpp"
- "packages/**/*.h"

env:
BUN_VERSION: "1.1.27"
LLVM_VERSION: "18.1.8"
LLVM_VERSION_MAJOR: "18"

jobs:
clang-tidy:
name: clang-tidy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
.github
.clang-tidy
package.json
scripts
cmake
src
packages
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Install LLVM
run: |
curl -fsSL https://apt.llvm.org/llvm.sh | sudo bash -s -- ${{ env.LLVM_VERSION_MAJOR }} all
- name: Clang Tidy
env:
ENABLE_CCACHE: OFF
LLVM_VERSION: ${{ env.LLVM_VERSION }}
run: |
bun run clang-tidy:diff
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "`bun run clang-tidy`"
7 changes: 5 additions & 2 deletions .github/workflows/prettier-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ jobs:
- name: Setup Dependencies
run: |
bun install
- name: Format
- name: Prettier Format
env:
ENABLE_CCACHE: OFF
SKIP_LLVM: ON
run: |
bun run prettier:extra
bun run prettier:diff
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/zig-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ jobs:
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Zig Format
env:
ENABLE_CCACHE: OFF
SKIP_LLVM: ON
run: |
bun run zig-format -DENABLE_CCACHE=OFF -DSKIP_LLVM=ON
bun run zig-format:diff
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,15 @@
"cmake.configureOnOpen": false,
"C_Cpp.errorSquiggles": "enabled",
"[cpp]": {
"editor.tabSize": 4,
"editor.defaultFormatter": "xaver.clang-format",
},
"[c]": {
"editor.tabSize": 4,
"editor.defaultFormatter": "xaver.clang-format",
},
"[h]": {
"editor.tabSize": 4,
"editor.defaultFormatter": "xaver.clang-format",
},
"clangd.arguments": ["-header-insertion=never"],
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ include(CompilerFlags)

# --- Tools ---

include(SetupGit)
include(SetupBuildkite)
include(SetupBun)
include(SetupEsbuild)
Expand All @@ -43,4 +44,6 @@ include(BuildBun)
# --- Analysis ---

include(RunClangFormat)
include(RunClangTidy)
include(RunZigFormat)
include(RunPrettier)
13 changes: 10 additions & 3 deletions cmake/Globals.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,19 @@ optionx(CACHE_STRATEGY "read-write|read-only|write-only|none" "The strategy to u
optionx(CI BOOL "If CI is enabled" DEFAULT OFF)

if(CI)
set(DEFAULT_VENDOR_PATH ${CACHE_PATH}/vendor)
set(WARNING FATAL_ERROR)
else()
set(DEFAULT_VENDOR_PATH ${CWD}/vendor)
set(WARNING WARNING)
endif()

optionx(VENDOR_PATH FILEPATH "The path to the vendor directory" DEFAULT ${DEFAULT_VENDOR_PATH})
# TODO: This causes flaky zig builds in CI, so temporarily disable it.
# if(CI)
# set(DEFAULT_VENDOR_PATH ${CACHE_PATH}/vendor)
# else()
# set(DEFAULT_VENDOR_PATH ${CWD}/vendor)
# endif()

optionx(VENDOR_PATH FILEPATH "The path to the vendor directory" DEFAULT ${CWD}/vendor)
optionx(TMP_PATH FILEPATH "The path to the temporary directory" DEFAULT ${BUILD_PATH}/tmp)

optionx(FRESH BOOL "Set when --fresh is used" DEFAULT OFF)
Expand Down
34 changes: 34 additions & 0 deletions cmake/analysis/RunClangFormat.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# https://clang.llvm.org/docs/ClangFormat.html

find_command(
VARIABLE
CLANG_FORMAT_PROGRAM
Expand Down Expand Up @@ -35,3 +37,35 @@ register_command(
${CLANG_FORMAT_SOURCES}
ALWAYS_RUN
)

if(GIT_CHANGED_SOURCES)
set(CLANG_FORMAT_CHANGED_SOURCES)
foreach(source ${CLANG_FORMAT_SOURCES})
list(FIND GIT_CHANGED_SOURCES ${source} index)
if(NOT ${index} EQUAL -1)
list(APPEND CLANG_FORMAT_CHANGED_SOURCES ${source})
endif()
endforeach()
endif()

if(CLANG_FORMAT_CHANGED_SOURCES)
set(CLANG_FORMAT_DIFF_COMMAND ${CLANG_FORMAT_PROGRAM}
-i # edits files in-place
--verbose
${CLANG_FORMAT_CHANGED_SOURCES}
)
else()
set(CLANG_FORMAT_DIFF_COMMAND ${CMAKE_COMMAND} -E echo "No changed files for clang-format")
endif()

register_command(
TARGET
clang-format-diff
COMMENT
"Running clang-format on changed files"
COMMAND
${CLANG_FORMAT_DIFF_COMMAND}
CWD
${BUILD_PATH}
ALWAYS_RUN
)
Loading

0 comments on commit b676c9d

Please sign in to comment.