15 Commits

Author SHA1 Message Date
david 56a56e590e fix: add explicit --context and --file to all docker build commands 2026-05-14 18:17:53 -07:00
david 9a6188b2ae fix: use explicit --context and --file for docker build in CI 2026-05-14 18:16:54 -07:00
david fea0585a75 test: improve mock error handling and add test cleanup 2026-05-14 17:56:35 -07:00
david 820b1d8d84 fix: remove unused prisma import causing DATABASE_URL error in CI
Pull Request / unit-tests (pull_request) Failing after 1m14s
Pull Request / build-and-deploy-ci (pull_request) Has been skipped
Pull Request / analyze-bump-type (pull_request) Has been skipped
2026-05-07 03:25:46 -07:00
david 48b524ef84 remove push on ci build
Pull Request / unit-tests (pull_request) Failing after 1m4s
Pull Request / build-and-deploy-ci (pull_request) Has been skipped
Pull Request / analyze-bump-type (pull_request) Has been skipped
2026-05-07 03:16:14 -07:00
david e602e83642 sanitize docker tags
Pull Request / unit-tests (pull_request) Failing after 1m0s
Pull Request / build-and-deploy-ci (pull_request) Has been skipped
Pull Request / analyze-bump-type (pull_request) Has been skipped
2026-05-07 03:10:48 -07:00
david ac8562ea51 feat: implement full CI/CD pipeline with staged deployments
Pull Request / unit-tests (pull_request) Failing after 5m34s
Pull Request / build-and-deploy-ci (pull_request) Has been skipped
Pull Request / analyze-bump-type (pull_request) Has been skipped
- PR workflow: build, deploy to CI site, wait for health, run acceptance tests
- Release workflow: deploy to dev using mounted compose path with health check
- Add deploy-prod workflow (workflow_dispatch) for human-gated prod deployment
- Add just recipes: deploy-prod, status (view current image tags across envs)
- Runners now have /apps mount for access to all environment compose files
2026-05-07 02:30:30 -07:00
david b1c4e9a0ce ci: reduce retries to 1 and increase workers to 2
Pull Request / unit-tests (pull_request) Successful in 1m28s
Pull Request / analyze-bump-type (pull_request) Successful in 16s
Pull Request / acceptance-tests (pull_request) Failing after 10m4s
- Retries reduced from 2 to 1 (retries are helping with flaky remote tests but 2 is overkill)
- Workers increased from 1 to 2 in CI for parallel project execution
2026-05-03 18:04:01 -07:00
david 413ebaeaee fix: correct CI test configuration and Navigation test provider
Pull Request / unit-tests (pull_request) Successful in 1m25s
Pull Request / analyze-bump-type (pull_request) Successful in 12s
Pull Request / acceptance-tests (pull_request) Has been cancelled
- Wrap Navigation tests in RoleSwitcherProvider to fix 6 test failures
- Use remote CI server URL (euchre-ci.notsosm.art) for acceptance tests in CI
- Fix DATABASE_URL reference from vars to secrets in PR workflow
2026-05-03 17:35:39 -07:00
david f27efebd82 fix: add PrismaPg adapter for PostgreSQL and fix GRANT statements
Pull Request / unit-tests (pull_request) Failing after 1m28s
Pull Request / acceptance-tests (pull_request) Failing after 1m28s
Pull Request / analyze-bump-type (pull_request) Has been skipped
2026-05-03 17:08:16 -07:00
david 30ea4e4e86 ci: add acceptance tests job with CI database and sync-dev recipe 2026-05-03 16:31:45 -07:00
david 75cb6ed29d feat: add global teardown config and disable webServer in CI 2026-05-03 16:31:39 -07:00
david fa13ed86c9 fix: correct isProductionDatabase() to allow CI database and add schema reset 2026-05-03 16:31:36 -07:00
david 66e574d5ec docs: update .env.example with SDLC environment documentation 2026-05-03 16:27:50 -07:00
david a9138cfbe4 feat: add home page and rankings E2E tests with workflow improvements 2026-05-03 15:30:34 -07:00
6 changed files with 46 additions and 45 deletions
+4 -3
View File
@@ -52,13 +52,14 @@ jobs:
- name: Build and push CI base image
run: |
WORKSPACE_DIR="$GITHUB_WORKSPACE"
# Build with multiple tags
docker build \
--file Dockerfile.ci-base \
--context "$WORKSPACE_DIR" \
--file "$WORKSPACE_DIR/Dockerfile.ci-base" \
--tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-base:latest \
--tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-base:playwright-${{ steps.meta.outputs.playwright_version }} \
--tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-base:${{ github.sha }} \
--push \
.
- name: Clean up
if: always()
+6 -6
View File
@@ -15,8 +15,6 @@ jobs:
container:
image: docker.notsosm.art/euchre-camp/ci-base:latest
options: --user root
env:
DATABASE_URL: postgresql://user:pass@localhost:5432/dummy
steps:
- name: Checkout code
@@ -27,6 +25,8 @@ jobs:
- name: Generate Prisma client
run: bun x prisma generate
env:
DATABASE_URL: postgresql://user:pass@localhost:5432/dummy
- name: Run unit tests
run: bun test src/__tests__/unit/ src/__tests__/*.test.tsx src/__tests__/auth-simple.test.ts
@@ -37,9 +37,6 @@ jobs:
container:
image: docker.notsosm.art/euchre-camp/ci-base:latest
options: --user root
volumes:
- /apps:/apps
- /var/run/docker.sock:/var/run/docker.sock
steps:
- name: Checkout code
@@ -61,12 +58,15 @@ jobs:
- name: Build Docker image for PR
run: |
WORKSPACE_DIR="$GITHUB_WORKSPACE"
IMAGE_TAG="pr-${{ steps.info.outputs.pr_number }}-${{ steps.info.outputs.short_sha }}"
docker build \
--context "$WORKSPACE_DIR" \
--file "$WORKSPACE_DIR/Dockerfile" \
--target runner \
--build-arg GIT_COMMIT=$GITHUB_SHA \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${IMAGE_TAG} \
.
"$WORKSPACE_DIR"
- name: Update CI site compose and restart
run: |
+8 -2
View File
@@ -110,11 +110,14 @@ jobs:
- name: Build test-capable image
if: steps.commit.outputs.committed == 'true'
run: |
WORKSPACE_DIR="$GITHUB_WORKSPACE"
docker build \
--context "$WORKSPACE_DIR" \
--file "$WORKSPACE_DIR/Dockerfile" \
--target test-runner \
--build-arg GIT_COMMIT=${{ github.sha }} \
-t ${{ env.IMAGE_NAME }}-test:${{ steps.version.outputs.new_version }} \
.
"$WORKSPACE_DIR"
- name: Run tests inside test-capable container
if: steps.commit.outputs.committed == 'true'
@@ -127,12 +130,15 @@ jobs:
- name: Build production image
if: steps.commit.outputs.committed == 'true'
run: |
WORKSPACE_DIR="$GITHUB_WORKSPACE"
docker build \
--context "$WORKSPACE_DIR" \
--file "$WORKSPACE_DIR/Dockerfile" \
--target runner \
--build-arg GIT_COMMIT=${{ github.sha }} \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.new_version }} \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
.
"$WORKSPACE_DIR"
- name: Push Docker images
if: steps.commit.outputs.committed == 'true'
+3 -1
View File
@@ -47,7 +47,9 @@ describe('getSession', () => {
})
it('returns null when an error occurs', async () => {
mockFetch.mockRejectedValue(new Error('Network error'))
mockFetch.mockImplementation(async () => {
throw new Error('Network error')
})
const result = await getSession()
+8 -8
View File
@@ -1,6 +1,6 @@
/**
* Unit Tests: Permissions
*
*
* Tests the permission system for tournament management
*/
@@ -57,7 +57,7 @@ describe('Permissions', () => {
user: { id: '1', email: 'test@example.com' },
session: { token: 'test', expiresAt: new Date() }
}));
userFindUniqueMock.mockImplementation(async () =>
userFindUniqueMock.mockImplementation(async () =>
createMockUser('1', 'test@example.com', 'club_admin')
);
@@ -70,7 +70,7 @@ describe('Permissions', () => {
user: { id: '1', email: 'test@example.com' },
session: { token: 'test', expiresAt: new Date() }
}));
userFindUniqueMock.mockImplementation(async () =>
userFindUniqueMock.mockImplementation(async () =>
createMockUser('1', 'test@example.com', 'player')
);
@@ -93,7 +93,7 @@ describe('Permissions', () => {
user: { id: 'admin-1', email: 'admin@example.com' },
session: { token: 'test', expiresAt: new Date() }
}));
userFindUniqueMock.mockImplementation(async () =>
userFindUniqueMock.mockImplementation(async () =>
createMockUser('admin-1', 'admin@example.com', 'club_admin')
);
@@ -106,7 +106,7 @@ describe('Permissions', () => {
user: { id: 'player-1', email: 'player@example.com' },
session: { token: 'test', expiresAt: new Date() }
}));
userFindUniqueMock.mockImplementation(async () =>
userFindUniqueMock.mockImplementation(async () =>
createMockUser('player-1', 'player@example.com', 'player')
);
@@ -122,7 +122,7 @@ describe('Permissions', () => {
user: { id: 'admin-1', email: 'admin@example.com' },
session: { token: 'test', expiresAt: new Date() }
}));
userFindUniqueMock.mockImplementation(async () =>
userFindUniqueMock.mockImplementation(async () =>
createMockUser('admin-1', 'admin@example.com', 'tournament_admin')
);
@@ -135,7 +135,7 @@ describe('Permissions', () => {
user: { id: 'admin-1', email: 'admin@example.com' },
session: { token: 'test', expiresAt: new Date() }
}));
userFindUniqueMock.mockImplementation(async () =>
userFindUniqueMock.mockImplementation(async () =>
createMockUser('admin-1', 'admin@example.com', 'club_admin')
);
@@ -148,7 +148,7 @@ describe('Permissions', () => {
user: { id: 'player-1', email: 'player@example.com' },
session: { token: 'test', expiresAt: new Date() }
}));
userFindUniqueMock.mockImplementation(async () =>
userFindUniqueMock.mockImplementation(async () =>
createMockUser('player-1', 'player@example.com', 'player')
);
+17 -25
View File
@@ -3,37 +3,17 @@
* Tests the allowTies field is properly saved when updating tournaments
*/
import { describe, it, expect, mock, beforeEach,} from 'bun:test';
import { describe, it, expect, mock, beforeEach, afterAll } from 'bun:test';
// Create mock functions at module level
const eventFindUniqueMock = mock(async () => ({}));
const eventUpdateMock = mock(async () => ({}));
const userFindUniqueMock = mock(async () => ({
id: 'admin-1',
email: 'admin@example.com',
role: 'club_admin',
emailVerified: false,
name: null,
image: null,
playerId: null,
createdAt: new Date(),
updatedAt: new Date(),
}));
const canManageTournamentMock = mock(async () => ({ allowed: true }));
const canDeleteTournamentMock = mock(async () => ({ allowed: true }));
// Mock auth-simple to return a valid session
mock.module('@/lib/auth-simple', () => ({
getSession: mock(async () => ({
user: { id: 'admin-1', email: 'admin@example.com' },
session: { token: 'test', expiresAt: new Date() }
})),
}));
// Mock prisma with user and event
// Mock prisma first
mock.module('@/lib/prisma', () => ({
prisma: {
user: {
findUnique: userFindUniqueMock,
},
event: {
findUnique: eventFindUniqueMock,
update: eventUpdateMock,
@@ -41,6 +21,17 @@ mock.module('@/lib/prisma', () => ({
},
}));
// Mock the permissions module
mock.module('@/lib/permissions', () => ({
canManageTournament: canManageTournamentMock,
canDeleteTournament: canDeleteTournamentMock,
}));
// Cleanup after all tests in this file
afterAll(() => {
mock.restore('module');
});
// Import the route handler after mocking
import { PUT } from '@/app/api/tournaments/[id]/route';
import { prisma } from '@/lib/prisma';
@@ -50,7 +41,8 @@ describe('Tournament Update API', () => {
// Clear all mock history before each test
eventFindUniqueMock.mockClear();
eventUpdateMock.mockClear();
userFindUniqueMock.mockClear();
canManageTournamentMock.mockClear();
canDeleteTournamentMock.mockClear();
});
it('should update allowTies field when provided', async () => {