Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Bricks Shared GitHub Actions

Reusable composite actions for AWS infrastructure automation with database access via EC2 bastion.
Reusable composite actions for AWS infrastructure automation, development environment setup, and CI/CD workflows.

## Usage

Expand Down Expand Up @@ -541,6 +541,49 @@ jobs:
actor-email: ${{ github.event.pusher.email || format('{0}@users.noreply.github.com', github.actor) }}
```

### 9. setup-bun-with-dependencies

Sets up Bun runtime, caches dependencies, and installs packages with frozen lockfile. Optimized for CI/CD pipelines with intelligent caching.

**Features:**
- Installs specified Bun version (or latest)
- Caches Bun install cache and node_modules for faster builds
- Installs dependencies with `--frozen-lockfile` for reproducible builds
- Supports custom working directories for monorepo setups

**Inputs:**
- `bun-version` (optional): Bun version to install (default: `1.3.0`)
- `working-directory` (optional): Working directory where package.json is located (default: `.`)

**Example:**
```yaml
- name: Setup Bun and install dependencies
uses: withBricks/github-actions/setup-bun-with-dependencies@v1
with:
bun-version: 1.3.0
working-directory: .

- name: Build project
run: bun run build
```

**Monorepo Example:**
```yaml
- name: Setup Bun for backend
uses: withBricks/github-actions/setup-bun-with-dependencies@v1
with:
bun-version: 1.3.0
working-directory: apps/backend

- name: Build backend
working-directory: apps/backend
run: bun run build
```

**Requirements:**
- Project must have a `bun.lockb` lockfile
- `package.json` must exist in the working directory

## Security Considerations

### Password Security
Expand Down
55 changes: 55 additions & 0 deletions examples/bun-build-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Example workflow for using setup-bun-with-dependencies action
# Copy this to your repository and customize as needed

name: Build with Bun

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Bun and install dependencies
uses: withBricks/github-actions/setup-bun-with-dependencies@v1
with:
bun-version: 1.3.0

- name: Run tests
run: bun test

- name: Build project
run: bun run build

- name: Lint code
run: bun run lint

# Example for monorepo with multiple packages
build-monorepo:
runs-on: ubuntu-latest
strategy:
matrix:
package: [backend, frontend, shared]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Bun for ${{ matrix.package }}
uses: withBricks/github-actions/setup-bun-with-dependencies@v1
with:
bun-version: 1.3.0
working-directory: packages/${{ matrix.package }}

- name: Build ${{ matrix.package }}
working-directory: packages/${{ matrix.package }}
run: bun run build

- name: Test ${{ matrix.package }}
working-directory: packages/${{ matrix.package }}
run: bun test
38 changes: 38 additions & 0 deletions setup-bun-with-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: 'Setup Bun with Dependencies'
description: 'Setup Bun runtime, cache dependencies, and install packages with frozen lockfile'

inputs:
bun-version:
description: 'Bun version to install'
required: false
default: '1.3.0'
working-directory:
description: 'Working directory where package.json is located'
required: false
default: '.'

runs:
using: composite
steps:
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ inputs.bun-version }}

- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
${{ inputs.working-directory }}/node_modules
key: ${{ runner.os }}-bun-${{ inputs.bun-version }}-${{ hashFiles(format('{0}/bun.lockb', inputs.working-directory)) }}
restore-keys: |
${{ runner.os }}-bun-${{ inputs.bun-version }}-

- name: Install dependencies
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
echo "Installing dependencies with frozen lockfile..."
bun install --frozen-lockfile
echo "Dependencies installed successfully"