Giter VIP home page Giter VIP logo

setup-bun's Introduction

setup-bun

Download, install, and setup Bun in GitHub Actions.

Usage

- uses: oven-sh/setup-bun@v1
  with:
    bun-version: latest

Using a custom NPM registry

- uses: oven-sh/setup-bun@v1
  with:
    registry-url: "https://npm.pkg.github.com/"
    scope: "@foo"

If you need to authenticate with a private registry, you can set the BUN_AUTH_TOKEN environment variable.

- name: Install Dependencies
  env:
    BUN_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
  run: bun install --frozen-lockfile

Node.js not needed

In most cases, you shouldn't need to use the setup-node GitHub Action.

Inputs

Name Description Default Examples
bun-version The version of Bun to download and install. latest canary, 1.0.0, 1.0.x
registry-url Registry URL where some private package is stored. undefined "https://npm.pkg.github.com/"
scope Scope for private packages. undefined "@foo", "@orgname"
no-cache Disable caching of the downloaded executable. false true, false

Outputs

Name Description Example
cache-hit If the Bun executable was read from cache. true
bun-version The output from bun --version. 1.0.0
bun-revision The output from bun --revision. 1.0.0+822a00c4

setup-bun's People

Contributors

andyexeter avatar autofix-ci[bot] avatar blimmer avatar cyberflamego avatar danadajian avatar electroid avatar jcbhmr avatar maschwenk avatar meadowsys avatar nil1511 avatar paulrberg avatar starsep avatar vitoorgomes avatar xhyrom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

setup-bun's Issues

Bun setup fails when other bun apps are running on the background.

I've set up the ci/cd using Github actions as following:

name: Deploy on Test Server
run-name: ${{ github.actor }} is deploying to test server

on:
  push:
    branches:
      - development

jobs:
  deploy:
    runs-on: test

    steps:
      - name: Checkout Project
        uses: actions/checkout@v4

      - name: Create env file
        run: cp ../.env .env.local

      - name: Setup bun
        uses: oven-sh/setup-bun@v1

      - name: Install dependencies
        run: bun install

      - name: Generate Build
        run: bun run build

      - name: Restart process
        run: pm2 restart myapp

But, when the setup-bun action can't setup bun without stopping every other process running bun, ci error:

Run oven-sh/setup-bun@v1
  with:
    bun-version: latest
Downloading a new version of Bun: https://bun.sh/download/latest/linux/x64?avx[2](https://github.com/whatstalk/whatstalk-web/actions/runs/7533224581/job/20505337934#step:5:2)=true&profile=false
/usr/bin/unzip -o -q /usr/apps/_temp/bd9fb8b4-08[3](https://github.com/whatstalk/whatstalk-web/actions/runs/7533224581/job/20505337934#step:5:3)e-[4](https://github.com/whatstalk/whatstalk-web/actions/runs/7533224581/job/20505337934#step:5:5)7f[5](https://github.com/whatstalk/whatstalk-web/actions/runs/7533224581/job/20505337934#step:5:6)-9e[6](https://github.com/whatstalk/whatstalk-web/actions/runs/7533224581/job/20505337934#step:5:7)d-0c4d8cc2430a
Error: Error: ETXTBSY: text file is busy, copyfile '/usr/apps/_temp/3625e59f-8c63-4659-90a9-ede291cca2fc/bun-linux-x64-baseline/bun' -> '/home/marcelokochiyama/.bun/bin/bun'

It is an expected behaviour or it should work even with other apps running with bun on the background?

404 While downloading a new version of Bun

Starting about 30 minutes ago as of nov 17th 14:49 i get an error while using this action. Perhaps you guys changed the download url? Looking forward to hearing from you!

Run oven-sh/setup-bun@v1
Downloading a new version of Bun: https://bun.sh/download/latest/linux/x64?avx2=true&profile=false
Error: Error: Unexpected HTTP response: 404

403 while Downloading a new version of Bun

Run oven-sh/setup-bun@v1
Downloading a new version of Bun: https://bun.sh/download/latest/linux/x64?avx2=true&profile=false
Error: Error: Unexpected HTTP response: 403

Does https://bun.sh/download has some kind of WAF or rate limiting mechanism? When I manually run curl on the runner it displayed <title>Just a moment...</title> but I coudn't see the reason.

Also I can confirm that directly curl https://github.com/oven-sh/bun/releases/download/bun-v1.0.33/bun-linux-x64-baseline.zip is ok.

P.S. We use self-hosted runners and utilize the cloudflare WARP, but I think it shouldn't be a problem to setup bun.

Windows 404 error

Hello,

I use setup-bun action in one of my workflow and it fails with a 404 error on the download link in windows environment.

I know this issue has already been filed but it has been marked as resolve even if the problem still persist or reappeared.

Thank you in advance for your answer

Does this work without Node.js?

Can I use this GitHub Action without previously installing Node.js? E.g.

jobs:
  lint:
    runs-on: "ubuntu-latest"
    steps:
      - name: "Install Node.js"
        uses: "actions/setup-node@v3"
        with:
          node-version: "lts/*"

      - name: "Install Bun"
        uses: "oven-sh/setup-bun@v1"

Is the first step necessary?

Side note - would you like to enable Discussions in this repository? I would have opened a discussion instead of an issue.

Unable to reserve cache, another job may be creating this cache

I'm getting this warning (and I suspect it's also causing intermittent errors) when running 4 parallell Github Actions that all are running a bun install initially:

Failed to save: Unable to reserve cache with key bun-1.0.20-linux-x64-true-false, another job may be creating this cache. More details: Cache already exists. Scope: refs/heads/main, Key: bun-1.0.20-linux-x64-true-false, Version: 4793076103aa823b0a4c97942d7385d4346f77a3c30a0bad6e0f1d748becbab5

The entire job can be seen here (attempt 1 failed on a thing related to mongodb-memory-server which requires a postinstall action to succeed):
https://github.com/kingstinct/zemble/actions/runs/7323721703

Cannot install bun in a containerized runner job. Install script from bun.sh works.

Today i discovered an issue with the setup-bun action. We use setup-bun to install the dependencies and then execute the app with node.
I also can see that setup-bun not containerized, which runs in the runner directly, does not have any issues.

How to reproduce

e2e:
    permissions:
      actions: read
      contents: read
      id-token: write
      pull-requests: write
      repository-projects: read
    services:
      mock_server:
        image: mockserver/mockserver
        env:
          IS_E2E: true
          MOCKSERVER_LOG_LEVEL: WARN
    container:
      image: mcr.microsoft.com/playwright:v1.40.0-jammy
    steps:
      - name: Fix possible git-lfs issues
        run: rm -rf .git/hooks/post-checkout
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 20
      - uses: oven-sh/setup-bun@v1
        with:
          bun-version: latest

Logs

Run: actions/checkout@v3
/usr/bin/docker exec  b9f03e81ffcc8799fd9d96166dcc7960541b4625d2c2ea2caa4d88730c35ea0f sh -c "cat /etc/*release | grep ^ID"
Found in cache @ /__t/node/20.9.0/x64

Run: oven-sh/setup-bun@v1
/usr/bin/docker exec  b9f03e81ffcc8799fd9d96166dcc7960541b4625d2c2ea2caa4d88730c35ea0f sh -c "cat /etc/*release | grep ^ID"
OCI runtime exec failed: exec failed: container_linux.go:367: starting container process caused: exec: "/__e/node20/bin/node": stat /__e/node20/bin/node: no such file or directory: unknown

I believe the action looks for node in the wrong space when containerized.

How to fix?

Swap out the install action to the install script. See the lastest docs to see how to pin specific versions, if desired:

      - name: Setup Bun
        run: |
          curl -fsSL https://bun.sh/install | bash

Feel free to close this ticket if you cannot reproduce it. I am unsure if this is a big issue or not. It would be nice to use the setup-bun action everywhere but i am fine with the install script workaround.

Github Self-Hosted Runners fail with Segmentation fault

When running without the node setup the self-hosted runners image throws a Segmentation Fault error 139 when running any bun commands.

To resolve I needed to add the node setup step but it would be ideal if this were not needed.

image

This is the workaround until unzip is added to the install list and the error above is identified.

image

Warning: Node.js 16 actions are deprecated

This is the annotation warning I started to receive when using oven-sh/setup-bun@v1 action:

Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: oven-sh/setup-bun@v1. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.

Version selectors `1.x`/`1.0.x` result in `400` response errors on install

We use bun in various parts of the expo/expo repository, e.g. here. Like the node setup action, we use a version selector with a .x, e.g., node-version: 18.x.

This seemed to work until some days ago when our CI started failing with the following message:
image

A quick test showed that using the exact version number does seem to work, but 1.x or 1.0.x won't anymore. Is this something that never should have worked, or a bug? ๐Ÿ˜„

request response
1.0.x using 1.0.x as version
1.x using 1.x as version
1.0.11 โœ… - but big image, see below
latest โœ… - but big image, see below
See 1.0.11 response

using 1.0.11 as version

See latest response

using latest as version

Fix canary versions

How to resolve:

Automatically fetch latest gh actions and download artifact

Node.js 16 actions are deprecated.

So I'm getting this error:

Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: oven-sh/setup-bun@v1.

And I'm wondering if is it to hard to move to nodejs 20 action?

Seems quick! where's the cache?

Title is a bit tongue in cheek.

It doesn't look like there's a way to set a damage file or anything for purposes of a cache in the action.
This is normally configured in the actions/setup-node action on GH actions.

It doesn't look like bun has that, which is a bit disappointing because it feels like there might be an even deeper win here if that was available.

Not using 1.0.0

The action is downloading 0.5.6. When I explicitly set bun-version to 1.0.0, it still downloads 0.5.6.

Log output:

Run oven-sh/setup-bun@v1
  with:
    bun-version: 1.0.0
Downloading a new version of Bun: https://bun.sh/download/0.5.6/linux/x64?avx2=true&profile=false
/usr/bin/unzip -o -q /home/runner/work/_temp/aecc4a[3](https://github.com/probablykasper/kyper/actions/runs/6151443142/job/16691722213#step:3:3)7-5cc8-[4](https://github.com/probablykasper/kyper/actions/runs/6151443142/job/16691722213#step:3:4)99d-b88e-3be91f1e9efa
/home/runner/.bun/bin/bun --revision
bun: a fast bundler, transpiler, JavaScript Runtime and package manager for web software.

  run       ./my-script.ts        Run JavaScript with bun, a package.json script, or a bin
  x         bun-repl              Install and execute a package bin (bunx)

  init                            Start an empty Bun project from a blank template
  create    next ./app            Create a new project from a template (bun c)
  install                         Install dependencies for a package.json (bun i)
  add       @zarfjs/zarf          Add a dependency to package.json (bun a)
  link                            Link an npm package globally
  remove    redux                 Remove a dependency from package.json (bun rm)
  unlink                          Globally unlink an npm package
  pm                              More commands for managing packages

  dev       ./a.ts ./b.jsx        Start a bun (frontend) Dev Server
  bun       ./a.ts ./b.jsx        Bundle dependencies of input files into a .bun

  upgrade                         Get the latest version of bun
  completions                     Install shell completions for tab-completion
  discord                         Open bun's Discord server
  help                            Print this help menu
/home/runner/.bun/bin/bun --version
0.[5](https://github.com/probablykasper/kyper/actions/runs/6151443142/job/16691722213#step:3:5).[6](https://github.com/probablykasper/kyper/actions/runs/6151443142/job/16691722213#step:3:6)
/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/kyper/kyper --files-from manifest.txt --use-compress-program zstdmt
Cache Size: ~29 MB (303[7](https://github.com/probablykasper/kyper/actions/runs/6151443142/job/16691722213#step:3:7)[9](https://github.com/probablykasper/kyper/actions/runs/6151443142/job/16691722213#step:3:9)[34](https://github.com/probablykasper/kyper/actions/runs/6151443142/job/16691722213#step:3:35)7 B)
Cache saved successfully

Should `bunx` be available after this action?

Hi, I'm using this action to set up Bun in a CI job, and I expected bunx to be available for subsequent steps after this:

  - name: Setup Bun
    uses: oven-sh/setup-bun@v1
    with:
      bun-version: latest

Instead I get bunx: command not found. Is the intention to make bunx available, and if not, is there a workaround?

Freezes on first run on self-hosted

If you setup a new github project and add a self hosted runner and try to use the task it gets stuck after this:

Downloading a new version of Bun: https://bun.sh/download/1.0.26/linux/x64?avx2=true&profile=false
/usr/bin/unzip -o -q /home/XXX/GHAction/_temp/6c34e31[5](https://github.com/XXX/GHAction/actions/runs/8131459921/job/22220810867#step:3:6)-e774-4d10-b078-4022[6](https://github.com/XXX/GHAction/actions/runs/8131459921/job/22220810867#step:3:7)191e70c
/home/XXX/.bun/bin/bun --revision
1.0.26+c[7](https://github.com/XXX/GHAction/actions/runs/8131459921/job/22220810867#step:3:8)5e76[8](https://github.com/XXX/GHAction/actions/runs/8131459921/job/22220810867#step:3:9)a6
/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/XXX/GHAction/projects/RSAS/rsas/rsas --files-from manifest.txt --use-compress-program zstdmt
Cache Size: ~31 MB (32664145 B)
Cache saved successfully

After this it just does nothing
It only works if you then cancel the run and start a new one
My workflow is also pretty simple

name: Build Pipeline

on:
  push:
    branches: ["main"]
  workflow_dispatch:

jobs:
  build:
    runs-on: self-hosted
    steps:
      - uses: actions/checkout@v3
      - uses: oven-sh/setup-bun@v1
        with:
          bun-version: 1.0.26
      - name: Build
        run: bun run build

The runner is running on Ubuntu 22.04.3 LTS
Here is my neofetch:

            .-/+oossssoo+/-.               XXX@homelabs1
        `:+ssssssssssssssssss+:`           -------------
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 22.04.3 LTS x86_64
    .ossssssssssssssssssdMMMNysssso.       Host: PowerEdge R710
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.15.0-94-generic
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 20 days, 20 hours, 58 mins
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 902 (dpkg), 5 (snap)
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.1.16
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Resolution: 1024x768
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   Terminal: /dev/pts/0
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   CPU: Intel Xeon E5620 (16) @ 2.393GHz
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   GPU: 08:03.0 Matrox Electronics Systems Ltd. MGA G200eW WPCM450
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Memory: 1218MiB / 64381MiB
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/
  +sssssssssdmydMMMMMMMMddddyssssssss+
   /ssssssssssshdmNNNNmyNMMMMhssssss/
    .ossssssssssssssssssdMMMNysssso.
      -+sssssssssssssssssyyyssss+-
        `:+ssssssssssssssssss+:`
            .-/+oossssoo+/-.

Add `check-latest` version tunable to allow caching with refresh on specific major revision or major + minor

Currently the only way to ensure during CI you get the latest version from a major revision using wildcard version like 1.x (or 1.1.x
for major + minor version pinning) is to disable caching, which is not friendly to the bun download infra, etc.

check-latest would allow to:

  • use bun runtime cache
  • download bun runtime, prune and refresh bun runtime cache only if a new version in a major revision (or ...) is available

Setting version to latest is not offering a similar granularity over the version control at CI on GitHub.

use bundler instead exposing node_modules

Why

Exposing node_modules severely degrades the developer experience, especially the push speed and the ability to contribute.

Solutions

  1. Wait for the new bun bundler
  2. Use ncc

At the moment we'll probably use ncc, since we can't afford to wait for a new bundler, we'll migrate the bundler after the new one.

action's v1 tag not getting updated

The v1 tag is not getting updated with new v1.x releases and is therefore stuck on version of setup-bun from February 2023.

As a result the readme's own usage example does not take benefit of the fixes and recent releases.

Use v1.1.1 for now

edited by xHyroM

Feature Request: Support using ASDF `.tool-versions` file for setting the bun version

ASDF is a tool for managing language versions in a project, and it uses a .tool-versions file for managing which language version should be in use.
It has a plugin for it for managing the bun version.

I'd really like if I could tell the setup-bun action to use the same bun version as the ASDF .tool-versions file.

This feature is available in similar setup-<lang> actions.
eg.

Incorrect bun version: 0.5.6

Hello,

The wrong bun version is downloaded whether the version is specified or not.
It was working fine until very recently (~1h)
I'm always getting v0.5.6 which seems broken for workspaces

I'm using a minimal config

name: CI

on:
  pull_request:
  push:

jobs:
  install:
    name: Install
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install Bun
        uses: oven-sh/setup-bun@v1
        with:
          bun-version: 1.0.0

      - name: Install Dependencies
        run: bun install

      - name: Run
        run: bun run index.ts

I have a minimal repo here: https://github.com/0xYami/bun-repro-ci-bun-version

Log without version specified (should defaults to latest): https://github.com/0xYami/bun-repro-ci-bun-version/actions/runs/6151432253/job/16691465674#step:3:30

Log with version specified (should be 1.0.0): https://github.com/0xYami/bun-repro-ci-bun-version/actions/runs/6151502117/job/16691677799#step:3:31

Custom registry timeout

After following the docs and reading through this issue i can't get the Github actions to work with using a custom registry.

The config looks like this:

steps:
      - uses: actions/checkout@v3
      - name: Use Bun
        uses: oven-sh/setup-bun@main
        with:
          bun-version: latest
          registry-url: 'https://npm.pkg.github.com/'
          scope: '@company'

The install seems to timeout with the message: The job running on runner GitHub Actions 5 has exceeded the maximum execution time of 360 minutes.. It seems my config should work since it's following the docs.

Any ideas?

Bug: cross-device link not permitted

Executing the job oven-sh/setup-bun@v1, the installation fails, returning Error: Error: EXDEV: cross-device link not permitted.

Runner: self-hosted
(more ENV details included on the image)
image

Hanging after Cache saved successfully message

Hey there,

We've noticed recently that on a cold cache this action hangs for over 2 minutes after the "Cache saved successfully" message. This is probably related to the actions/cache package and the Node version (see actions/setup-node#878)

They solved this by exiting early rather than waiting for the cache save promise to resolve: https://github.com/actions/setup-node/pull/917/files

I propose to implement the same fix here, and also as per the node action moving the cache saving to a runs.post hook so it runs after other steps if the workflow was successful e.g. https://github.com/actions/setup-node/blob/25b062c917b0c75f8b47d8469aff6c94ffd89abb/action.yml#L38-L39

I'm happy to create a PR for this.

Custom registry-url and scope not working

I have the following step:

- name: Use Bun v1
  uses: oven-sh/setup-bun@v1
  with:
    registry-url: "https://npm.pkg.github.com"
    scope: "@companyName"

In the logs, I get this warning: Unexpected input(s) 'registry-url', 'scope', valid inputs are ['bun-version'].

There are setup instructions available in the README.md file, but this doesn't seem to reflect what's actually deployed. I can also see some work being done in the commit logs, seems like some runners are throwing an error.

Unexpected HTTP response: 404

This github action is failing with a 404.

Here's the log

Run oven-sh/setup-bun@v1
Downloading a new version of Bun: https://bun.sh/download/latest/linux/x64?avx2=true&profile=false
Error: Error: Unexpected HTTP response: 404

I was using:

- uses: oven-sh/setup-bun@v1

and also tried:

- uses: oven-sh/setup-bun@v1
  with:
    bun-version: latest

both are failing with the same error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.