Skip to content

Commit b2f2260

Browse files
authored
Merge branch 'main' into add-all-wasi-hostcalls
2 parents f3d5c5a + f3f9969 commit b2f2260

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1257
-1040
lines changed

.bazelrc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ build --action_env=PATH
1010
build:clang --action_env=BAZEL_COMPILER=clang
1111
build:clang --action_env=CC=clang
1212
build:clang --action_env=CXX=clang++
13+
build:clang --copt -Wno-pragma-once-outside-header --cxxopt -Wno-pragma-once-outside-header
1314

1415
# Common flags for Clang sanitizers.
1516
build:clang-xsan --config=clang
@@ -54,6 +55,7 @@ build:clang-tsan --config=clang-xsan
5455
build:clang-tsan --copt -DTHREAD_SANITIZER=1
5556
build:clang-tsan --copt -fsanitize=thread
5657
build:clang-tsan --linkopt -fsanitize=thread
58+
build:clang-tsan --test_env=TSAN_OPTIONS=suppressions=bazel/tsan_suppressions.txt
5759

5860
# Use Clang-Tidy tool.
5961
build:clang-tidy --config=clang
@@ -66,24 +68,22 @@ build:gcc --action_env=BAZEL_COMPILER=gcc
6668
build:gcc --action_env=CC=gcc
6769
build:gcc --action_env=CXX=g++
6870

69-
# Use Zig C/C++ compiler.
70-
build:zig-cc --incompatible_enable_cc_toolchain_resolution
71-
build:zig-cc --extra_toolchains @zig_sdk//:aarch64-linux-gnu.2.28_toolchain
72-
build:zig-cc --extra_toolchains @zig_sdk//:x86_64-linux-gnu.2.28_toolchain
73-
build:zig-cc --host_copt=-fno-sanitize=undefined
71+
build:hermetic-llvm --incompatible_enable_cc_toolchain_resolution
72+
build:hermetic-llvm --action_env BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
73+
build:hermetic-llvm --extra_toolchains @emsdk//emscripten_toolchain:cc-toolchain-wasm
7474

75-
# Use Zig C/C++ compiler (cross-compile to Linux/aarch64).
76-
build:zig-cc-linux-aarch64 --config=zig-cc
77-
build:zig-cc-linux-aarch64 --platforms @zig_sdk//:linux_aarch64_platform
78-
build:zig-cc-linux-aarch64 --run_under=qemu-aarch64-static
79-
build:zig-cc-linux-aarch64 --test_env=QEMU_LD_PREFIX=/usr/aarch64-linux-gnu/
75+
build:hermetic-llvm-macos --config=hermetic-llvm
76+
# Below flags mitigate https://github.com/bazel-contrib/toolchains_llvm/pull/229.
77+
build:hermetic-llvm-macos --features=-libtool
78+
build:hermetic-llvm-macos --features=-supports_dynamic_linker
8079

8180
build --enable_platform_specific_config
8281

83-
# Use C++17.
84-
build:linux --cxxopt=-std=c++17
85-
build:macos --cxxopt=-std=c++17
86-
build:windows --cxxopt="/std:c++17"
82+
# Use C++20.
83+
build:linux --cxxopt=-std=c++20 --host_cxxopt=-std=c++20
84+
build:macos --cxxopt=-std=c++20 --host_cxxopt=-std=c++20
85+
build:windows --cxxopt="/std:c++20" --host_cxxopt="/std:c++20"
86+
8787

8888
# Enable symlinks and runfiles on Windows (enabled by default on other platforms).
8989
startup --windows_enable_symlinks

.clang-tidy

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,38 @@
11
Checks: clang-*,
2+
-clang-analyzer-core.CallAndMessage,
23
-clang-analyzer-optin.portability.UnixAPI,
34
-clang-analyzer-unix.Malloc,
45
-clang-diagnostic-pragma-once-outside-header,
6+
-clang-diagnostic-builtin-macro-redefined,
57
cppcoreguidelines-pro-type-member-init,
68
cppcoreguidelines-pro-type-static-cast-downcast,
79
misc-*,
810
-misc-non-private-member-variables-in-classes,
11+
-misc-use-anonymous-namespace,
12+
-misc-const-correctness,
13+
-misc-include-cleaner,
14+
-misc-unused-parameters,
915
modernize-*,
1016
-modernize-avoid-c-arrays,
1117
-modernize-use-trailing-return-type,
18+
-modernize-return-braced-init-list,
19+
-modernize-use-default-member-init,
20+
-modernize-type-traits,
21+
-modernize-use-emplace,
1222
llvm-include-order,
1323
performance-*,
1424
-performance-no-int-to-ptr,
25+
-performance-avoid-endl,
1526
portability-*,
1627
readability-*,
1728
-readability-convert-member-functions-to-static,
1829
-readability-function-cognitive-complexity,
1930
-readability-magic-numbers,
2031
-readability-make-member-function-const,
2132
-readability-simplify-boolean-expr,
33+
-readability-identifier-length,
34+
-readability-container-data-pointer,
35+
-readability-redundant-casting,
36+
-readability-avoid-return-with-void-value,
2237

2338
WarningsAsErrors: '*'

.github/workflows/format.yml

Lines changed: 37 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ on:
3131
schedule:
3232
- cron: '0 0 * * *'
3333

34+
workflow_dispatch:
35+
3436
concurrency:
3537

3638
group: ${{ github.head_ref || github.run_id }}-${{ github.workflow }}
@@ -41,7 +43,7 @@ jobs:
4143
addlicense:
4244
name: verify licenses
4345

44-
runs-on: ubuntu-20.04
46+
runs-on: ubuntu-24.04-16core
4547

4648
steps:
4749
- uses: actions/checkout@v2
@@ -61,7 +63,7 @@ jobs:
6163
buildifier:
6264
name: check format with buildifier
6365

64-
runs-on: ubuntu-20.04
66+
runs-on: ubuntu-24.04-16core
6567

6668
steps:
6769
- uses: actions/checkout@v2
@@ -99,73 +101,64 @@ jobs:
99101
clang_format:
100102
name: check format with clang-format
101103

102-
runs-on: ubuntu-20.04
104+
runs-on: ubuntu-24.04-16core
103105

104106
steps:
105107
- uses: actions/checkout@v2
106108

107109
- name: Install dependencies (Linux)
108-
run: sudo apt update -y && sudo apt install -y clang-format-12
110+
run: sudo apt update -y && sudo apt install -y clang-format-18
109111

110112
- name: Format (clang-format)
111113
run: |
112-
find . -name "*.h" -o -name "*.cc" -o -name "*.proto" | grep -v ".pb." | xargs -n1 clang-format-12 -i
114+
find . -name "*.h" -o -name "*.cc" -o -name "*.proto" | grep -v ".pb." | xargs -n1 clang-format-18 -i
113115
git diff --exit-code
114116
115117
clang_tidy:
116118
name: check format with clang-tidy
117119

118-
runs-on: ubuntu-20.04
120+
runs-on: ubuntu-24.04-16core
119121

120122
steps:
121123
- uses: actions/checkout@v2
122124

123125
- name: Install dependencies (Linux)
124-
run: sudo apt update -y && sudo apt install -y clang-tidy-12 lld-12 && sudo ln -sf /usr/bin/lld-12 /usr/bin/lld
125-
126-
- name: Bazel cache
127-
uses: PiotrSikora/cache@v2.1.7-with-skip-cache
126+
run: sudo apt update -y && sudo apt install -y clang-tidy-18 lld-18 && sudo ln -sf /usr/bin/lld-18 /usr/bin/lld
127+
128+
- name: set cache name
129+
id: vars
130+
# The cache tag consists of the following parts:
131+
# * clang-tidy- prefix
132+
# * matrix.name, which separates the cache for each build type.
133+
# * hash of WORKSPACE, .bazelrc, and .bazelversion, which is
134+
# purely to differentiate caches for substantial changes in bazel.
135+
# * github.sha, which is the commit hash of the commit used to generate
136+
# the cache entry.
137+
run: echo "CACHE_TAG=clang-tidy-${{ matrix.name }}-${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion') }}" >> "$GITHUB_OUTPUT"
138+
139+
- name: bazel cache
140+
uses: actions/cache/restore@v3
128141
with:
129-
path: |
130-
~/.cache/bazel
131-
key: clang_tidy-${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/dependencies.bzl', 'bazel/repositories.bzl', 'bazel/cargo/wasmsign/remote/crates.bzl') }}
142+
path: /tmp/bazel/cache
143+
key: ${{ steps.vars.outputs.CACHE_TAG }}-${{ github.sha }}
144+
restore-keys: |
145+
${{ steps.vars.outputs.CACHE_TAG }}-${{ github.sha }}
146+
${{ steps.vars.outputs.CACHE_TAG }}-
147+
clang-tidy-${{ matrix.name }}-
148+
clang-tidy-
132149
133150
- name: Bazel build
134151
run: >
135152
bazel build
136153
--config clang-tidy
137154
--define engine=multi
155+
--disk_cache /tmp/bazel/cache
138156
--copt=-DPROXY_WASM_VERIFY_WITH_ED25519_PUBKEY=\"$(xxd -p -c 256 test/test_data/signature_key1.pub | cut -b9-)\"
139157
//...
140158
141-
- name: Skip Bazel cache update
142-
if: ${{ github.ref != 'refs/heads/main' }}
143-
run: echo "CACHE_SKIP_SAVE=true" >> $GITHUB_ENV
144-
145-
- name: Cleanup Bazel cache
146-
if: ${{ github.ref == 'refs/heads/main' }}
147-
run: |
148-
export OUTPUT=$(${{ matrix.run_under }} bazel info output_base)
149-
echo "===== BEFORE ====="
150-
du -s ${OUTPUT}/external/* $(dirname ${OUTPUT})/* | sort -rn | head -20
151-
# BoringSSL's test data (90 MiB).
152-
rm -rf ${OUTPUT}/external/boringssl/crypto_test_data.cc
153-
rm -rf ${OUTPUT}/external/boringssl/src/crypto/*/test/
154-
rm -rf ${OUTPUT}/external/boringssl/src/third_party/wycheproof_testvectors/
155-
# LLVM's tests (500 MiB).
156-
rm -rf ${OUTPUT}/external/llvm*/test/
157-
# V8's tests (100 MiB).
158-
if [ -d "${OUTPUT}/external/v8/test/torque" ]; then
159-
mv ${OUTPUT}/external/v8/test/torque ${OUTPUT}/external/v8/test_torque
160-
rm -rf ${OUTPUT}/external/v8/test/*
161-
mv ${OUTPUT}/external/v8/test_torque ${OUTPUT}/external/v8/test/torque
162-
fi
163-
# Unnecessary CMake tools (65 MiB).
164-
rm -rf ${OUTPUT}/external/cmake-*/bin/{ccmake,cmake-gui,cpack,ctest}
165-
# Distfiles for Rust toolchains (350 MiB).
166-
rm -rf ${OUTPUT}/external/rust_*/*.tar.gz
167-
# Bazel's repository cache (650-800 MiB) and install base (155 MiB).
168-
rm -rf ${OUTPUT}/../cache
169-
rm -rf ${OUTPUT}/../install
170-
echo "===== AFTER ====="
171-
du -s ${OUTPUT}/external/* $(dirname ${OUTPUT})/* | sort -rn | head -20
159+
- name: save bazel cache
160+
uses: actions/cache/save@v3
161+
if: always()
162+
with:
163+
path: /tmp/bazel/cache
164+
key: ${{ steps.vars.outputs.CACHE_TAG }}-${{ github.sha }}

0 commit comments

Comments
 (0)