diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 33d7b0c..e16d7e5 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 cache: pnpm - name: Install dependencies @@ -49,7 +49,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 cache: pnpm - name: Install dependencies @@ -59,7 +59,7 @@ jobs: run: pnpm test docker: - name: Build & Push Docker Image + name: Build & Push Docker Images runs-on: ubuntu-latest needs: [lint-typecheck, test] steps: @@ -91,9 +91,49 @@ jobs: with: context: . file: Dockerfile + target: runner push: true tags: | git.farh.net/groombook/api:${{ steps.version.outputs.tag }} ${{ github.ref == 'refs/heads/main' && 'git.farh.net/groombook/api:latest' || '' }} cache-from: type=registry,ref=git.farh.net/groombook/cache:api - cache-to: type=registry,ref=git.farh.net/groombook/cache:api,mode=max \ No newline at end of file + cache-to: type=registry,ref=git.farh.net/groombook/cache:api,mode=max + + - name: Build and push Migrate image + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile + target: migrate + push: true + tags: | + git.farh.net/groombook/migrate:${{ steps.version.outputs.tag }} + ${{ github.ref == 'refs/heads/main' && 'git.farh.net/groombook/migrate:latest' || '' }} + cache-from: type=registry,ref=git.farh.net/groombook/cache:migrate + cache-to: type=registry,ref=git.farh.net/groombook/cache:migrate,mode=max + + - name: Build and push Seed image + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile + target: seed + push: true + tags: | + git.farh.net/groombook/seed:${{ steps.version.outputs.tag }} + ${{ github.ref == 'refs/heads/main' && 'git.farh.net/groombook/seed:latest' || '' }} + cache-from: type=registry,ref=git.farh.net/groombook/cache:seed + cache-to: type=registry,ref=git.farh.net/groombook/cache:seed,mode=max + + - name: Build and push Reset image + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile + target: reset + push: true + tags: | + git.farh.net/groombook/reset:${{ steps.version.outputs.tag }} + ${{ github.ref == 'refs/heads/main' && 'git.farh.net/groombook/reset:latest' || '' }} + cache-from: type=registry,ref=git.farh.net/groombook/cache:reset + cache-to: type=registry,ref=git.farh.net/groombook/cache:reset,mode=max diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3881905..0fb65b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 cache: pnpm - name: Install dependencies @@ -49,7 +49,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 cache: pnpm - name: Install dependencies @@ -71,7 +71,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 cache: pnpm - name: Install dependencies diff --git a/Dockerfile b/Dockerfile index 93e6bc3..6914964 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:20-alpine AS base +FROM node:22-alpine AS base RUN corepack enable && corepack prepare pnpm@9.15.4 --activate WORKDIR /app @@ -20,7 +20,7 @@ RUN pnpm --filter @groombook/types build && \ pnpm --filter @groombook/api build # Runtime -FROM node:20-alpine AS runner +FROM node:22-alpine AS runner RUN corepack enable && corepack prepare pnpm@9.15.4 --activate WORKDIR /app ENV NODE_ENV=production diff --git a/apps/api/src/__tests__/petsExtendedFields.test.ts b/apps/api/src/__tests__/petsExtendedFields.test.ts index 3425234..44085ac 100644 --- a/apps/api/src/__tests__/petsExtendedFields.test.ts +++ b/apps/api/src/__tests__/petsExtendedFields.test.ts @@ -135,7 +135,7 @@ function makeDeleteChainable(): unknown { } if (prop === "returning") { return () => { - const row = petRows[0]; + const row = petRows[0]!; deletedId = row.id as string; return [row]; }; @@ -165,10 +165,10 @@ vi.mock("../db", async (importOriginal) => { }), pets, appointments, -and: db.and, - eq: db.eq, - exists: db.exists, - or: db.or, + and: vi.fn(), + eq: vi.fn(), + exists: vi.fn(), + or: vi.fn(), }; }); diff --git a/apps/api/src/__tests__/portal.test.ts b/apps/api/src/__tests__/portal.test.ts index 2388943..bbeacbd 100644 --- a/apps/api/src/__tests__/portal.test.ts +++ b/apps/api/src/__tests__/portal.test.ts @@ -67,6 +67,11 @@ vi.mock("../db", () => { { get: (t, p) => (p === "_name" ? "impersonationSessions" : { table: "impersonationSessions", column: p }) } ); + const impersonationAuditLogs = new Proxy( + { _name: "impersonationAuditLogs" }, + { get: (t, p) => (p === "_name" ? "impersonationAuditLogs" : { table: "impersonationAuditLogs", column: p }) } + ); + const appointments = new Proxy( { _name: "appointments" }, { get: (t, p) => (p === "_name" ? "appointments" : { table: "appointments", column: p }) } @@ -99,8 +104,12 @@ vi.mock("../db", () => { }), }), }), + insert: () => ({ + values: () => ({ returning: () => [{}] }), + }), }), impersonationSessions, + impersonationAuditLogs, appointments, eq: vi.fn(), and: vi.fn(), diff --git a/package.json b/package.json index 3ee2ac8..e2a0164 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.0.1", "private": true, "type": "module", + "packageManager": "pnpm@9.15.4", "scripts": { "dev": "tsx watch src/index.ts", "build": "tsc --project .",