diff options
author | 2023-01-27 19:25:03 -0800 | |
---|---|---|
committer | 2023-01-27 19:25:03 -0800 | |
commit | a7e666f8180b6433211da3469853e1f504e63e33 (patch) | |
tree | 74c36badba943b2e524231b627ae39f204637d04 | |
parent | d46c8d2fc8be1eec9df69b35afd8560fcf23d61e (diff) | |
download | bun-a7e666f8180b6433211da3469853e1f504e63e33.tar.gz bun-a7e666f8180b6433211da3469853e1f504e63e33.tar.zst bun-a7e666f8180b6433211da3469853e1f504e63e33.zip |
wip
-rw-r--r-- | .github/workflows/bun-dependenies-build.yml | 130 | ||||
-rw-r--r-- | .github/workflows/bun-linux-build.yml | 123 | ||||
-rw-r--r-- | Dockerfile | 33 | ||||
-rw-r--r-- | package.json | 5 |
4 files changed, 154 insertions, 137 deletions
diff --git a/.github/workflows/bun-dependenies-build.yml b/.github/workflows/bun-dependenies-build.yml deleted file mode 100644 index 320412592..000000000 --- a/.github/workflows/bun-dependenies-build.yml +++ /dev/null @@ -1,130 +0,0 @@ -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: big-ubuntu - 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: nehalem - tag: linux-x64-baseline - arch: x86_64 - build_arch: amd64 - package_json_arch: x64 - runner: big-ubuntu - 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-arm64 - 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' - env: - NODE_AUTH_TOKEN: ${{secrets.BUN_DEPENDENCIES_NPM_TOKEN}} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - cd ${{runner.temp}}/dependencies - npm publish --tag canary --access=public - - name: Publish to npm - if: github.ref == 'refs/heads/main' - env: - NODE_AUTH_TOKEN: ${{secrets.BUN_DEPENDENCIES_NPM_TOKEN}} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - 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/.github/workflows/bun-linux-build.yml b/.github/workflows/bun-linux-build.yml index b670085d6..0ceed7b60 100644 --- a/.github/workflows/bun-linux-build.yml +++ b/.github/workflows/bun-linux-build.yml @@ -116,6 +116,107 @@ jobs: with: name: bun-obj-${{ matrix.tag }} path: ${{runner.temp}}/release/bun.o + linux-dependencies-build: + name: Dependencies ${{matrix.tag}} + runs-on: ${{matrix.runner}} + strategy: + fail-fast: false + matrix: + include: + - cpu: haswell + tag: linux-x64 + arch: x86_64 + build_arch: amd64 + runner: big-ubuntu + 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: nehalem + tag: linux-x64-baseline + arch: x86_64 + build_arch: amd64 + runner: big-ubuntu + 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 + # 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 }} + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ runner.os }}-ccache-${{ matrix.tag }}-dependencies + restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}-dependencies + - name: Build and push + uses: docker/build-push-action@v3 + if: runner.arch == 'X64' + with: + context: . + push: false + cache-from: type=gha + cache-to: type=gha,mode=min + build-args: | + ARCH=${{ matrix.arch }} + BUILDARCH=amd64 + BUILD_MACHINE_ARCH=x86_64 + CPU_TARGET=${{ matrix.cpu }} + TRIPLET=${{matrix.arch}}-linux-gnu + GIT_SHA=${{github.sha}} + WEBKIT_URL=${{matrix.webkit_url}} + GIT_SHA=${{github.sha}} + WEBKIT_BASENAME=${{matrix.webkit_basename}} + platforms: linux/amd64 + target: compile-dependencies + outputs: type=local,dest=${{runner.temp}}/dependencies + - name: Build and push + uses: docker/build-push-action@v3 + if: runner.arch == 'ARM64' + with: + context: . + push: false + cache-from: type=gha + cache-to: type=gha,mode=min + build-args: | + ARCH=${{ matrix.arch }} + BUILDARCH=arm64 + BUILD_MACHINE_ARCH=aarch64 + CPU_TARGET=${{ matrix.cpu }} + TRIPLET=${{matrix.arch}}-linux-gnu + GIT_SHA=${{github.sha}} + WEBKIT_URL=${{matrix.webkit_url}} + GIT_SHA=${{github.sha}} + WEBKIT_BASENAME=${{matrix.webkit_basename}} + CPU_COUNT=${{runner.cores}} + platforms: linux/arm64 + target: compile-dependencies + outputs: type=local,dest=${{runner.temp}}/dependencies + - uses: actions/upload-artifact@v3 + with: + name: bun-dependencies-${{ matrix.tag }} + path: ${{runner.temp}}/dependencies linux-cpp-build: name: C++ ${{matrix.tag}} runs-on: ${{matrix.runner}} @@ -209,6 +310,7 @@ jobs: WEBKIT_URL=${{matrix.webkit_url}} GIT_SHA=${{github.sha}} WEBKIT_BASENAME=${{matrix.webkit_basename}} + CPU_COUNT=${{runner.cores}} platforms: linux/arm64 target: build_release_cpp outputs: type=local,dest=${{runner.temp}}/cpp @@ -224,7 +326,17 @@ jobs: name: Link ${{matrix.tag}} runs-on: ${{matrix.runner}} timeout-minutes: 90 - needs: [linux-zig-build, linux-cpp-build] + needs: [linux-zig-build, linux-dependencies-build, linux-cpp-build] + env: + CPU_TARGET: ${{ matrix.cpu }} + JSC_BASE_DIR: ${{ runner.temp }}/bun-webkit + JSC_LIB: ${{ runner.temp }}/bun-webkit/lib + BUN_DEPLOY_DIR: ${{ runner.temp }}/release/bun + OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj + BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps + BUN_RELEASE_DIR: ${{ runner.temp }}/release + WEBKIT_RELEASE_DIR: ${{ runner.temp }}/bun-webkit + WEBKIT_RELEASE_DIR_LTO: ${{ runner.temp }}/bun-webkit strategy: fail-fast: false matrix: @@ -289,6 +401,11 @@ jobs: with: name: bun-obj-${{ matrix.tag }} path: ${{runner.temp}}/obj + - name: Download from cache + uses: actions/download-artifact@v3 + with: + name: bun-dependencies-${{ matrix.tag }} + path: ${{env.BUN_DEPS_OUT_DIR}} - name: Extract run: | rm -rf src/bun.js/bindings-obj @@ -296,7 +413,7 @@ jobs: mkdir ${{runner.temp}}/cpp tar -xf ${{runner.temp}}/cpp.tar.gz -C ${{runner.temp}}/cpp mv ${{runner.temp}}/cpp/* src/bun.js/bindings-obj - mv ${{runner.temp}}/obj/* packages/${{matrix.package}} + mv ${{runner.temp}}/obj/* . - name: Build and push uses: docker/build-push-action@v3 @@ -313,6 +430,7 @@ jobs: CPU_TARGET=${{ matrix.cpu }} TRIPLET=${{matrix.arch}}-linux-gnu GIT_SHA=${{github.sha}} + BUN_DEPS_OUT_DIR=${{runner.temp}}/bun-deps platforms: linux/amd64 target: link_release outputs: type=local,dest=${{runner.temp}}/release @@ -333,6 +451,7 @@ jobs: GIT_SHA=${{github.sha}} WEBKIT_URL=${{matrix.webkit_url}} WEBKIT_BASENAME=${{matrix.webkit_basename}} + BUN_DEPS_OUT_DIR=${{runner.temp}}/bun-deps platforms: linux/arm64 target: link_release outputs: type=local,dest=${{runner.temp}}/release diff --git a/Dockerfile b/Dockerfile index 8be0376f0..abf9e5e7d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -544,6 +544,39 @@ COPY --from=build_release_cpp /*.a ${BUN_DEPS_OUT_DIR}/ RUN cd $BUN_DIR && mkdir -p ${BUN_RELEASE_DIR} && make bun-relink copy-to-bun-release-dir && \ rm -rf $HOME/.cache zig-cache misctools package.json build-id completions build.zig $(BUN_DIR)/packages +FROM prepare_release as build_release_paralell + +ARG DEBIAN_FRONTEND +ARG GITHUB_WORKSPACE +ARG ZIG_PATH +# Directory extracts to "bun-webkit" +ARG WEBKIT_DIR +ARG BUN_RELEASE_DIR +ARG BUN_DEPS_OUT_DIR +ARG BUN_DIR +ARG BUN_DEPLOY_DIR=/tmp/bun-out +ARG CPU_TARGET +ENV CPU_TARGET=${CPU_TARGET} +ENV BUN_DEPLOY_DIR=${BUN_DEPLOY_DIR} + +COPY Makefile ${BUN_DIR}/Makefile + +WORKDIR $BUN_DIR + +ENV JSC_BASE_DIR=${WEBKIT_DIR} +ENV LIB_ICU_PATH=${WEBKIT_DIR}/lib + +COPY ${BUN_DEPS_OUT_DIR}/*.a ${BUN_DEPS_OUT_DIR}/ +COPY ${BUN_DEPS_OUT_DIR}/*.o ${BUN_DEPS_OUT_DIR}/ +COPY ${BUN_DEPS_OUT_DIR}/*.o ${BUN_DEPS_OUT_DIR}/ + +COPY src/bun.js/bindings ${BUN_DIR}/src/bun.js/bindings +COPY bun.o ${BUN_DEPLOY_DIR}/ + + +RUN cd $BUN_DIR && mkdir -p ${BUN_RELEASE_DIR} && make bun-relink copy-to-bun-release-dir && \ + rm -rf $HOME/.cache zig-cache misctools package.json build-id completions build.zig $(BUN_DIR)/packages + FROM scratch as artifact diff --git a/package.json b/package.json index 9b3fc8af4..c36041466 100644 --- a/package.json +++ b/package.json @@ -25,10 +25,5 @@ "@typescript-eslint/parser": "^5.31.0", "bun-webkit": "latest" }, - "optionalDependencies": { - "bun-dependencies-linux-x64": "next", - "bun-dependencies-linux-arm64": "next", - "bun-dependencies-linux-x64-baseline": "next" - }, "version": "0.0.0" } |