Skip to content

update bun.lock

update bun.lock #3406

Workflow file for this run

# This workflow runs CI checks including building, typechecking, and testing the codebase
# Tests are parallelized to run faster by splitting them into separate jobs that run concurrently
#
# See the workflow visualization in knowledge file
name: CI
on:
push:
branches: ['main']
pull_request:
branches: ['main']
# Define reusable job template
jobs:
# Build and check
build-and-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: '1.2.12'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
node_modules
*/node_modules
packages/*/node_modules
key: ${{ runner.os }}-deps-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-deps-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Set environment variables
env:
SECRETS_CONTEXT: ${{ toJSON(secrets) }}
run: |
VAR_NAMES=$(node scripts/generate-ci-env.js)
echo "$SECRETS_CONTEXT" | jq -r --argjson vars "$VAR_NAMES" '
to_entries | .[] | select(.key as $k | $vars | index($k)) | .key + "=" + .value
' >> $GITHUB_ENV
echo "CODEBUFF_GITHUB_ACTIONS=true" >> $GITHUB_ENV
echo "NEXT_PUBLIC_CB_ENVIRONMENT=test" >> $GITHUB_ENV
echo "CODEBUFF_GITHUB_TOKEN=${{ secrets.CODEBUFF_GITHUB_TOKEN }}" >> $GITHUB_ENV
- name: Typecheck and Build web in parallel
run: |
bun -e "
const { spawn } = require('child_process');
function runCommand(command, args, options = {}) {
return new Promise((resolve, reject) => {
const child = spawn(command, args, { stdio: 'inherit', ...options });
child.on('close', (code) => code === 0 ? resolve() : reject(new Error('Command failed with exit code ' + code)));
child.on('error', reject);
});
}
Promise.all([
runCommand('bun', ['run', 'typecheck']),
runCommand('bun', ['run', 'build'], { cwd: 'web' })
]).then(() => console.log('✅ Both typecheck and web build completed successfully!'))
.catch(error => { console.error('❌ One or more commands failed:', error.message); process.exit(1); });
"
# - name: Build npm-app
# run: cd npm-app && bun run build
# - name: Open interactive debug shell
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# timeout-minutes: 15 # optional guard
# Template for test jobs
test:
needs: [build-and-check]
strategy:
matrix:
package: [npm-app, backend, common, .agents]
include:
- package: npm-app
- package: backend
- package: common
- package: .agents
name: test-${{ matrix.package }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: '1.2.12'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
node_modules
*/node_modules
packages/*/node_modules
key: ${{ runner.os }}-deps-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-deps-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Set environment variables
env:
SECRETS_CONTEXT: ${{ toJSON(secrets) }}
run: |
VAR_NAMES=$(node scripts/generate-ci-env.js)
echo "$SECRETS_CONTEXT" | jq -r --argjson vars "$VAR_NAMES" '
to_entries | .[] | select(.key as $k | $vars | index($k)) | .key + "=" + .value
' >> $GITHUB_ENV
echo "CODEBUFF_GITHUB_ACTIONS=true" >> $GITHUB_ENV
echo "NEXT_PUBLIC_CB_ENVIRONMENT=test" >> $GITHUB_ENV
echo "NEXT_PUBLIC_INFISICAL_UP=true" >> $GITHUB_ENV
echo "CODEBUFF_GITHUB_TOKEN=${{ secrets.CODEBUFF_GITHUB_TOKEN }}" >> $GITHUB_ENV
- name: Run ${{ matrix.package }} tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 5
command: |
cd ${{ matrix.package }}
if [ "${{ matrix.package }}" = ".agents" ]; then
find __tests__ -name '*.test.ts' ! -name '*.integration.test.ts' 2>/dev/null | sort | xargs -I {} bun test {} || echo "No regular tests found in .agents"
else
find src -name '*.test.ts' ! -name '*.integration.test.ts' | sort | xargs -I {} bun test {}
fi
# - name: Open interactive debug shell
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# timeout-minutes: 15 # optional guard
# Integration tests job
test-integration:
needs: [build-and-check]
strategy:
matrix:
package: [npm-app, backend, common, .agents]
include:
- package: npm-app
- package: backend
- package: common
- package: .agents
name: test-integration-${{ matrix.package }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: '1.2.12'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
node_modules
*/node_modules
packages/*/node_modules
key: ${{ runner.os }}-deps-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-deps-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Set environment variables
env:
SECRETS_CONTEXT: ${{ toJSON(secrets) }}
run: |
VAR_NAMES=$(node scripts/generate-ci-env.js)
echo "$SECRETS_CONTEXT" | jq -r --argjson vars "$VAR_NAMES" '
to_entries | .[] | select(.key as $k | $vars | index($k)) | .key + "=" + .value
' >> $GITHUB_ENV
echo "CODEBUFF_GITHUB_ACTIONS=true" >> $GITHUB_ENV
echo "NEXT_PUBLIC_CB_ENVIRONMENT=test" >> $GITHUB_ENV
echo "NEXT_PUBLIC_INFISICAL_UP=true" >> $GITHUB_ENV
echo "CODEBUFF_GITHUB_TOKEN=${{ secrets.CODEBUFF_GITHUB_TOKEN }}" >> $GITHUB_ENV
- name: Run ${{ matrix.package }} integration tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 15
max_attempts: 3
command: |
cd ${{ matrix.package }}
if [ "${{ matrix.package }}" = ".agents" ]; then
find __tests__ -name '*.integration.test.ts' 2>/dev/null | sort | xargs -I {} bun test {} || echo "No integration tests found in .agents"
else
find src -name '*.integration.test.ts' | sort | xargs -I {} bun test {}
fi
# - name: Open interactive debug shell
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# timeout-minutes: 15 # optional guard