Compare commits
14 Commits
v0.1.1
...
9768ff3517
| Author | SHA1 | Date | |
|---|---|---|---|
| 9768ff3517 | |||
| 0343fa91d2 | |||
| b654571a37 | |||
| 0090611994 | |||
| 9416159712 | |||
| d39172ca44 | |||
| cd119694ed | |||
| 3e4e896677 | |||
| 5e2dbbc2be | |||
| da9c6ae70b | |||
| 8cf3f2d401 | |||
| 69abec3b87 | |||
| 92c064c264 | |||
| 59009f0bf7 |
@@ -0,0 +1,87 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: docker.notsosm.art
|
||||||
|
IMAGE_NAME: euchre-camp
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.head_commit.message, 'chore: bump version')"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Get current version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
# Read version from package.json
|
||||||
|
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
||||||
|
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
||||||
|
echo "Current version: $CURRENT_VERSION"
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Build test-capable image
|
||||||
|
run: |
|
||||||
|
docker build \
|
||||||
|
--target test-runner \
|
||||||
|
--build-arg GIT_COMMIT=${{ github.sha }} \
|
||||||
|
-t ${{ env.IMAGE_NAME }}-test:${{ steps.version.outputs.version }} \
|
||||||
|
.
|
||||||
|
|
||||||
|
- name: Run tests inside test-capable container
|
||||||
|
run: |
|
||||||
|
docker run --rm \
|
||||||
|
-e DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" \
|
||||||
|
${{ env.IMAGE_NAME }}-test:${{ steps.version.outputs.version }} \
|
||||||
|
npm run test:run
|
||||||
|
|
||||||
|
- name: Build production image
|
||||||
|
run: |
|
||||||
|
docker build \
|
||||||
|
--target runner \
|
||||||
|
--build-arg GIT_COMMIT=${{ github.sha }} \
|
||||||
|
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }} \
|
||||||
|
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
|
||||||
|
.
|
||||||
|
|
||||||
|
- name: Configure Git
|
||||||
|
run: |
|
||||||
|
git config user.name "Gitea Actions"
|
||||||
|
git config user.email "actions@gitea.com"
|
||||||
|
|
||||||
|
- name: Create git tag for release
|
||||||
|
run: |
|
||||||
|
git tag -a "v${{ steps.version.outputs.version }}" -m "Release v${{ steps.version.outputs.version }}"
|
||||||
|
git push origin "v${{ steps.version.outputs.version }}"
|
||||||
|
|
||||||
|
- name: Push Docker images
|
||||||
|
run: |
|
||||||
|
echo "Pushing to ${{ env.REGISTRY }}..."
|
||||||
|
# Check if we can authenticate to the registry
|
||||||
|
if docker login ${{ env.REGISTRY }} -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} 2>/dev/null; then
|
||||||
|
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
|
||||||
|
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
echo "Successfully pushed images to ${{ env.REGISTRY }}"
|
||||||
|
else
|
||||||
|
echo "Warning: Could not authenticate to ${{ env.REGISTRY }}"
|
||||||
|
echo "Images built locally but not pushed to registry"
|
||||||
|
echo "Manual push required:"
|
||||||
|
echo " docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}"
|
||||||
|
echo " docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Deploy to dev (placeholder)
|
||||||
|
run: |
|
||||||
|
echo "Deploying version ${{ steps.version.outputs.version }} to dev environment..."
|
||||||
|
# TODO: Add actual deployment steps
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
name: Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
- '!main' # Skip main branch (release workflow handles that)
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
unit-tests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Run unit tests
|
||||||
|
run: npm run test:run
|
||||||
|
|
||||||
|
# Acceptance tests that don't require DB read/write
|
||||||
|
# Only run on pull requests to main
|
||||||
|
safe-acceptance-tests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: unit-tests
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Run safe acceptance tests
|
||||||
|
# These tests should not read/write to the database
|
||||||
|
# They might test UI components, routing, or static content
|
||||||
|
run: npm run test:acceptance -- --grep "safe|static|ui|component"
|
||||||
+22
-1
@@ -26,7 +26,28 @@ RUN DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" npx prisma genera
|
|||||||
ARG GIT_COMMIT=unknown
|
ARG GIT_COMMIT=unknown
|
||||||
RUN DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" NEXT_PUBLIC_GIT_COMMIT=$GIT_COMMIT npm run build
|
RUN DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" NEXT_PUBLIC_GIT_COMMIT=$GIT_COMMIT npm run build
|
||||||
|
|
||||||
# Stage 2: Runner
|
# Stage 2: Test runner (includes dev dependencies for testing)
|
||||||
|
FROM node:20-alpine AS test-runner
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN apk add --no-cache python3 make g++ git
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy package files
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
# Install ALL dependencies (including dev dependencies for testing)
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
# Copy source code
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Generate Prisma client
|
||||||
|
RUN DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" npx prisma generate
|
||||||
|
|
||||||
|
# Stage 3: Production runner
|
||||||
FROM node:20-alpine AS runner
|
FROM node:20-alpine AS runner
|
||||||
|
|
||||||
# Install dumb-init for proper signal handling
|
# Install dumb-init for proper signal handling
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
// Configuration
|
// Configuration
|
||||||
const REGISTRY = 'euchre-camp';
|
const REGISTRY = 'docker.notsosm.art';
|
||||||
const IMAGE_NAME = 'euchre-camp';
|
const IMAGE_NAME = 'euchre-camp';
|
||||||
const FULL_IMAGE_NAME = `${REGISTRY}/${IMAGE_NAME}`;
|
const FULL_IMAGE_NAME = `${REGISTRY}/${IMAGE_NAME}`;
|
||||||
|
|
||||||
|
|||||||
@@ -168,6 +168,13 @@ export default function AdminMatchesPage() {
|
|||||||
{match.team2Score}
|
{match.team2Score}
|
||||||
</td>
|
</td>
|
||||||
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
||||||
|
<div className="flex gap-3">
|
||||||
|
<Link
|
||||||
|
href={`/matches/${match.id}`}
|
||||||
|
className="text-blue-600 hover:text-blue-900"
|
||||||
|
>
|
||||||
|
View
|
||||||
|
</Link>
|
||||||
<button
|
<button
|
||||||
onClick={() => handleDelete(match.id)}
|
onClick={() => handleDelete(match.id)}
|
||||||
disabled={deletingId === match.id}
|
disabled={deletingId === match.id}
|
||||||
@@ -175,6 +182,7 @@ export default function AdminMatchesPage() {
|
|||||||
>
|
>
|
||||||
{deletingId === match.id ? "Deleting..." : "Delete"}
|
{deletingId === match.id ? "Deleting..." : "Delete"}
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in New Issue
Block a user