Compare commits
7 Commits
v0.1.3
..
ba180ae6e1
| Author | SHA1 | Date | |
|---|---|---|---|
| ba180ae6e1 | |||
| c611c68822 | |||
| 4c2687498f | |||
| 3983049d2c | |||
| 941d857feb | |||
| b686c3673e | |||
| dfd66cde0b |
@@ -0,0 +1,80 @@
|
|||||||
|
# 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 your existing Docker registry
|
||||||
|
REGISTRY: docker.notsosm.art
|
||||||
|
IMAGE_NAME: euchre-camp-ci-runner
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-ci-image:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
# Skip if this is an auto-generated version bump commit
|
||||||
|
if: "!contains(github.event.head_commit.message, 'chore: bump version')"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Build CI image
|
||||||
|
run: |
|
||||||
|
docker build \
|
||||||
|
-f Dockerfile.ci \
|
||||||
|
-t ${{ env.IMAGE_NAME }}:latest \
|
||||||
|
-t ${{ env.IMAGE_NAME }}:$(git rev-parse --short HEAD) \
|
||||||
|
.
|
||||||
|
|
||||||
|
- name: Test CI image
|
||||||
|
run: |
|
||||||
|
docker run --rm \
|
||||||
|
${{ env.IMAGE_NAME }}:latest \
|
||||||
|
sh -c "node --version && npm --version && npx prisma --version"
|
||||||
|
|
||||||
|
- name: Push to registry
|
||||||
|
run: |
|
||||||
|
echo "Pushing to ${{ env.REGISTRY }}..."
|
||||||
|
# Check if we can authenticate to the registry using DOCKER_LOGIN and DOCKER_PASSWORD secrets
|
||||||
|
if [ -n "${{ secrets.DOCKER_LOGIN }}" ] && [ -n "${{ secrets.DOCKER_PASSWORD }}" ]; then
|
||||||
|
if docker login ${{ env.REGISTRY }} -u ${{ secrets.DOCKER_LOGIN }} -p ${{ secrets.DOCKER_PASSWORD }} 2>/dev/null; then
|
||||||
|
docker tag ${{ env.IMAGE_NAME }}:latest ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
echo "Successfully pushed CI image to ${{ env.REGISTRY }}"
|
||||||
|
else
|
||||||
|
echo "Warning: Docker login failed with provided credentials"
|
||||||
|
echo "CI image built locally but not pushed to registry"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Warning: DOCKER_LOGIN or DOCKER_PASSWORD secrets not configured"
|
||||||
|
echo "CI image built locally but not pushed to registry"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Show usage instructions
|
||||||
|
run: |
|
||||||
|
echo "CI Image built successfully!"
|
||||||
|
echo ""
|
||||||
|
echo "To use in workflows:"
|
||||||
|
echo " container:"
|
||||||
|
echo " image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
|
||||||
+12
-16
@@ -9,15 +9,19 @@ jobs:
|
|||||||
unit-tests:
|
unit-tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: node:20-alpine
|
image: docker.notsosm.art/euchre-camp-ci-runner:latest
|
||||||
options: --user root
|
options: --user root
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Link node_modules from container
|
||||||
run: npm ci
|
run: |
|
||||||
|
# Create symlink to pre-installed node_modules in container
|
||||||
|
# Container has node_modules at /workspace/node_modules
|
||||||
|
# Gitea Actions checks out at /workspace/david/euchre_camp
|
||||||
|
ln -sf /workspace/node_modules ./node_modules
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: npm run test:run
|
run: npm run test:run
|
||||||
@@ -26,7 +30,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: unit-tests
|
needs: unit-tests
|
||||||
container:
|
container:
|
||||||
image: mcr.microsoft.com/playwright:v1.58.0-jammy
|
image: docker.notsosm.art/euchre-camp-ci-runner:latest
|
||||||
options: --user root
|
options: --user root
|
||||||
env:
|
env:
|
||||||
DATABASE_PROVIDER: sqlite
|
DATABASE_PROVIDER: sqlite
|
||||||
@@ -37,18 +41,10 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Link node_modules from container
|
||||||
uses: actions/setup-node@v4
|
run: |
|
||||||
with:
|
# Create symlink to pre-installed node_modules in container
|
||||||
node-version: '20'
|
ln -sf /workspace/node_modules ./node_modules
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Generate Prisma client
|
|
||||||
run: npx prisma generate
|
|
||||||
env:
|
|
||||||
DATABASE_URL: postgresql://user:pass@localhost:5432/dummy
|
|
||||||
|
|
||||||
- name: Setup SQLite database
|
- name: Setup SQLite database
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -78,38 +78,22 @@ jobs:
|
|||||||
echo "New version: $NEW_VERSION"
|
echo "New version: $NEW_VERSION"
|
||||||
|
|
||||||
- name: Commit version bump
|
- name: Commit version bump
|
||||||
id: commit
|
|
||||||
run: |
|
run: |
|
||||||
git add package.json CHANGELOG.md
|
git add package.json CHANGELOG.md
|
||||||
if git diff --cached --quiet; then
|
|
||||||
echo "No changes to commit (version may already be at target version)"
|
|
||||||
echo "committed=false" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
git commit -m "chore: bump version to v${{ steps.version.outputs.new_version }}"
|
git commit -m "chore: bump version to v${{ steps.version.outputs.new_version }}"
|
||||||
git push origin main
|
git push origin main
|
||||||
echo "committed=true" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Create git tag for release
|
- name: Create git tag for release
|
||||||
if: steps.commit.outputs.committed == 'true'
|
|
||||||
run: |
|
run: |
|
||||||
TAG_NAME="v${{ steps.version.outputs.new_version }}"
|
TAG_NAME="v${{ steps.version.outputs.new_version }}"
|
||||||
echo "Creating tag $TAG_NAME"
|
echo "Creating tag $TAG_NAME"
|
||||||
|
|
||||||
# Check if tag already exists
|
|
||||||
if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
|
|
||||||
echo "Tag $TAG_NAME already exists, skipping tag creation"
|
|
||||||
else
|
|
||||||
git tag -a "$TAG_NAME" -m "Release $TAG_NAME"
|
git tag -a "$TAG_NAME" -m "Release $TAG_NAME"
|
||||||
git push origin "$TAG_NAME"
|
git push origin "$TAG_NAME"
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
if: steps.commit.outputs.committed == 'true'
|
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Build test-capable image
|
- name: Build test-capable image
|
||||||
if: steps.commit.outputs.committed == 'true'
|
|
||||||
run: |
|
run: |
|
||||||
docker build \
|
docker build \
|
||||||
--target test-runner \
|
--target test-runner \
|
||||||
@@ -118,7 +102,6 @@ jobs:
|
|||||||
.
|
.
|
||||||
|
|
||||||
- name: Run tests inside test-capable container
|
- name: Run tests inside test-capable container
|
||||||
if: steps.commit.outputs.committed == 'true'
|
|
||||||
run: |
|
run: |
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-e DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" \
|
-e DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" \
|
||||||
@@ -126,7 +109,6 @@ jobs:
|
|||||||
npm run test:run
|
npm run test:run
|
||||||
|
|
||||||
- name: Build production image
|
- name: Build production image
|
||||||
if: steps.commit.outputs.committed == 'true'
|
|
||||||
run: |
|
run: |
|
||||||
docker build \
|
docker build \
|
||||||
--target runner \
|
--target runner \
|
||||||
@@ -136,7 +118,6 @@ jobs:
|
|||||||
.
|
.
|
||||||
|
|
||||||
- name: Push Docker images
|
- name: Push Docker images
|
||||||
if: steps.commit.outputs.committed == 'true'
|
|
||||||
run: |
|
run: |
|
||||||
echo "Pushing to ${{ env.REGISTRY }}..."
|
echo "Pushing to ${{ env.REGISTRY }}..."
|
||||||
# Check if we can authenticate to the registry using DOCKER_LOGIN and DOCKER_PASSWORD secrets
|
# Check if we can authenticate to the registry using DOCKER_LOGIN and DOCKER_PASSWORD secrets
|
||||||
@@ -161,7 +142,6 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Deploy to dev (placeholder)
|
- name: Deploy to dev (placeholder)
|
||||||
if: steps.commit.outputs.committed == 'true'
|
|
||||||
run: |
|
run: |
|
||||||
echo "Deploying version ${{ steps.version.outputs.new_version }} to dev environment..."
|
echo "Deploying version ${{ steps.version.outputs.new_version }} to dev environment..."
|
||||||
# TODO: Add actual deployment steps
|
# TODO: Add actual deployment steps
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ jobs:
|
|||||||
unit-tests:
|
unit-tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: node:20-alpine
|
image: docker.notsosm.art/euchre-camp-ci-runner:latest
|
||||||
options: --user root
|
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')"
|
||||||
@@ -18,8 +18,10 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Link node_modules from container
|
||||||
run: npm ci
|
run: |
|
||||||
|
# Create symlink to pre-installed node_modules in container
|
||||||
|
ln -sf /workspace/node_modules ./node_modules
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: npm run test:run
|
run: npm run test:run
|
||||||
|
|||||||
@@ -129,26 +129,23 @@ DATABASE_PROVIDER=sqlite DATABASE_URL=file:./prisma/ci.db npm run test:acceptanc
|
|||||||
|
|
||||||
### CI Runner Image
|
### CI Runner Image
|
||||||
|
|
||||||
**Note:** The CI runner image approach has been deprecated for Gitea Actions workflows.
|
To speed up CI runs, the project uses a pre-built CI runner image with all dependencies pre-installed.
|
||||||
|
|
||||||
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.
|
**Building the CI image locally:**
|
||||||
|
```bash
|
||||||
|
./scripts/build-ci-image.sh [tag]
|
||||||
|
```
|
||||||
|
|
||||||
**Current Approach:**
|
**Using the CI image:**
|
||||||
- Workflows use standard `node:20-alpine` or `mcr.microsoft.com/playwright` containers
|
- Workflows automatically use `ghcr.io/<repo>/ci-runner:latest` when available
|
||||||
- Dependencies are installed via `npm ci` in each workflow run
|
- Falls back to `node:20-alpine` if image is not found
|
||||||
- This is the recommended approach for Gitea Actions
|
- Image is automatically rebuilt when `package.json` changes
|
||||||
|
|
||||||
**Why the CI image approach doesn't work:**
|
**CI Image contains:**
|
||||||
1. Dockerfile.ci installs dependencies in `/app`
|
- Node.js 20 Alpine
|
||||||
2. Gitea Actions mounts workspace at `/workspace/david/euchre_camp`
|
- All npm dependencies pre-installed
|
||||||
3. Workspace mount hides the `/app` directory
|
- Prisma client pre-generated
|
||||||
4. Symlinks from `/app/node_modules` don't work because `/app` is hidden
|
- System tools (bash, git, python, make, g++)
|
||||||
|
|
||||||
**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:
|
||||||
|
|||||||
@@ -1,28 +1,3 @@
|
|||||||
## [0.1.3] - 2026-04-01
|
|
||||||
|
|
||||||
### Patch Changes
|
|
||||||
|
|
||||||
- fix: skip release steps if no version bump commit was made
|
|
||||||
- fix: improve error handling in getCommitsSinceLastTag
|
|
||||||
- fix: add tag existence check in release workflow
|
|
||||||
- fix: resolve release workflow version bump issues
|
|
||||||
- ci-image-improvements (#18)
|
|
||||||
- fix: version bumping and Docker registry authentication (#17)
|
|
||||||
- fix: handle Docker registry authentication gracefully in release workflow
|
|
||||||
- fix: run unit tests on branch commits, skip main branch
|
|
||||||
- feat: add test workflow for every commit
|
|
||||||
- trigger: release with test-capable image
|
|
||||||
- feat: build test-capable image, run tests, then build production image
|
|
||||||
- trigger: release workflow
|
|
||||||
- fix: release workflow should not commit, only tag
|
|
||||||
- trigger: manual workflow trigger for docker.notsosm.art
|
|
||||||
- fix: update Docker build script to use docker.notsosm.art registry
|
|
||||||
- fix: update workflow to use docker.notsosm.art registry
|
|
||||||
- trigger: manual workflow trigger
|
|
||||||
- fix: update workflow to use correct Docker registries
|
|
||||||
- feat: add Gitea Actions release workflow
|
|
||||||
- feat: add view match link to admin matches page
|
|
||||||
|
|
||||||
## [0.1.2] - 2026-04-01
|
## [0.1.2] - 2026-04-01
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
# 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 /workspace
|
||||||
|
|
||||||
|
# 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"]
|
||||||
@@ -368,27 +368,35 @@ 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
|
||||||
|
|
||||||
**Note:** The CI runner image approach has been deprecated for Gitea Actions workflows.
|
To avoid installing dependencies on every workflow run, we use a pre-built CI runner image:
|
||||||
|
|
||||||
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.
|
**Dockerfile.ci** - Contains:
|
||||||
|
- Node.js 20 Alpine
|
||||||
|
- All npm dependencies pre-installed
|
||||||
|
- Prisma client pre-generated
|
||||||
|
- System tools (bash, git, python, make, g++)
|
||||||
|
|
||||||
**Current Approach:**
|
**Automatic Rebuilding:**
|
||||||
- Workflows use standard `node:20-alpine` or `mcr.microsoft.com/playwright` containers
|
- The CI image is automatically rebuilt when `package.json` or `package-lock.json` changes
|
||||||
- Dependencies are installed via `npm ci` in each workflow run
|
- Images are tagged with commit SHA for traceability
|
||||||
- This is the recommended approach for Gitea Actions
|
- Falls back to `node:20-alpine` if custom image is not available
|
||||||
|
|
||||||
**Why the CI image approach doesn't work:**
|
**Manual Build:**
|
||||||
1. Dockerfile.ci installs dependencies in `/app`
|
```bash
|
||||||
2. Gitea Actions mounts workspace at `/workspace/david/euchre_camp`
|
docker build -f Dockerfile.ci -t euchre-camp-ci:latest .
|
||||||
3. Workspace mount hides the `/app` directory
|
docker run --rm euchre-camp-ci:latest node --version
|
||||||
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)
|
||||||
@@ -402,6 +410,9 @@ 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
|
||||||
|
|||||||
@@ -173,6 +173,16 @@ 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
|
||||||
@@ -246,8 +256,6 @@ 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:
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "euchre_camp",
|
"name": "euchre_camp",
|
||||||
"version": "0.1.3",
|
"version": "0.1.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "NEXT_PUBLIC_GIT_COMMIT=$(git rev-parse --short HEAD) next dev",
|
"dev": "NEXT_PUBLIC_GIT_COMMIT=$(git rev-parse --short HEAD) next dev",
|
||||||
|
|||||||
Executable
+44
@@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Build and test the CI runner image locally
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
IMAGE_NAME="euchre-camp-ci-runner"
|
||||||
|
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: docker.notsosm.art/${IMAGE_NAME}:${TAG}"
|
||||||
|
echo ""
|
||||||
|
echo "To push to registry:"
|
||||||
|
echo " docker tag ${IMAGE_NAME}:${TAG} docker.notsosm.art/${IMAGE_NAME}:${TAG}"
|
||||||
|
echo " docker push docker.notsosm.art/${IMAGE_NAME}:${TAG}"
|
||||||
+9
-27
@@ -48,22 +48,14 @@ function getCommitsSinceLastTag() {
|
|||||||
|
|
||||||
if (!latestTag) {
|
if (!latestTag) {
|
||||||
// No tags yet, get all commits
|
// No tags yet, get all commits
|
||||||
const commits = execSync('git log --oneline --format=%s', { encoding: 'utf8' }).trim();
|
return execSync('git log --oneline --format=%s', { encoding: 'utf8' }).trim().split('\n');
|
||||||
return commits ? commits.split('\n') : [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const commits = execSync(`git log ${latestTag}..HEAD --oneline --format=%s`, { encoding: 'utf8' }).trim();
|
const commits = execSync(`git log ${latestTag}..HEAD --oneline --format=%s`, { encoding: 'utf8' }).trim();
|
||||||
return commits ? commits.split('\n') : [];
|
return commits ? commits.split('\n') : [];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// If no commits since tag or other error, get recent commits
|
// If no commits since tag or other error, get recent commits
|
||||||
try {
|
return execSync('git log --oneline --format=%s -n 20', { encoding: 'utf8' }).trim().split('\n');
|
||||||
const commits = execSync('git log --oneline --format=%s -n 20', { encoding: 'utf8' }).trim();
|
|
||||||
return commits ? commits.split('\n') : [];
|
|
||||||
} catch (innerError) {
|
|
||||||
// If all git log attempts fail, return empty array
|
|
||||||
console.warn('Warning: Could not retrieve commit history, defaulting to patch version');
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,20 +175,7 @@ function main() {
|
|||||||
console.log(`New version: ${currentVersion} → ${newVersion}`);
|
console.log(`New version: ${currentVersion} → ${newVersion}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirm with user (or skip if --yes flag is set)
|
// Confirm with user
|
||||||
if (skipConfirm) {
|
|
||||||
// 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 {
|
|
||||||
const readline = require('readline');
|
const readline = require('readline');
|
||||||
const rl = readline.createInterface({
|
const rl = readline.createInterface({
|
||||||
input: process.stdin,
|
input: process.stdin,
|
||||||
@@ -215,15 +194,18 @@ function main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log(`\n✅ Version bumped to ${newVersion}`);
|
console.log(`\n✅ Version bumped to ${newVersion}`);
|
||||||
process.exit(0);
|
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 {
|
} else {
|
||||||
console.log('❌ Version bump cancelled');
|
console.log('❌ Version bump cancelled');
|
||||||
process.exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rl.close();
|
rl.close();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run main function
|
// Run main function
|
||||||
|
|||||||
Reference in New Issue
Block a user