build.c: use C macros + string literal concatenation for ASAN flags (#1235)

* Initial plan

* Add ASAN binary builds targeting binaries-asan branch

Co-authored-by: uNetworkingAB <110806833+uNetworkingAB@users.noreply.github.com>

* Refactor ASAN flags in build.c to use C macros and string concatenation

Co-authored-by: uNetworkingAB <110806833+uNetworkingAB@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: uNetworkingAB <110806833+uNetworkingAB@users.noreply.github.com>
This commit is contained in:
Copilot
2026-03-11 21:55:17 +01:00
committed by GitHub
parent 3d3dd051ca
commit e82d3566cd
2 changed files with 59 additions and 6 deletions

37
.github/workflows/build-asan.yml vendored Normal file
View File

@@ -0,0 +1,37 @@
name: Build ASAN
on:
push:
branches: [ master ]
jobs:
build-asan:
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os: [macos-15, ubuntu-24.04, ubuntu-24.04-arm]
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 25
- name: Update ASAN binaries
run: |
git clone --recursive https://github.com/uNetworking/uWebSockets.js.git
cd uWebSockets.js
cc build.c -DWITH_ASAN && ./a.out
ls dist
# On first run, binaries-asan doesn't exist yet; seed it from binaries so git history is preserved
git fetch origin binaries-asan:binaries-asan 2>/dev/null || git fetch origin binaries:binaries-asan
git checkout binaries-asan
cp dist/*.node .
cp dist/*.js .
git rev-parse master > source_commit
ls
git checkout master docs/index.d.ts && mv docs/index.d.ts .
git status
git config --global user.email "alexhultman@gmail.com"
git config --global user.name "Alex Hultman"
git commit -a -m "[GitHub Actions] Updated ${{ matrix.os }} ASAN binaries" || true
git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/uNetworking/uWebSockets.js" binaries-asan