diff options
author | 2023-01-20 17:37:13 -0800 | |
---|---|---|
committer | 2023-01-27 16:23:30 -0800 | |
commit | ce6024cce46ad99ea7d6eed2692336a2bdb2da5c (patch) | |
tree | 96bc3f4818d90b8d0feb149143a4e76051f2d334 | |
parent | 2e1c7f5597e516133feaa5af2dc25c4794d8e113 (diff) | |
download | bun-ce6024cce46ad99ea7d6eed2692336a2bdb2da5c.tar.gz bun-ce6024cce46ad99ea7d6eed2692336a2bdb2da5c.tar.zst bun-ce6024cce46ad99ea7d6eed2692336a2bdb2da5c.zip |
wip
-rw-r--r-- | .github/workflows/bun-dependenies-build.yml | 119 | ||||
-rw-r--r-- | Dockerfile | 53 |
2 files changed, 132 insertions, 40 deletions
diff --git a/.github/workflows/bun-dependenies-build.yml b/.github/workflows/bun-dependenies-build.yml new file mode 100644 index 000000000..a604e6279 --- /dev/null +++ b/.github/workflows/bun-dependenies-build.yml @@ -0,0 +1,119 @@ +name: bun-dependencies +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + TEST_TAG: bun-test-dependencies + +on: + push: + branches: + - main + paths: + - "src/deps/**/*" + - "Makefile" + - "Dockerfile" + pull_request: + branches: + - main + paths: + - "src/deps/**/*" + - "Makefile" + - "Dockerfile" + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + dependencies: + name: ${{matrix.tag}} + runs-on: ${{matrix.runner}} + timeout-minutes: 90 + strategy: + matrix: + include: + - cpu: haswell + tag: linux-x64 + arch: x86_64 + build_arch: amd64 + runner: linux-amd64 + package_json_arch: x64 + webkit_url: "https://github.com/oven-sh/WebKit/releases/download/dec30/bun-webkit-linux-amd64-lto.tar.gz" + webkit_basename: "bun-webkit-linux-amd64-lto" + build_machine_arch: x86_64 + - cpu: westmere + tag: linux-x64-baseline + arch: x86_64 + build_arch: amd64 + package_json_arch: x64 + runner: linux-amd64 + webkit_url: "https://github.com/oven-sh/WebKit/releases/download/dec30/bun-webkit-linux-amd64-lto.tar.gz" + webkit_basename: "bun-webkit-linux-amd64-lto" + build_machine_arch: x86_64 + - cpu: native + tag: linux-aarch64 + arch: aarch64 + build_arch: arm64 + runner: linux-arm64 + package_json_arch: arm64 + webkit_url: "https://github.com/oven-sh/WebKit/releases/download/dec30/bun-webkit-linux-arm64-lto.tar.gz" + webkit_basename: "bun-webkit-linux-arm64-lto" + build_machine_arch: aarch64 + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - uses: docker/setup-buildx-action@v2 + id: buildx + with: + install: true + - name: Run + run: | + rm -rf ${{runner.temp}}/release + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - run: | + mkdir -p /tmp/.buildx-cache-${{matrix.tag}} + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + push: false + cache-from: type=local,src=/tmp/.buildx-cache-${{matrix.tag}}-compile-dependencies + cache-to: type=local,dest=/tmp/.buildx-cache-${{matrix.tag}}-compile-dependencies + build-args: | + ARCH=${{matrix.arch}} + BUILDARCH=${{matrix.build_arch}} + BUILD_MACHINE_ARCH=${{matrix.build_machine_arch}} + CPU_TARGET=${{matrix.cpu}} + WEBKIT_URL=${{matrix.webkit_url}} + GIT_SHA=${{github.sha}} + WEBKIT_BASENAME=${{matrix.webkit_basename}} + platforms: linux/${{matrix.build_arch}} + target: compile-dependencies + outputs: type=local,dest=${{runner.temp}}/dependencies + - name: Add package.json + run: | + cd ${{runner.temp}}/dependencies + echo '{ "name": "bun-dependencies-${{matrix.tag}}", "description": "Precompiled dependencies for building Bun" "version": "0.0.1-${{github.sha}}", "os": ["linux"], "cpu": ["${{matrix.package_json_arch}}"], "repository": "https://github.com/${{github.repository}}" }' > package.json + - uses: actions/setup-node@v3 + with: + node-version: "16.x" + registry-url: "https://registry.npmjs.org" + - name: Publish to npm + if: github.ref == 'refs/heads/main' + run: | + cd ${{runner.temp}}/dependencies + npm publish --tag next --access=public + - name: Pack dependencies + run: | + cd ${{runner.temp}}/dependencies + npm pack --pack-destination ${{runner.temp}}/dependencies + - name: Upload dependencies + uses: actions/upload-artifact@v2 + with: + name: bun-dependencies-${{matrix.tag}} + path: ${{runner.temp}}/dependencies/bun-dependencies-${{matrix.tag}}-0.0.1-${{github.sha}}.tgz diff --git a/Dockerfile b/Dockerfile index 479fb44be..35a230eb1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -586,43 +586,16 @@ CMD make headers \ -# FROM bun-test-base as test_base - -# ARG DEBIAN_FRONTEND=noninteractive -# ARG GITHUB_WORKSPACE=/build -# ARG ZIG_PATH=${GITHUB_WORKSPACE}/zig -# # Directory extracts to "bun-webkit" -# ARG WEBKIT_DIR=${GITHUB_WORKSPACE}/bun-webkit -# ARG BUN_RELEASE_DIR=${GITHUB_WORKSPACE}/bun-release -# ARG BUN_DEPS_OUT_DIR=${GITHUB_WORKSPACE}/bun-deps -# ARG BUN_DIR=${GITHUB_WORKSPACE}/bun - -# ARG BUILDARCH=amd64 -# RUN groupadd -r chromium && useradd -d ${BUN_DIR} -M -r -g chromium -G audio,video chromium \ -# && mkdir -p /home/chromium/Downloads && chown -R chromium:chromium /home/chromium - -# USER chromium -# WORKDIR $BUN_DIR - -# ENV NPM_CLIENT bun -# ENV PATH "${BUN_DIR}/packages/bun-linux-x64:${BUN_DIR}/packages/bun-linux-aarch64:$PATH" -# ENV CI 1 -# ENV BROWSER_EXECUTABLE /usr/bin/chromium - -# COPY ./test ${BUN_DIR}/test -# COPY Makefile ${BUN_DIR}/Makefile -# COPY package.json ${BUN_DIR}/package.json -# COPY .docker/run-test.sh ${BUN_DIR}/run-test.sh -# COPY ./bun.lockb ${BUN_DIR}/bun.lockb - -# # # We don't want to worry about architecture differences in this image -# COPY --from=release /opt/bun/bin/bun ${BUN_DIR}/packages/bun-linux-aarch64/bun -# COPY --from=release /opt/bun/bin/bun ${BUN_DIR}/packages/bun-linux-x64/bun - -# USER root -# RUN chgrp -R chromium ${BUN_DIR} && chmod g+rwx ${BUN_DIR} && chown -R chromium:chromium ${BUN_DIR} -# USER chromium - -# CMD [ "bash", "run-test.sh" ] - -# FROM release +FROM scratch as compile-dependencies + +COPY --from=zlib ${BUN_DEPS_OUT_DIR}/*.a / +COPY --from=libarchive ${BUN_DEPS_OUT_DIR}/*.a / +COPY --from=boringssl ${BUN_DEPS_OUT_DIR}/*.a / +COPY --from=lolhtml ${BUN_DEPS_OUT_DIR}/*.a / +COPY --from=mimalloc ${BUN_DEPS_OUT_DIR}/*.o / +COPY --from=picohttp ${BUN_DEPS_OUT_DIR}/*.o / +COPY --from=sqlite ${BUN_DEPS_OUT_DIR}/*.o / +COPY --from=tinycc ${BUN_DEPS_OUT_DIR}/*.a / +COPY --from=uws ${BUN_DEPS_OUT_DIR}/*.a / +COPY --from=uws ${BUN_DEPS_OUT_DIR}/*.o / +COPY --from=c-ares ${BUN_DEPS_OUT_DIR}/*.a /
\ No newline at end of file |