name: Build Linux x64 [musl] on: workflow_dispatch: workflow_call: inputs: build_timestamp: required: true type: string jobs: linux-musl-x64: runs-on: ubuntu-24.04 container: alpine:edge steps: - name: Install dependencies run: | apk add --no-cache git clang lld llvm meson ninja cmake pkgconf curl npm nodejs \ musl-dev openssl-dev openssl-libs-static libsodium-dev libsodium-static \ util-linux-dev util-linux-static linux-headers libunwind-dev libunwind-static \ tar zstd git config --global --add safe.directory "$GITHUB_WORKSPACE" - uses: actions/checkout@v4 with: submodules: recursive - name: Cache native dependencies id: cache-deps uses: actions/cache@v4 with: path: ~/deps-cache key: deps-linux-musl-x64-llhttp-9.2.1-libuv-1.51.0-zlib-1.3.1-v1 - name: Build llhttp if: steps.cache-deps.outputs.cache-hit != 'true' run: | export CFLAGS="-Os -flto" export AR=llvm-ar export RANLIB=llvm-ranlib git clone --depth 1 --branch release/v9.2.1 https://github.com/nodejs/llhttp.git /tmp/llhttp cd /tmp/llhttp CC=clang cmake -G Ninja -B build -DCMAKE_INSTALL_PREFIX=$HOME/deps-cache -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON -DCMAKE_BUILD_TYPE=MinSizeRel cmake --build build cmake --install build - name: Build libuv if: steps.cache-deps.outputs.cache-hit != 'true' run: | export CFLAGS="-Os -flto" export AR=llvm-ar export RANLIB=llvm-ranlib git clone --depth 1 --branch v1.51.0 https://github.com/libuv/libuv.git /tmp/libuv cd /tmp/libuv CC=clang cmake -G Ninja -B build -DCMAKE_INSTALL_PREFIX=$HOME/deps-cache -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF -DCMAKE_BUILD_TYPE=MinSizeRel cmake --build build cmake --install build - name: Build zlib if: steps.cache-deps.outputs.cache-hit != 'true' run: | export CFLAGS="-Os -flto" export AR=llvm-ar export RANLIB=llvm-ranlib git clone --depth 1 --branch v1.3.1 https://github.com/madler/zlib.git /tmp/zlib cd /tmp/zlib CC=clang cmake -G Ninja -B build -DCMAKE_INSTALL_PREFIX=$HOME/deps-cache -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=MinSizeRel cmake --build build cmake --install build rm -f $HOME/deps-cache/lib/libz.so* - run: npm ci working-directory: src/tools - name: Install Rust run: | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host x86_64-unknown-linux-musl echo "$HOME/.cargo/bin" >> $GITHUB_PATH - uses: actions/cache@v4 with: path: | ~/.cargo/registry ~/.cargo/git build/oxc-target key: cargo-linux-musl-amd64-${{ hashFiles('src/strip/Cargo.lock') }} restore-keys: cargo-linux-musl-amd64- - name: Cache meson build uses: actions/cache@v4 with: path: | vendor/*/ build/ !build/oxc-target key: meson-linux-musl-x64-${{ hashFiles('vendor/*.wrap', 'meson.build', 'src/**/*.c', 'src/**/*.h') }} restore-keys: meson-linux-musl-x64- - run: | export PKG_CONFIG_PATH="$HOME/deps-cache/lib/pkgconfig:$PKG_CONFIG_PATH" export CMAKE_PREFIX_PATH="$HOME/deps-cache:$CMAKE_PREFIX_PATH" CC=clang CC_LD=lld meson setup build --prefer-static -Db_lto=true --buildtype=release -Dstatic_link=true -Dbuild_timestamp=${{ inputs.build_timestamp }} && meson compile -C build - run: llvm-strip build/ant - uses: actions/upload-artifact@v4 with: name: ant-linux-x64-musl path: build/ant