Compare commits

...

4 Commits

Author SHA1 Message Date
Ashcon Partovi
df58847086 Maybe fix runner 2023-11-06 16:53:45 -08:00
Ashcon Partovi
5d9c23bd2a Ditch vars 2023-11-06 16:48:12 -08:00
Ashcon Partovi
4798fd9282 Trigger when workflow changes 2023-11-06 16:46:07 -08:00
Ashcon Partovi
9fb10ade66 New linux workflow 2023-11-06 16:44:50 -08:00
3 changed files with 285 additions and 401 deletions

View File

@@ -1,130 +0,0 @@
name: bun-linux
concurrency:
group: bun-linux-aarch64-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
paths:
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
- "build.zig"
- "Makefile"
- "Dockerfile"
pull_request:
branches:
- main
paths:
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
- "build.zig"
- "Makefile"
- "Dockerfile"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
linux:
name: ${{matrix.tag}}
runs-on: ${{matrix.runner}}
if: github.repository_owner == 'oven-sh'
timeout-minutes: 90
permissions: write-all
strategy:
matrix:
include:
- cpu: native
tag: linux-aarch64
arch: aarch64
build_arch: arm64
runner: linux-arm64
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}}
cache-to: type=local,dest=/tmp/.buildx-cache-${{matrix.tag}}
build-args: |
ARCH=${{matrix.arch}}
BUILDARCH=${{matrix.build_arch}}
BUILD_MACHINE_ARCH=${{matrix.build_machine_arch}}
CPU_TARGET=${{matrix.cpu}}
GIT_SHA=${{github.sha}}
platforms: linux/${{matrix.build_arch}}
target: artifact
outputs: type=local,dest=${{runner.temp}}/release
- name: Zip
run: |
# if zip is not found
if [ ! -x "$(command -v zip)" ]; then
sudo apt-get update && sudo apt-get install -y zip --no-install-recommends
fi
if [ ! -x "$(command -v strip)" ]; then
sudo apt-get update && sudo apt-get install -y binutils --no-install-recommends
fi
cd ${{runner.temp}}/release
chmod +x bun-profile bun
mkdir bun-${{matrix.tag}}-profile
mkdir bun-${{matrix.tag}}
strip bun
mv bun-profile bun-${{matrix.tag}}-profile/bun-profile
mv bun bun-${{matrix.tag}}/bun
zip -r bun-${{matrix.tag}}-profile.zip bun-${{matrix.tag}}-profile
zip -r bun-${{matrix.tag}}.zip bun-${{matrix.tag}}
- uses: actions/upload-artifact@v3
with:
name: bun-${{matrix.tag}}-profile
path: ${{runner.temp}}/release/bun-${{matrix.tag}}-profile.zip
- uses: actions/upload-artifact@v3
with:
name: bun-${{matrix.tag}}
path: ${{runner.temp}}/release/bun-${{matrix.tag}}.zip
- name: Release
id: release
uses: ncipollo/release-action@v1
if: |
github.repository_owner == 'oven-sh'
&& github.ref == 'refs/heads/main'
with:
prerelease: true
body: "This canary release of Bun corresponds to the commit [${{ github.sha }}]"
allowUpdates: true
replacesArtifacts: true
generateReleaseNotes: true
artifactErrorsFailBuild: true
token: ${{ secrets.GITHUB_TOKEN }}
name: "Canary (${{github.sha}})"
tag: "canary"
artifacts: "${{runner.temp}}/release/bun-${{matrix.tag}}.zip,${{runner.temp}}/release/bun-${{matrix.tag}}-profile.zip"

View File

@@ -1,271 +0,0 @@
name: bun-linux
concurrency:
group: bun-linux-build-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
paths:
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
- "build.zig"
- "Makefile"
- "Dockerfile"
pull_request:
branches:
- main
paths:
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
- "build.zig"
- "Makefile"
- "Dockerfile"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
linux:
name: ${{matrix.tag}}
runs-on: ${{matrix.runner}}
if: github.repository_owner == 'oven-sh'
timeout-minutes: 90
permissions: write-all
strategy:
fail-fast: false
matrix:
include:
- cpu: haswell
tag: linux-x64
arch: x86_64
build_arch: amd64
runner: big-ubuntu
build_machine_arch: x86_64
- cpu: nehalem
tag: linux-x64-baseline
arch: x86_64
build_arch: amd64
runner: big-ubuntu
build_machine_arch: x86_64
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}}
cache-to: type=local,dest=/tmp/.buildx-cache-${{matrix.tag}}
build-args: |
ARCH=${{matrix.arch}}
BUILDARCH=${{matrix.build_arch}}
BUILD_MACHINE_ARCH=${{matrix.build_machine_arch}}
CPU_TARGET=${{matrix.cpu}}
GIT_SHA=${{github.sha}}
SCCACHE_BUCKET=bun
SCCACHE_REGION=auto
SCCACHE_S3_USE_SSL=true
SCCACHE_ENDPOINT=${{ secrets.CACHE_S3_ENDPOINT }}
AWS_ACCESS_KEY_ID=${{ secrets.CACHE_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }}
platforms: linux/${{matrix.build_arch}}
target: artifact
outputs: type=local,dest=${{runner.temp}}/release
- name: Zip
run: |
# if zip is not found
if [ ! -x "$(command -v zip)" ]; then
sudo apt-get update && sudo apt-get install -y zip --no-install-recommends
fi
if [ ! -x "$(command -v strip)" ]; then
sudo apt-get update && sudo apt-get install -y binutils --no-install-recommends
fi
cd ${{runner.temp}}/release
chmod +x bun-profile bun
mkdir bun-${{matrix.tag}}-profile
mkdir bun-${{matrix.tag}}
strip bun
mv bun-profile bun-${{matrix.tag}}-profile/bun-profile
mv bun bun-${{matrix.tag}}/bun
zip -r bun-${{matrix.tag}}-profile.zip bun-${{matrix.tag}}-profile
zip -r bun-${{matrix.tag}}.zip bun-${{matrix.tag}}
- uses: actions/upload-artifact@v3
with:
name: bun-${{matrix.tag}}-profile
path: ${{runner.temp}}/release/bun-${{matrix.tag}}-profile.zip
- uses: actions/upload-artifact@v3
with:
name: bun-${{matrix.tag}}
path: ${{runner.temp}}/release/bun-${{matrix.tag}}.zip
- uses: actions/upload-artifact@v3
with:
name: bun-obj-${{matrix.tag}}
path: ${{runner.temp}}/release/bun-obj
- uses: actions/upload-artifact@v3
with:
name: ${{matrix.tag}}-dependencies
path: ${{runner.temp}}/release/bun-dependencies
- name: Release
id: release
uses: ncipollo/release-action@v1
if: |
github.repository_owner == 'oven-sh'
&& github.ref == 'refs/heads/main'
with:
prerelease: true
body: "This canary release of Bun corresponds to the commit [${{ github.sha }}]"
allowUpdates: true
replacesArtifacts: true
generateReleaseNotes: true
artifactErrorsFailBuild: true
token: ${{ secrets.GITHUB_TOKEN }}
name: "Canary (${{github.sha}})"
tag: "canary"
artifacts: "${{runner.temp}}/release/bun-${{matrix.tag}}.zip,${{runner.temp}}/release/bun-${{matrix.tag}}-profile.zip"
- uses: sarisia/actions-status-discord@v1
if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request'
with:
title: ""
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ job.status }}
noprefix: true
nocontext: true
description: |
Pull Request
### [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
@${{ github.actor }}
Build failed on ${{ matrix.tag }}:
**[View build output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
[Commit ${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})
linux-test:
name: Tests ${{matrix.tag}}
runs-on: ubuntu-latest
needs: [linux]
if: github.event_name == 'pull_request'
timeout-minutes: 20
permissions:
pull-requests: write
outputs:
failing_tests: ${{ steps.test.outputs.failing_tests }}
failing_tests_count: ${{ steps.test.outputs.failing_tests_count }}
strategy:
fail-fast: false
matrix:
include:
- tag: linux-x64
- tag: linux-x64-baseline
steps:
- id: checkout
name: Checkout
uses: actions/checkout@v3
with:
submodules: false
- id: download
name: Download
uses: actions/download-artifact@v3
with:
name: bun-${{matrix.tag}}
path: ${{runner.temp}}/release
- id: install-bun
name: Install Bun
run: |
cd ${{runner.temp}}/release
unzip bun-${{matrix.tag}}.zip
cd bun-${{matrix.tag}}
chmod +x bun
pwd >> $GITHUB_PATH
./bun --version
- id: install-dependnecies
name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y openssl
bun install --verbose
bun install --cwd=test --verbose
bun install --cwd=packages/bun-internal-test --verbose
- id: test
name: Test (node runner)
env:
SMTP_SENDGRID_SENDER: ${{ secrets.SMTP_SENDGRID_SENDER }}
TLS_MONGODB_DATABASE_URL: ${{ secrets.TLS_MONGODB_DATABASE_URL }}
TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }}
# if: ${{github.event.inputs.use_bun == 'false'}}
run: |
node packages/bun-internal-test/src/runner.node.mjs || true
- uses: sarisia/actions-status-discord@v1
if: always() && steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
with:
title: ""
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: "failure"
noprefix: true
nocontext: true
description: |
Pull Request
### ❌ [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
@${{ github.actor }}, there are ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
${{ steps.test.outputs.failing_tests }}
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
- name: Comment on PR
if: steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
with:
comment_tag: test-failures-${{matrix.tag}}
message: |
❌ @${{ github.actor }} ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
${{ steps.test.outputs.failing_tests }}
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
- name: Uncomment on PR
if: steps.test.outputs.failing_tests == '' && github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
with:
comment_tag: test-failures-${{matrix.tag}}
mode: upsert
create_if_not_exists: false
message: |
✅ test failures on ${{ matrix.tag }} have been resolved.
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
- id: fail
name: Fail the build
if: steps.test.outputs.failing_tests != ''
run: exit 1

285
.github/workflows/bun-linux.yml vendored Normal file
View File

@@ -0,0 +1,285 @@
name: bun-linux
concurrency:
group: bun-linux-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
- ci-*
paths:
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
- "build.zig"
- "Makefile"
- "Dockerfile"
- ".github/workflows/**/*"
pull_request:
branches:
- main
- ci-*
paths:
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
- "build.zig"
- "Makefile"
- "Dockerfile"
- ".github/workflows/**/*"
workflow_dispatch:
jobs:
build:
name: Build ${{ matrix.tag }}
runs-on: ${{ matrix.runner || 'ubuntu-latest' }}
timeout-minutes: 90
permissions: write-all
continue-on-error: true
strategy:
fail-fast: false
matrix:
include:
- tag: linux-x64
arch: x86_64
build-arch: amd64
build-machine-arch: x86_64
cpu: haswell
runnner: ${{ github.repository_owner == 'oven-sh' && 'big-ubuntu' || 'ubuntu-latest' }}
- tag: linux-x64-baseline
arch: x86_64
build-arch: amd64
build-machine-arch: x86_64
cpu: nehalem
runner: ${{ github.repository_owner == 'oven-sh' && 'big-ubuntu' || 'ubuntu-latest' }}
- tag: linux-aarch64
arch: aarch64
build-arch: arm64
build-machine-arch: aarch64
cpu: armv8
runner: ${{ github.repository_owner == 'oven-sh' && 'linux-arm64' || 'ubuntu-latest' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Emulation
if: ${{ matrix.build-arch == 'arm64' && runner.arch != 'ARM64' }}
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Setup Docker
uses: docker/setup-buildx-action@v3
with:
install: true
- name: Login to Docker
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare Cache
run: |
rm -rf ${{ runner.temp }}/release
mkdir -p ${{ runner.temp }}/.buildx-cache-${{ matrix.tag }}
- name: Build
uses: docker/build-push-action@v5
with:
context: .
push: false
target: artifact
platforms: linux/${{ matrix.build-arch }}
cache-from: type=local,src=${{ runner.temp }}/.buildx-cache-${{ matrix.tag }}
cache-to: type=local,dest=${{ runner.temp }}/.buildx-cache-${{ matrix.tag }}
outputs: type=local,dest=${{ runner.temp }}/release
build-args: |
ARCH=${{ matrix.arch }}
BUILDARCH=${{ matrix.build-arch }}
BUILD_MACHINE_ARCH=${{ matrix.build-machine-arch }}
CPU_TARGET=${{ matrix.cpu }}
GIT_SHA=${{ github.sha }}
SCCACHE_BUCKET=bun
SCCACHE_REGION=auto
SCCACHE_S3_USE_SSL=true
SCCACHE_ENDPOINT=${{ secrets.CACHE_S3_ENDPOINT }}
AWS_ACCESS_KEY_ID=${{ secrets.CACHE_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }}
- name: Prepare Artifacts
run: |
# if zip is not found
if [ ! -x "$(command -v zip)" ]; then
sudo apt-get update && sudo apt-get install -y zip --no-install-recommends
fi
if [ ! -x "$(command -v strip)" ]; then
sudo apt-get update && sudo apt-get install -y binutils --no-install-recommends
fi
cd ${{ runner.temp }}/release
chmod +x bun-profile bun
mkdir bun-${{ matrix.tag }}-profile
mkdir bun-${{ matrix.tag }}
strip bun
mv bun-profile bun-${{ matrix.tag }}-profile/bun-profile
mv bun bun-${{ matrix.tag }}/bun
zip -r bun-${{ matrix.tag }}-profile.zip bun-${{ matrix.tag }}-profile
zip -r bun-${{ matrix.tag }}.zip bun-${{ matrix.tag }}
- name: Upload bun-profile
uses: actions/upload-artifact@v3
with:
name: bun-${{ matrix.tag }}-profile
path: ${{ runner.temp }}/release/bun-${{ matrix.tag }}-profile.zip
- name: Upload bun
uses: actions/upload-artifact@v3
with:
name: bun-${{ matrix.tag }}
path: ${{ runner.temp }}/release/bun-${{ matrix.tag }}.zip
- name: Upload bun-obj
uses: actions/upload-artifact@v3
with:
name: bun-obj-${{ matrix.tag }}
path: ${{ runner.temp }}/release/bun-obj
- name: Upload bun-dependencies
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.tag }}-dependencies
path: ${{ runner.temp }}/release/bun-dependencies
- name: Release
if: ${{ github.repository_owner == 'oven-sh' && github.ref == 'refs/heads/main' }}
uses: ncipollo/release-action@v1
with:
prerelease: true
body: "This canary release of Bun corresponds to the commit [${{ github.sha }}]"
allowUpdates: true
replacesArtifacts: true
generateReleaseNotes: true
artifactErrorsFailBuild: true
token: ${{ secrets.GITHUB_TOKEN }}
name: "Canary (${{ github.sha }})"
tag: "canary"
artifacts: "${{ runner.temp }}/release/bun-${{ matrix.tag }}.zip,${{ runner.temp }}/release/bun-${{ matrix.tag }}-profile.zip"
- name: Send Discord Message
if: ${{ failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request' }}
uses: sarisia/actions-status-discord@v1
with:
title: ""
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ job.status }}
noprefix: true
nocontext: true
description: |
Pull Request
### [${{ github.event.pull_request.title }}](https://github.com/oven-sh/bun/pull/${{ github.event.number }})
@${{ github.actor }}
Build failed on ${{ matrix.tag }}:
**[View build output](https://github.com/oven-sh/bun/actions/runs/${{ github.run_id }})**
[Commit ${{github.sha}}](https://github.com/oven-sh/bun/commits/${{ github.sha }})
test:
name: Test ${{ matrix.tag }}
needs: [build]
runs-on: ${{ github.repository_owner == 'oven-sh' && matrix.runner == 'ARM64' && 'linux-arm64' || 'ubuntu-latest' }}
timeout-minutes: 20
permissions:
pull-requests: write
strategy:
fail-fast: false
matrix:
include:
- tag: linux-x64
arch: X64
- tag: linux-x64-baseline
arch: X64
- tag: linux-aarch64
arch: ARM64
outputs:
failing_tests: ${{ steps.test.outputs.failing_tests }}
failing_tests_count: ${{ steps.test.outputs.failing_tests_count }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: false
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: bun-${{ matrix.tag }}
path: ${{runner.temp}}/release
- name: Prepare Artifact
run: |
cd ${{ runner.temp }}/release
unzip bun-${{ matrix.tag }}.zip
cd bun-${{ matrix.tag }}
chmod +x bun
./bun --version
pwd >> $GITHUB_PATH
- name: Install Dependencies
run: |
sudo apt-get update && sudo apt-get install -y openssl
bun install --verbose
bun install --cwd=test --verbose
bun install --cwd=packages/bun-internal-test --verbose
- id: test
name: Test
if: ${{ runner.arch == matrix.arch }}
env:
SMTP_SENDGRID_SENDER: ${{ secrets.SMTP_SENDGRID_SENDER }}
TLS_MONGODB_DATABASE_URL: ${{ secrets.TLS_MONGODB_DATABASE_URL }}
TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }}
run: |
node packages/bun-internal-test/src/runner.node.mjs || true
- name: Send Discord Message
if: ${{ always() && steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request' }}
uses: sarisia/actions-status-discord@v1
with:
title: ""
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: "failure"
noprefix: true
nocontext: true
description: |
Pull Request
### ❌ [${{ github.event.pull_request.title }}](https://github.com/oven-sh/bun/pull/${{ github.event.number }})
@${{ github.actor }}, there are ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
${{ steps.test.outputs.failing_tests }}
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{ github.run_id }})**
- name: Comment on Pull Request
if: ${{ steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request' }}
uses: thollander/actions-comment-pull-request@v2
with:
comment_tag: test-failures-${{ matrix.tag }}
message: |
❌ @${{ github.actor }} ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
${{ steps.test.outputs.failing_tests }}
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{ github.run_id }})**
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{ github.sha }})</sup>
- name: Uncomment on Pull Request
if: ${{ steps.test.outputs.failing_tests == '' && github.event_name == 'pull_request' }}
uses: thollander/actions-comment-pull-request@v2
with:
comment_tag: test-failures-${{ matrix.tag }}
mode: upsert
create_if_not_exists: false
message: |
✅ test failures on ${{ matrix.tag }} have been resolved.
<sup>[#${{ github.sha }}](https://github.com/oven-sh/bun/commits/${{ github.sha }})</sup>
- name: Done
if: ${{ steps.test.outputs.failing_tests != '' }}
run: |
exit 1