3 Commits

Author SHA1 Message Date
david fa6c4369a6 chore: update justfile with container testing note
Test / unit-tests (push) Successful in 2m39s
Pull Request / unit-tests (pull_request) Successful in 2m40s
Pull Request / acceptance-tests (pull_request) Failing after 1m56s
Pull Request / analyze-bump-type (pull_request) Has been skipped
2026-03-31 21:58:55 -07:00
david 9c884ee020 chore: add script for running tests in Docker container 2026-03-31 21:58:49 -07:00
david 5b91cf1426 ci: use node:20-alpine container to avoid Node.js setup time 2026-03-31 21:58:37 -07:00
4 changed files with 37 additions and 18 deletions
+14 -12
View File
@@ -8,17 +8,18 @@ on:
jobs: jobs:
unit-tests: unit-tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: node:20-alpine
options: --user root
steps: steps:
- name: Install system dependencies
run: |
apk add --no-cache bash git
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
@@ -28,21 +29,22 @@ jobs:
acceptance-tests: acceptance-tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: unit-tests needs: unit-tests
container:
image: node:20-alpine
options: --user root
env: env:
DATABASE_PROVIDER: sqlite DATABASE_PROVIDER: sqlite
DATABASE_URL: file:./prisma/ci.db DATABASE_URL: file:./prisma/ci.db
BETTER_AUTH_SECRET: test-secret-key-for-ci-only BETTER_AUTH_SECRET: test-secret-key-for-ci-only
steps: steps:
- name: Install system dependencies
run: |
apk add --no-cache bash git
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
+7 -6
View File
@@ -8,19 +8,20 @@ on:
jobs: jobs:
unit-tests: unit-tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: node:20-alpine
options: --user root
# Skip if this is an auto-generated version bump commit (handled by release workflow) # Skip if this is an auto-generated version bump commit (handled by release workflow)
if: "!contains(github.event.head_commit.message, 'chore: bump version')" if: "!contains(github.event.head_commit.message, 'chore: bump version')"
steps: steps:
- name: Install system dependencies
run: |
apk add --no-cache bash git
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
+1
View File
@@ -57,6 +57,7 @@ format:
# --- Testing --- # --- Testing ---
# Run all tests (unit + acceptance with SQLite) # Run all tests (unit + acceptance with SQLite)
# Note: Uses Docker containers for consistent environment
test: test-unit test-acceptance-sqlite test: test-unit test-acceptance-sqlite
# Run all tests with PostgreSQL (Docker) # Run all tests with PostgreSQL (Docker)
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
# Run tests in a Node.js container (for consistent environment)
set -e
echo "Running tests in node:20-alpine container..."
echo "This avoids Node.js setup time and ensures consistent environment."
echo ""
# Run unit tests in container
docker run --rm \
-v "$(pwd):/app" \
-w /app \
node:20-alpine \
sh -c "apk add --no-cache bash git && npm ci && npm run test:run"