10 Commits

Author SHA1 Message Date
david 7ee336c51c fix: resolve release workflow version bump issues
Test / unit-tests (push) Has been cancelled
- Fixed bump-version.js to properly handle --yes flag in CI environments
- Added check to skip commit if no changes to package.json or CHANGELOG.md
- Ensured script exits cleanly after version bump with --yes flag
2026-03-31 23:18:18 -07:00
david d24e810ad1 refactor: revert CI image approach and use standard npm ci in workflows
Test / unit-tests (push) Successful in 2m32s
Pull Request / unit-tests (pull_request) Successful in 2m36s
Pull Request / acceptance-tests (pull_request) Failing after 4m59s
Pull Request / analyze-bump-type (pull_request) Has been skipped
The CI image approach with pre-installed dependencies doesn't work with Gitea Actions due to workspace mounting issues. When Gitea Actions runs a container job, it mounts the workspace at a specific path (e.g., /workspace/david/euchre_camp), which hides the container's /app directory where dependencies were installed.

Changes:
- Reverted pr.yml unit-tests to use node:20-alpine with npm ci
- Updated pr.yml acceptance-tests to use mcr.microsoft.com/playwright image with npm ci
- Updated test.yml to use node:20-alpine with npm ci
- Removed ci-image-builder.yml workflow
- Removed Dockerfile.ci and build-ci-image.sh
- Updated AGENTS.md and README.md to document the deprecation
- Updated justfile to remove CI image commands

The standard approach of running npm ci in each workflow is the recommended approach for Gitea Actions.
2026-03-31 23:10:50 -07:00
david 397594a9df fix: symlink from /app/node_modules to workspace
Test / unit-tests (push) Failing after 53s
Pull Request / unit-tests (pull_request) Failing after 54s
Pull Request / acceptance-tests (pull_request) Has been skipped
Pull Request / analyze-bump-type (pull_request) Has been skipped
2026-03-31 23:04:22 -07:00
david 4116884f9f fix: add /app/node_modules to PATH and NODE_PATH
Test / unit-tests (push) Failing after 11s
Pull Request / unit-tests (pull_request) Failing after 10s
Pull Request / acceptance-tests (pull_request) Has been skipped
Pull Request / analyze-bump-type (pull_request) Has been skipped
2026-03-31 23:02:56 -07:00
david b445d9044a chore: revert Dockerfile back to /app directory
Test / unit-tests (push) Failing after 8s
Pull Request / unit-tests (pull_request) Failing after 8s
Pull Request / acceptance-tests (pull_request) Has been skipped
Pull Request / analyze-bump-type (pull_request) Has been skipped
2026-03-31 23:01:48 -07:00
david 81c93bafc1 fix: use NODE_PATH env var instead of symlinks 2026-03-31 23:01:36 -07:00
david ba180ae6e1 fix: move node_modules to /workspace in CI image and update symlink
Test / unit-tests (push) Failing after 9s
Pull Request / unit-tests (pull_request) Failing after 9s
Pull Request / acceptance-tests (pull_request) Has been skipped
Pull Request / analyze-bump-type (pull_request) Has been skipped
2026-03-31 22:57:10 -07:00
david c611c68822 fix: use symlinks to link node_modules from container
Test / unit-tests (push) Failing after 52s
Pull Request / unit-tests (pull_request) Failing after 52s
Pull Request / acceptance-tests (pull_request) Has been skipped
Pull Request / analyze-bump-type (pull_request) Has been skipped
2026-03-31 22:53:40 -07:00
david 4c2687498f fix: update workflows to checkout in /app directory
Test / unit-tests (push) Failing after 5s
Pull Request / unit-tests (pull_request) Failing after 6s
Pull Request / acceptance-tests (pull_request) Has been skipped
Pull Request / analyze-bump-type (pull_request) Has been skipped
2026-03-31 22:41:11 -07:00
david 3983049d2c fix: use correct docker registry and image name
Pull Request / unit-tests (pull_request) Failing after 9s
Pull Request / acceptance-tests (pull_request) Has been skipped
Pull Request / analyze-bump-type (pull_request) Has been skipped
Test / unit-tests (push) Failing after 8s
2026-03-31 22:19:54 -07:00
10 changed files with 86 additions and 265 deletions
-82
View File
@@ -1,82 +0,0 @@
# CI Image Builder Workflow
# Automatically builds and pushes CI images when dependencies change
# Uses GitHub Container Registry (GHCR) or any container registry
name: CI Image Builder
on:
push:
branches:
- main
paths:
- 'package.json'
- 'package-lock.json'
- 'Dockerfile.ci'
- '.gitea/workflows/ci-image-builder.yml'
workflow_dispatch:
inputs:
force_rebuild:
description: 'Force rebuild even if no changes detected'
required: false
default: 'false'
type: boolean
env:
# Use GHCR or your own registry
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/ci-runner
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,prefix={{branch}}-
type=ref,event=branch
type=ref,event=pr
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push CI image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.ci
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Update workflow documentation
run: |
echo "CI Image built and pushed successfully!"
echo ""
echo "Available tags:"
echo " - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
echo " - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}"
echo ""
echo "To use in workflows:"
echo " container:"
echo " image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
+8 -9
View File
@@ -13,10 +13,6 @@ jobs:
options: --user root 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
@@ -30,7 +26,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: unit-tests needs: unit-tests
container: container:
image: node:20-alpine image: mcr.microsoft.com/playwright:v1.58.0-jammy
options: --user root options: --user root
env: env:
DATABASE_PROVIDER: sqlite DATABASE_PROVIDER: sqlite
@@ -38,18 +34,21 @@ jobs:
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'
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Generate Prisma client - name: Generate Prisma client
run: npx prisma generate run: npx prisma generate
env:
DATABASE_URL: postgresql://user:pass@localhost:5432/dummy
- name: Setup SQLite database - name: Setup SQLite database
run: | run: |
+6 -2
View File
@@ -80,8 +80,12 @@ jobs:
- name: Commit version bump - name: Commit version bump
run: | run: |
git add package.json CHANGELOG.md git add package.json CHANGELOG.md
git commit -m "chore: bump version to v${{ steps.version.outputs.new_version }}" if git diff --cached --quiet; then
git push origin main echo "No changes to commit (version may already be at target version)"
else
git commit -m "chore: bump version to v${{ steps.version.outputs.new_version }}"
git push origin main
fi
- name: Create git tag for release - name: Create git tag for release
run: | run: |
-4
View File
@@ -15,10 +15,6 @@ jobs:
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
+17 -14
View File
@@ -129,23 +129,26 @@ DATABASE_PROVIDER=sqlite DATABASE_URL=file:./prisma/ci.db npm run test:acceptanc
### CI Runner Image ### CI Runner Image
To speed up CI runs, the project uses a pre-built CI runner image with all dependencies pre-installed. **Note:** The CI runner image approach has been deprecated for Gitea Actions workflows.
**Building the CI image locally:** The original attempt to use a pre-built CI runner image with pre-installed dependencies encountered fundamental issues with how Gitea Actions handles workspace mounting. When Gitea Actions runs a container job, it mounts the workspace at a specific path (e.g., `/workspace/david/euchre_camp`), which hides the container's `/app` directory where dependencies were installed.
```bash
./scripts/build-ci-image.sh [tag]
```
**Using the CI image:** **Current Approach:**
- Workflows automatically use `ghcr.io/<repo>/ci-runner:latest` when available - Workflows use standard `node:20-alpine` or `mcr.microsoft.com/playwright` containers
- Falls back to `node:20-alpine` if image is not found - Dependencies are installed via `npm ci` in each workflow run
- Image is automatically rebuilt when `package.json` changes - This is the recommended approach for Gitea Actions
**CI Image contains:** **Why the CI image approach doesn't work:**
- Node.js 20 Alpine 1. Dockerfile.ci installs dependencies in `/app`
- All npm dependencies pre-installed 2. Gitea Actions mounts workspace at `/workspace/david/euchre_camp`
- Prisma client pre-generated 3. Workspace mount hides the `/app` directory
- System tools (bash, git, python, make, g++) 4. Symlinks from `/app/node_modules` don't work because `/app` is hidden
**Alternative for performance:**
If CI performance becomes an issue, consider:
- Using GitHub Actions cache for node_modules
- Using a self-hosted runner with persistent workspace
- Using the main Dockerfile's `test-runner` target for release workflows (which works because it builds a complete image)
### CI/CD Pipeline ### CI/CD Pipeline
The project uses Gitea Actions for continuous integration: The project uses Gitea Actions for continuous integration:
-46
View File
@@ -1,46 +0,0 @@
# CI Runner Image for EuchreCamp
# Pre-installed with all dependencies to speed up CI runs
# This image is rebuilt automatically when package.json changes
FROM node:20-alpine
# Install system dependencies needed for various tasks
RUN apk add --no-cache \
bash \
git \
curl \
python3 \
make \
g++ \
&& rm -rf /var/cache/apk/*
# Set working directory
WORKDIR /app
# Copy package files first (for better caching)
COPY package*.json ./
# Install ALL dependencies including dev dependencies
# This is done at image build time, not at CI runtime
RUN npm ci
# Copy Prisma schema (needed for Prisma client generation)
COPY prisma/schema.prisma ./prisma/
# Generate Prisma client
RUN npx prisma generate
# Copy the rest of the application
COPY . .
# Set environment variables for CI environment
ENV NODE_ENV=production
ENV DATABASE_PROVIDER=sqlite
ENV DATABASE_URL=file:./prisma/ci.db
ENV BETTER_AUTH_SECRET=test-secret-key-for-ci-only
# Verify installations
RUN node --version && npm --version && git --version && npx prisma --version
# Default command
CMD ["/bin/sh"]
+15 -26
View File
@@ -368,35 +368,27 @@ The application uses Gitea Actions for continuous integration and deployment:
- Unit tests for quick feedback - Unit tests for quick feedback
- Skips auto-generated version bumps - Skips auto-generated version bumps
3. **Release Workflow** (`.gitea/workflows/release.yml`): Runs on main branch pushes 3. **Release Workflow** (`.gitea/workflows/release.yml`): Runs on main branch pushes
- Version bumping and tagging - Version bumping and tagging
- Docker image building and testing - Docker image building and testing
- Registry push and deployment - Registry push and deployment
4. **CI Image Builder** (`.gitea/workflows/ci-image-builder.yml`): Runs when dependencies change
- Automatically builds CI runner image with all dependencies pre-installed
- Triggered by changes to `package.json`, `package-lock.json`, or `Dockerfile.ci`
### CI Runner Image ### CI Runner Image
To avoid installing dependencies on every workflow run, we use a pre-built CI runner image: **Note:** The CI runner image approach has been deprecated for Gitea Actions workflows.
**Dockerfile.ci** - Contains: The original attempt to use a pre-built CI runner image with pre-installed dependencies encountered fundamental issues with how Gitea Actions handles workspace mounting. When Gitea Actions runs a container job, it mounts the workspace at a specific path (e.g., `/workspace/david/euchre_camp`), which hides the container's `/app` directory where dependencies were installed.
- Node.js 20 Alpine
- All npm dependencies pre-installed
- Prisma client pre-generated
- System tools (bash, git, python, make, g++)
**Automatic Rebuilding:** **Current Approach:**
- The CI image is automatically rebuilt when `package.json` or `package-lock.json` changes - Workflows use standard `node:20-alpine` or `mcr.microsoft.com/playwright` containers
- Images are tagged with commit SHA for traceability - Dependencies are installed via `npm ci` in each workflow run
- Falls back to `node:20-alpine` if custom image is not available - This is the recommended approach for Gitea Actions
**Manual Build:** **Why the CI image approach doesn't work:**
```bash 1. Dockerfile.ci installs dependencies in `/app`
docker build -f Dockerfile.ci -t euchre-camp-ci:latest . 2. Gitea Actions mounts workspace at `/workspace/david/euchre_camp`
docker run --rm euchre-camp-ci:latest node --version 3. Workspace mount hides the `/app` directory
``` 4. Symlinks from `/app/node_modules` don't work because `/app` is hidden
### Database Strategy for CI ### Database Strategy for CI
- **CI Tests**: SQLite database (fast, no server required) - **CI Tests**: SQLite database (fast, no server required)
@@ -410,9 +402,6 @@ npm run test:run
# Run acceptance tests with SQLite # Run acceptance tests with SQLite
DATABASE_PROVIDER=sqlite DATABASE_URL=file:./prisma/ci.db npm run test:acceptance DATABASE_PROVIDER=sqlite DATABASE_URL=file:./prisma/ci.db npm run test:acceptance
# Run tests in CI container (if built)
docker run --rm -v $(pwd):/app -w /app euchre-camp-ci:latest npm run test:run
``` ```
## Docker Deployment ## Docker Deployment
+2 -10
View File
@@ -173,16 +173,6 @@ pr-validate: lint typecheck test-unit test-acceptance-sqlite
ci-postgres: lint typecheck test-unit test-acceptance-postgres docker-build ci-postgres: lint typecheck test-unit test-acceptance-postgres docker-build
@echo "CI Pipeline with PostgreSQL completed successfully!" @echo "CI Pipeline with PostgreSQL completed successfully!"
# --- CI Image ---
# Build CI runner image locally
ci-build:
@./scripts/build-ci-image.sh
# Build CI runner image with custom tag
ci-build-tag TAG:
@./scripts/build-ci-image.sh {{TAG}}
# --- Utilities --- # --- Utilities ---
# Show help information # Show help information
@@ -256,6 +246,8 @@ workflow-status:
@echo "PR Workflow: Runs unit + acceptance tests on pull requests" @echo "PR Workflow: Runs unit + acceptance tests on pull requests"
@echo "Test Workflow: Runs unit tests on all branch pushes" @echo "Test Workflow: Runs unit tests on all branch pushes"
@echo "Release Workflow: Runs on main branch pushes (version bump + Docker build)" @echo "Release Workflow: Runs on main branch pushes (version bump + Docker build)"
@echo ""
@echo "Note: CI image approach deprecated due to Gitea Actions workspace mounting"
# Check current database provider # Check current database provider
db-status: db-status:
-44
View File
@@ -1,44 +0,0 @@
#!/bin/bash
# Build and test the CI runner image locally
set -e
IMAGE_NAME="euchre-camp-ci"
TAG="${1:-latest}"
echo "Building CI runner image..."
echo "Image: ${IMAGE_NAME}:${TAG}"
echo ""
# Build the image
docker build \
-f Dockerfile.ci \
-t ${IMAGE_NAME}:${TAG} \
.
echo ""
echo "✅ Image built successfully!"
echo ""
# Test the image
echo "Testing CI image..."
docker run --rm ${IMAGE_NAME}:${TAG} sh -c "
echo 'Node.js version:' && node --version
echo 'npm version:' && npm --version
echo 'Git version:' && git --version
echo 'Prisma version:' && npx prisma --version
echo ''
echo 'Installed packages (top 10):'
npm list --depth=0 | head -10
"
echo ""
echo "✅ CI image is ready to use!"
echo ""
echo "To use in GitHub Actions/Gitea Actions:"
echo " container:"
echo " image: ${IMAGE_NAME}:${TAG}"
echo ""
echo "To push to registry:"
echo " docker tag ${IMAGE_NAME}:${TAG} registry.example.com/${IMAGE_NAME}:${TAG}"
echo " docker push registry.example.com/${IMAGE_NAME}:${TAG}"
+38 -28
View File
@@ -175,37 +175,47 @@ function main() {
console.log(`New version: ${currentVersion}${newVersion}`); console.log(`New version: ${currentVersion}${newVersion}`);
} }
// Confirm with user // Confirm with user (or skip if --yes flag is set)
const readline = require('readline'); if (skipConfirm) {
const rl = readline.createInterface({ // Update package.json
input: process.stdin, updatePackageJson(newVersion);
output: process.stdout
});
rl.question(`\nApply version ${newVersion}? (y/N) `, (answer) => { // Update changelog
if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') { if (bumpType !== 'custom') {
// Update package.json const commits = getCommitsSinceLastTag();
updatePackageJson(newVersion); updateChangelog(newVersion, commits, bumpType);
// Update changelog
if (bumpType !== 'custom') {
const commits = getCommitsSinceLastTag();
updateChangelog(newVersion, commits, bumpType);
}
console.log(`\n✅ Version bumped to ${newVersion}`);
console.log(`\nNext steps:`);
console.log(` 1. Review changes: git diff`);
console.log(` 2. Commit changes: git commit -am "chore: bump version to v${newVersion}"`);
console.log(` 3. Create tag: git tag -a v${newVersion} -m "Release v${newVersion}"`);
console.log(` 4. Push changes: git push origin main`);
console.log(` 5. Push tag: git push origin v${newVersion}`);
} else {
console.log('❌ Version bump cancelled');
} }
rl.close(); console.log(`\n✅ Version bumped to ${newVersion}`);
}); process.exit(0);
} else {
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question(`\nApply version ${newVersion}? (y/N) `, (answer) => {
if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
// Update package.json
updatePackageJson(newVersion);
// Update changelog
if (bumpType !== 'custom') {
const commits = getCommitsSinceLastTag();
updateChangelog(newVersion, commits, bumpType);
}
console.log(`\n✅ Version bumped to ${newVersion}`);
process.exit(0);
} else {
console.log('❌ Version bump cancelled');
process.exit(1);
}
rl.close();
});
}
} }
// Run main function // Run main function