diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6c5c34f13..3ac70e1e9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,27 +4,85 @@ on: branches: [ master ] jobs: build: - runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - os: [windows-latest, macos-15, ubuntu-24.04, ubuntu-24.04-arm] + config: + - { + name: "Windows Latest", + os: windows-latest + } + - { + name: "macOS 15", + os: macos-15 + } + - { + name: "Ubuntu 22.04", + os: ubuntu-latest, + container_image: "ubuntu:22.04" + } + - { + name: "Ubuntu 22.04 ARM64", + os: ubuntu-24.04-arm, + container_image: "ubuntu:22.04" + } + + runs-on: ${{ matrix.config.os }} + container: + image: ${{ matrix.config.container_image }} + steps: - name: Setup Windows - if: matrix.os == 'windows-latest' + if: matrix.config.os == 'windows-latest' uses: ilammy/msvc-dev-cmd@v1 - name: Setup NASM for Windows - if: matrix.os == 'windows-latest' + if: matrix.config.os == 'windows-latest' uses: ilammy/setup-nasm@v1.2.1 + - name: Setup build tools for containers + if: matrix.config.container_image != null + env: + # Prevent tzdata (pulled in by cmake/build-essential) from launching an + # interactive timezone prompt that hangs the build with no TTY attached. + DEBIAN_FRONTEND: noninteractive + TZ: Etc/UTC + run: | + apt-get update + apt-get install -y build-essential git libssl-dev zlib1g-dev file zip curl jq cmake + # clang-16 is not in Ubuntu 22.04 (jammy), whose newest is clang-15. + # Add the official LLVM apt repo to install it. + . /etc/os-release + apt-get install -y wget gnupg + wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor -o /usr/share/keyrings/llvm.gpg + echo "deb [signed-by=/usr/share/keyrings/llvm.gpg] http://apt.llvm.org/$VERSION_CODENAME/ llvm-toolchain-$VERSION_CODENAME-16 main" > /etc/apt/sources.list.d/llvm.list + apt-get update + apt-get install -y clang-16 + # Ubuntu 22.04's bare "clang" is clang-14, which lacks __builtin_source_location + # and cannot compile Node 26's V8 headers (std::source_location). Force clang-16. + update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 100 + update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 100 + echo "::group::Environment info" + echo "--- distro ---" + cat /etc/os-release + echo "--- architecture ---" + uname -a + dpkg --print-architecture + echo "--- glibc ---" + # ldd --version prints the glibc version on the first line; getconf gives it raw. + ldd --version | head -n 1 + getconf GNU_LIBC_VERSION + echo "--- compiler ---" + clang --version + clang++ --version + echo "::endgroup::" - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 26 - name: Update binaries run: | - git clone --recursive https://github.com/uNetworking/uWebSockets.js.git + git clone --recursive https://github.com/uNetworking/uWebSockets.js.git -b master cd uWebSockets.js - ${{ matrix.os == 'windows-latest' && 'nmake' || 'make' }} + ${{ matrix.config.os == 'windows-latest' && 'nmake' || 'make' }} ls dist cd tests && npm install ws && node smoke.js && cd .. ls dist @@ -32,11 +90,11 @@ jobs: git checkout binaries cp dist/*.node . cp dist/*.js . - git rev-parse master > source_commit + git rev-parse origin/master > source_commit ls - ${{ matrix.os != 'windows-latest' && 'git checkout master docs/index.d.ts && mv docs/index.d.ts .' || '' }} + ${{ matrix.config.os != 'windows-latest' && '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 }} binaries" || true + git commit -a -m "[GitHub Actions] Updated ${{ matrix.config.os }} binaries" || true git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/uNetworking/uWebSockets.js" binaries diff --git a/build.c b/build.c index 9644984ff..fad5fb4cb 100644 --- a/build.c +++ b/build.c @@ -213,8 +213,8 @@ int main() { #else /* Linux does not cross-compile but picks whatever arch the host is on (we run on both x64 and ARM64) */ - build("clang-18", - "clang++-18", + build("clang", + "clang++", LINUX_LINK_EXTRAS, OS, arch);