Update Docker and workflow configurations for bun.lock handling

This commit is contained in:
Arunavo Ray
2025-05-20 16:03:40 +05:30
parent 4a01a351f0
commit cad72da016
4 changed files with 16 additions and 8 deletions

View File

@@ -5,7 +5,7 @@
# Node.js # Node.js
node_modules node_modules
bun.lock # We don't exclude bun.lock* as it's needed for the build
npm-debug.log npm-debug.log
yarn-debug.log yarn-debug.log
yarn-error.log yarn-error.log

View File

@@ -16,7 +16,7 @@ jobs:
build-and-test: build-and-test:
name: Build and Test Astro Project name: Build and Test Astro Project
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -25,10 +25,17 @@ jobs:
uses: oven-sh/setup-bun@v1 uses: oven-sh/setup-bun@v1
with: with:
bun-version: '1.2.9' bun-version: '1.2.9'
cache: true
- name: Install dependencies - name: Check lockfile and install dependencies
run: bun install run: |
# Check if bun.lock exists, if not check for bun.lockb
if [ -f "bun.lock" ]; then
echo "Using existing bun.lock file"
elif [ -f "bun.lockb" ]; then
echo "Found bun.lockb, creating symlink to bun.lock"
ln -s bun.lockb bun.lock
fi
bun install
- name: Run tests - name: Run tests
run: bunx vitest run run: bunx vitest run

View File

@@ -7,14 +7,14 @@ on:
- 'Dockerfile' - 'Dockerfile'
- '.dockerignore' - '.dockerignore'
- 'package.json' - 'package.json'
- 'bun.lock' - 'bun.lock*'
pull_request: pull_request:
branches: [ main ] branches: [ main ]
paths: paths:
- 'Dockerfile' - 'Dockerfile'
- '.dockerignore' - '.dockerignore'
- 'package.json' - 'package.json'
- 'bun.lock' - 'bun.lock*'
schedule: schedule:
- cron: '0 0 * * 0' # Run weekly on Sunday at midnight - cron: '0 0 * * 0' # Run weekly on Sunday at midnight

View File

@@ -6,7 +6,8 @@ RUN apk add --no-cache libc6-compat python3 make g++ gcc wget sqlite
# ---------------------------- # ----------------------------
FROM base AS deps FROM base AS deps
COPY package.json bun.lock ./ COPY package.json ./
COPY bun.lock* ./
RUN bun install --frozen-lockfile RUN bun install --frozen-lockfile
# ---------------------------- # ----------------------------