Skip to content

feat: add bunenv GitHub Action for CI/CD workflows - #7

Merged
JacobCoffee merged 2 commits into
mainfrom
feat/add-bunenv-github-action
Nov 24, 2025
Merged

JacobCoffee merged 2 commits into
mainfrom
feat/add-bunenv-github-action

Conversation

@JacobCoffee

Copy link
Copy Markdown
Owner

Summary

Add an official GitHub Action to make bunenv easy to use in CI/CD workflows, similar to actions/setup-python or actions/setup-node.

Motivation

Currently, users need to manually install bunenv and create environments in their workflows:

- run: pip install bunenv
- run: bunenv .bunenv --bun=latest
- run: source .bunenv/bin/activate

This PR adds a reusable action that simplifies this to:

- uses: JacobCoffee/bunenv@v1
  with:
    bun-version: 'latest'

Changes

New Files

action.yml - Composite GitHub Action

  • Sets up Python
  • Installs bunenv
  • Creates Bun environment
  • Activates environment (adds to PATH)
  • Verifies installation
  • Automatic caching support

ACTION.md - Complete Documentation

  • Quick start examples
  • Matrix testing
  • Cross-platform usage
  • Polyglot projects
  • Troubleshooting
  • Comparison with other solutions

Updated Files

README.md

  • Added GitHub Actions section under CI/CD Integration
  • Shows both action usage (recommended) and manual setup

.github/workflows/ci.yml

  • Added action-test job to validate the action
  • Tests on Ubuntu, macOS, Windows
  • Tests with multiple Bun versions (latest, 1.3.3)

Features

✅ Isolated Environments - Each workflow gets its own Bun environment
✅ Automatic Caching - Caches Bun installations for faster runs
✅ Version Pinning - Lock to specific Bun versions
✅ Cross-Platform - Ubuntu, macOS, Windows support
✅ Variant Support - baseline, musl, profile variants
✅ Zero Config - Sensible defaults, works out of the box

Usage Examples

Basic

steps:
  - uses: actions/checkout@v4
  - uses: JacobCoffee/bunenv@v1
  - run: bun install && bun test

Matrix Testing

strategy:
  matrix:
    bun-version: ['latest', '1.3.3', '1.3.0']
steps:
  - uses: JacobCoffee/bunenv@v1
    with:
      bun-version: ${{ matrix.bun-version }}

Polyglot Project

- uses: actions/setup-python@v5
  with:
    python-version: '3.12'
    
- uses: JacobCoffee/bunenv@v1
  with:
    bun-version: 'latest'

- run: pip install -r requirements.txt
- run: bun install
- run: pytest && bun test

Inputs

Input Description Default
bun-version Bun version to install latest
variant Bun variant (baseline, musl, etc) "" (auto)
github-token GitHub token for API requests ${{ github.token }}
cache Enable caching true
python-version Python version for bunenv 3.12

Outputs

Output Description
bun-version Actual Bun version installed
bunenv-path Path to bunenv environment

Testing

The PR includes an action-test job that:

  • Tests on Ubuntu, macOS, Windows
  • Tests with multiple Bun versions
  • Verifies Bun installation and functionality
  • Validates caching works correctly

Benefits Over Manual Setup

Before:

- name: Setup Bun
  run: |
    pip install bunenv
    bunenv .bunenv --bun=1.3.3 --github-token=${{ secrets.GITHUB_TOKEN }}
    source .bunenv/bin/activate  # Doesn't work on Windows!

After:

- uses: JacobCoffee/bunenv@v1
  with:
    bun-version: '1.3.3'

Future Enhancements

Potential future improvements (not in this PR):

  • Support for bunfile.lock version detection
  • Automatic variant detection for container environments
  • Custom installation directory
  • Pre/post hooks for custom setup

Documentation

Complete documentation is in ACTION.md including:

  • Quick start guide
  • Common use cases
  • Advanced examples
  • Troubleshooting
  • Comparison with alternatives

See ACTION.md for full details.


🤖 Generated with Claude Code

JacobCoffee and others added 2 commits November 23, 2025 20:15
Add official GitHub Action to simplify bunenv setup in workflows:

**New Files:**
- `action.yml`: Composite action for setting up Bun with bunenv
  - Inputs: bun-version, variant, github-token, cache, python-version
  - Outputs: bun-version, bunenv-path
  - Auto-caching of Bun installations
  - Cross-platform support (Ubuntu, macOS, Windows)

- `ACTION.md`: Complete documentation with examples
  - Quick start guides
  - Matrix testing examples
  - Cross-platform examples
  - Polyglot project examples
  - Troubleshooting guide

**Updated:**
- `README.md`: Added GitHub Actions section with action usage
- `.github/workflows/ci.yml`: Added action-test job to validate action

**Features:**
✅ Isolated Bun environments (like virtualenv)
✅ Automatic caching for faster runs
✅ Version pinning for reproducible builds
✅ Cross-platform (Ubuntu, macOS, Windows)
✅ Variant support (baseline, musl, profile)
✅ GitHub token support to avoid rate limits

**Usage:**
```yaml
- uses: JacobCoffee/bunenv@v1
  with:
    bun-version: 'latest'
```

This makes bunenv easy to use in CI/CD pipelines while maintaining
the isolation and reproducibility benefits of virtual environments.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@JacobCoffee
JacobCoffee merged commit 7c0c6b2 into main Nov 24, 2025
34 checks passed
JacobCoffee added a commit to JacobCoffee/byte that referenced this pull request Nov 24, 2025
Replace nodeenv with bunenv for frontend tooling isolation:

**Changes:**
- Makefile: Replace `nodeenv --python-virtualenv` with `bunenv --python-virtualenv --bun=latest`
- pyproject.toml: Add `bunenv>=0.1.0` to dev dependencies
- uv.lock: Update lock file with bunenv dependency

**Benefits:**
✅ Purpose-built for Bun (vs Node.js-focused nodeenv)
✅ Maintained actively with modern tooling
✅ GitHub Releases API integration (vs nodejs.org index)
✅ Same proven architecture as nodeenv
✅ Zero breaking changes to workflow

**Testing:**
Verified bunenv 0.1.0 installs correctly via `uv sync --group dev`

**Migration Path:**
`nodeenv --python-virtualenv` → `bunenv --python-virtualenv --bun=latest`

No other changes required - bunenv provides the same isolation
and activation mechanism, just optimized for Bun.

Related: JacobCoffee/bunenv#7 (bunenv GitHub Action)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant