From f0bc15113c60aba921bb820743634ed496ba54b0 Mon Sep 17 00:00:00 2001 From: Jack Luar Date: Sun, 16 Nov 2025 08:40:14 +0000 Subject: [PATCH 1/7] implement docker caching for faster builds Signed-off-by: Jack Luar --- .github/workflows/ci-secret.yaml | 48 +++++++++++++++++++++++++++-- .github/workflows/ci.yaml | 39 ++++++++++++++++++++--- Makefile | 4 +-- backend/Dockerfile | 14 +++++++-- docker-compose.yml | 4 ++- frontend/nextjs-frontend/Dockerfile | 34 ++++++++++++++++---- 6 files changed, 125 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci-secret.yaml b/.github/workflows/ci-secret.yaml index 59590a65..45290548 100644 --- a/.github/workflows/ci-secret.yaml +++ b/.github/workflows/ci-secret.yaml @@ -19,13 +19,16 @@ defaults: jobs: build-backend-docker: runs-on: self-hosted + permissions: + contents: read + packages: write steps: - name: Setup python uses: actions/setup-python@v5 with: python-version: '3.12' - name: Install uv - uses: astral-sh/setup-uv@v6 + uses: astral-sh/setup-uv@v6 - name: Checkout code uses: actions/checkout@v4 - name: Setup prereqs @@ -56,9 +59,48 @@ jobs: run: | cp ${{ secrets.PATH_TO_GOOGLE_APPLICATION_CREDENTIALS }} backend/src cp ${{ secrets.PATH_TO_GOOGLE_APPLICATION_CREDENTIALS }} evaluation/auto_evaluation/src - - name: Build Docker image + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push backend Docker image + uses: docker/build-push-action@v5 + with: + context: ./backend + push: true + tags: | + ghcr.io/${{ github.repository }}/backend:latest + ghcr.io/${{ github.repository }}/backend:${{ github.sha }} + cache-from: | + type=registry,ref=ghcr.io/${{ github.repository }}/backend:cache + type=registry,ref=ghcr.io/${{ github.repository }}/backend:latest + cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/backend:cache,mode=max + load: true + + - name: Build and push frontend Docker image + uses: docker/build-push-action@v5 + with: + context: ./frontend/nextjs-frontend + push: true + tags: | + ghcr.io/${{ github.repository }}/frontend:latest + ghcr.io/${{ github.repository }}/frontend:${{ github.sha }} + cache-from: | + type=registry,ref=ghcr.io/${{ github.repository }}/frontend:cache + type=registry,ref=ghcr.io/${{ github.repository }}/frontend:latest + cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/frontend:cache,mode=max + load: true + + - name: Start services with docker compose run: | - make docker-up + docker compose up -d - name: Run LLM CI id: llm_tests diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 57b0328c..90991e57 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,6 +17,9 @@ defaults: jobs: build-backend-docker: runs-on: self-hosted + permissions: + contents: read + packages: write steps: - name: Setup python uses: actions/setup-python@v5 @@ -24,7 +27,7 @@ jobs: python-version: '3.12' - name: Install uv - uses: astral-sh/setup-uv@v6 + uses: astral-sh/setup-uv@v6 - name: Checkout code uses: actions/checkout@v4 @@ -45,6 +48,34 @@ jobs: cp .env.test .env make test - - name: Build Docker images - run: | - docker compose build + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build backend Docker image with cache + uses: docker/build-push-action@v5 + with: + context: ./backend + push: false + tags: ghcr.io/${{ github.repository }}/backend:pr-${{ github.event.pull_request.number }} + cache-from: | + type=registry,ref=ghcr.io/${{ github.repository }}/backend:cache + type=registry,ref=ghcr.io/${{ github.repository }}/backend:latest + cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/backend:cache,mode=max + + - name: Build frontend Docker image with cache + uses: docker/build-push-action@v5 + with: + context: ./frontend/nextjs-frontend + push: false + tags: ghcr.io/${{ github.repository }}/frontend:pr-${{ github.event.pull_request.number }} + cache-from: | + type=registry,ref=ghcr.io/${{ github.repository }}/frontend:cache + type=registry,ref=ghcr.io/${{ github.repository }}/frontend:latest + cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/frontend:cache,mode=max diff --git a/Makefile b/Makefile index 62a75b06..19b31de3 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ check: .PHONY: docker-up docker-up: - @docker compose -f docker-compose.yml up --build --wait + @DOCKER_BUILDKIT=1 docker compose -f docker-compose.yml up --build --wait .PHONY: docker-down docker-down: @@ -31,7 +31,7 @@ docker-down: .PHONY: docker-dev docker-dev: - @docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build --wait + @DOCKER_BUILDKIT=1 docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build --wait # --- Development Commands --- .PHONY: seed-credentials diff --git a/backend/Dockerfile b/backend/Dockerfile index b8cbb94f..9abdc029 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -2,6 +2,7 @@ FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim WORKDIR /ORAssistant-backend +# Install system dependencies (cacheable layer) RUN apt-get update && apt-get install -y \ build-essential \ curl \ @@ -15,13 +16,22 @@ RUN apt-get update && apt-get install -y \ git lfs install && \ rm -rf /var/lib/apt/lists/* +# Install uv (cacheable layer) RUN pip install uv -COPY ./pyproject.toml /ORAssistant-backend/pyproject.toml +# Copy only dependency files first for better caching +COPY ./pyproject.toml ./uv.lock* /ORAssistant-backend/ + +# Install dependencies (cacheable layer - only rebuilds if dependencies change) +RUN uv venv .venv && uv sync --dev + +# Copy the rest of the application COPY . . -RUN uv venv .venv && uv sync --dev && uv run /ORAssistant-backend/src/post_install.py +# Run post-install script +RUN uv run /ORAssistant-backend/src/post_install.py +# Download dataset (cacheable layer) RUN git clone https://huggingface.co/datasets/The-OpenROAD-Project/ORAssistant_RAG_Dataset && \ mkdir -p data && \ mv ORAssistant_RAG_Dataset/* data/ && \ diff --git a/docker-compose.yml b/docker-compose.yml index cb34eb7a..36ba3e52 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,6 +19,7 @@ services: retries: 5 backend: + image: ghcr.io/the-openroad-project/orassistant/backend:latest build: context: ./backend container_name: "backend" @@ -42,8 +43,9 @@ services: timeout: ${HEALTHCHECK_TIMEOUT:-10s} retries: ${HEALTHCHECK_RETRIES:-5} start_period: ${HEALTHCHECK_START_PERIOD:-1200s} - + frontend: + image: ghcr.io/the-openroad-project/orassistant/frontend:latest build: context: ./frontend/nextjs-frontend depends_on: diff --git a/frontend/nextjs-frontend/Dockerfile b/frontend/nextjs-frontend/Dockerfile index baaddc52..70c7e5ad 100644 --- a/frontend/nextjs-frontend/Dockerfile +++ b/frontend/nextjs-frontend/Dockerfile @@ -1,7 +1,11 @@ # Install dependencies only when needed FROM node:22-alpine AS deps WORKDIR /app + +# Copy package files (cacheable layer - only rebuilds if dependencies change) COPY package.json package-lock.json* yarn.lock* ./ + +# Install dependencies RUN \ if [ -f yarn.lock ]; then yarn install --frozen-lockfile; \ elif [ -f package-lock.json ]; then npm ci; \ @@ -10,21 +14,39 @@ RUN \ # Rebuild the source code only when needed FROM node:22-alpine AS builder WORKDIR /app + +# Copy dependencies from deps stage COPY --from=deps /app/node_modules ./node_modules -COPY . . + +# Copy only necessary source files +COPY package.json ./ +COPY next.config.ts ./ +COPY tsconfig.json ./ +COPY tailwind.config.ts ./ +COPY postcss.config.mjs ./ +COPY app ./app +COPY public ./public + +# Build the application RUN npm run build # Production image, copy all the files and run next FROM node:22-alpine AS runner WORKDIR /app -ENV NODE_ENV production +ENV NODE_ENV=production + +# Create a non-root user for security +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 nextjs # Copy built assets from builder -COPY --from=builder /app/public ./public -COPY --from=builder /app/.next ./.next -COPY --from=builder /app/node_modules ./node_modules -COPY --from=builder /app/package.json ./package.json +COPY --from=builder --chown=nextjs:nodejs /app/public ./public +COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next +COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules +COPY --from=builder --chown=nextjs:nodejs /app/package.json ./package.json + +USER nextjs EXPOSE 3000 From 78758287fcdf50fa397a799079b930a7f0104da2 Mon Sep 17 00:00:00 2001 From: Jack Luar Date: Sun, 16 Nov 2025 08:59:41 +0000 Subject: [PATCH 2/7] Fix Docker image tag case sensitivity issue Signed-off-by: Jack Luar --- .github/workflows/ci-secret.yaml | 24 ++++++++++++++---------- .github/workflows/ci.yaml | 20 ++++++++++++-------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci-secret.yaml b/.github/workflows/ci-secret.yaml index 45290548..3040d461 100644 --- a/.github/workflows/ci-secret.yaml +++ b/.github/workflows/ci-secret.yaml @@ -70,18 +70,22 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Set lowercase repository name + run: | + echo "REPO_LOWER=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + - name: Build and push backend Docker image uses: docker/build-push-action@v5 with: context: ./backend push: true tags: | - ghcr.io/${{ github.repository }}/backend:latest - ghcr.io/${{ github.repository }}/backend:${{ github.sha }} + ghcr.io/${{ env.REPO_LOWER }}/backend:latest + ghcr.io/${{ env.REPO_LOWER }}/backend:${{ github.sha }} cache-from: | - type=registry,ref=ghcr.io/${{ github.repository }}/backend:cache - type=registry,ref=ghcr.io/${{ github.repository }}/backend:latest - cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/backend:cache,mode=max + type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:cache + type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:latest + cache-to: type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:cache,mode=max load: true - name: Build and push frontend Docker image @@ -90,12 +94,12 @@ jobs: context: ./frontend/nextjs-frontend push: true tags: | - ghcr.io/${{ github.repository }}/frontend:latest - ghcr.io/${{ github.repository }}/frontend:${{ github.sha }} + ghcr.io/${{ env.REPO_LOWER }}/frontend:latest + ghcr.io/${{ env.REPO_LOWER }}/frontend:${{ github.sha }} cache-from: | - type=registry,ref=ghcr.io/${{ github.repository }}/frontend:cache - type=registry,ref=ghcr.io/${{ github.repository }}/frontend:latest - cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/frontend:cache,mode=max + type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:cache + type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:latest + cache-to: type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:cache,mode=max load: true - name: Start services with docker compose diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 90991e57..3d6e9838 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -58,24 +58,28 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Set lowercase repository name + run: | + echo "REPO_LOWER=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + - name: Build backend Docker image with cache uses: docker/build-push-action@v5 with: context: ./backend push: false - tags: ghcr.io/${{ github.repository }}/backend:pr-${{ github.event.pull_request.number }} + tags: ghcr.io/${{ env.REPO_LOWER }}/backend:pr-${{ github.event.pull_request.number }} cache-from: | - type=registry,ref=ghcr.io/${{ github.repository }}/backend:cache - type=registry,ref=ghcr.io/${{ github.repository }}/backend:latest - cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/backend:cache,mode=max + type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:cache + type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:latest + cache-to: type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:cache,mode=max - name: Build frontend Docker image with cache uses: docker/build-push-action@v5 with: context: ./frontend/nextjs-frontend push: false - tags: ghcr.io/${{ github.repository }}/frontend:pr-${{ github.event.pull_request.number }} + tags: ghcr.io/${{ env.REPO_LOWER }}/frontend:pr-${{ github.event.pull_request.number }} cache-from: | - type=registry,ref=ghcr.io/${{ github.repository }}/frontend:cache - type=registry,ref=ghcr.io/${{ github.repository }}/frontend:latest - cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/frontend:cache,mode=max + type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:cache + type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:latest + cache-to: type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:cache,mode=max From cd4728378d6a398fa420008288e3de275fba1f13 Mon Sep 17 00:00:00 2001 From: Jack Luar Date: Sun, 16 Nov 2025 09:14:43 +0000 Subject: [PATCH 3/7] faster mypy evals Signed-off-by: Jack Luar --- evaluation/pyproject.toml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/evaluation/pyproject.toml b/evaluation/pyproject.toml index bfe3fa93..c1220b08 100644 --- a/evaluation/pyproject.toml +++ b/evaluation/pyproject.toml @@ -54,7 +54,12 @@ warn_unused_ignores = true strict_optional = true disable_error_code = ["call-arg"] explicit_package_bases = true -exclude = "src/post_install.py" +exclude = [ + "src/post_install.py", + ".venv", + ".mypy_cache", + ".ruff_cache", +] [[tool.mypy.overrides]] module = ["deepeval.*", "huggingface_hub.*", "vertexai.*", "pandas.*", "plotly.*"] From 8db1052b1287db4ec9cd528e6b83bcec9eb3118f Mon Sep 17 00:00:00 2001 From: Jack Luar Date: Thu, 4 Dec 2025 19:47:21 +0000 Subject: [PATCH 4/7] push to 'luarss' workspace Signed-off-by: Jack Luar --- .github/workflows/ci.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3d6e9838..40d93b87 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -55,8 +55,8 @@ jobs: uses: docker/login-action@v3 with: registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + username: luarss + password: ${{ secrets.GH_PAT }} - name: Set lowercase repository name run: | @@ -69,9 +69,9 @@ jobs: push: false tags: ghcr.io/${{ env.REPO_LOWER }}/backend:pr-${{ github.event.pull_request.number }} cache-from: | - type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:cache + type=registry,ref=ghcr.io/luarss/orassistant-backend:cache type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:latest - cache-to: type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:cache,mode=max + cache-to: type=registry,ref=ghcr.io/luarss/orassistant-backend:cache,mode=max - name: Build frontend Docker image with cache uses: docker/build-push-action@v5 @@ -80,6 +80,6 @@ jobs: push: false tags: ghcr.io/${{ env.REPO_LOWER }}/frontend:pr-${{ github.event.pull_request.number }} cache-from: | - type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:cache + type=registry,ref=ghcr.io/luarss/orassistant-frontend:cache type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:latest - cache-to: type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:cache,mode=max + cache-to: type=registry,ref=ghcr.io/luarss/orassistant-frontend:cache,mode=max From 323f203bd8a8f86e1ad47bc8e640f1b90ced3448 Mon Sep 17 00:00:00 2001 From: Jack Luar Date: Thu, 4 Dec 2025 19:53:28 +0000 Subject: [PATCH 5/7] update correct namespace Signed-off-by: Jack Luar --- .github/workflows/ci-secret.yaml | 24 ++++++++++++------------ .github/workflows/ci.yaml | 8 ++++---- docker-compose.yml | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci-secret.yaml b/.github/workflows/ci-secret.yaml index 3040d461..e27c7ee0 100644 --- a/.github/workflows/ci-secret.yaml +++ b/.github/workflows/ci-secret.yaml @@ -67,8 +67,8 @@ jobs: uses: docker/login-action@v3 with: registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + username: luarss + password: ${{ secrets.GH_PAT }} - name: Set lowercase repository name run: | @@ -80,12 +80,12 @@ jobs: context: ./backend push: true tags: | - ghcr.io/${{ env.REPO_LOWER }}/backend:latest - ghcr.io/${{ env.REPO_LOWER }}/backend:${{ github.sha }} + ghcr.io/luarss/orassistant-backend:latest + ghcr.io/luarss/orassistant-backend:${{ github.sha }} cache-from: | - type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:cache - type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:latest - cache-to: type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:cache,mode=max + type=registry,ref=ghcr.io/luarss/orassistant-backend:cache + type=registry,ref=ghcr.io/luarss/orassistant-backend:latest + cache-to: type=registry,ref=ghcr.io/luarss/orassistant-backend:cache,mode=max load: true - name: Build and push frontend Docker image @@ -94,12 +94,12 @@ jobs: context: ./frontend/nextjs-frontend push: true tags: | - ghcr.io/${{ env.REPO_LOWER }}/frontend:latest - ghcr.io/${{ env.REPO_LOWER }}/frontend:${{ github.sha }} + ghcr.io/luarss/orassistant-frontend:latest + ghcr.io/luarss/orassistant-frontend:${{ github.sha }} cache-from: | - type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:cache - type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:latest - cache-to: type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:cache,mode=max + type=registry,ref=ghcr.io/luarss/orassistant-frontend:cache + type=registry,ref=ghcr.io/luarss/orassistant-frontend:latest + cache-to: type=registry,ref=ghcr.io/luarss/orassistant-frontend:cache,mode=max load: true - name: Start services with docker compose diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 40d93b87..99b8ed6d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -67,10 +67,10 @@ jobs: with: context: ./backend push: false - tags: ghcr.io/${{ env.REPO_LOWER }}/backend:pr-${{ github.event.pull_request.number }} + tags: ghcr.io/luarss/orassistant-backend:pr-${{ github.event.pull_request.number }} cache-from: | type=registry,ref=ghcr.io/luarss/orassistant-backend:cache - type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/backend:latest + type=registry,ref=ghcr.io/luarss/orassistant-backend:latest cache-to: type=registry,ref=ghcr.io/luarss/orassistant-backend:cache,mode=max - name: Build frontend Docker image with cache @@ -78,8 +78,8 @@ jobs: with: context: ./frontend/nextjs-frontend push: false - tags: ghcr.io/${{ env.REPO_LOWER }}/frontend:pr-${{ github.event.pull_request.number }} + tags: ghcr.io/luarss/orassistant-frontend:pr-${{ github.event.pull_request.number }} cache-from: | type=registry,ref=ghcr.io/luarss/orassistant-frontend:cache - type=registry,ref=ghcr.io/${{ env.REPO_LOWER }}/frontend:latest + type=registry,ref=ghcr.io/luarss/orassistant-frontend:latest cache-to: type=registry,ref=ghcr.io/luarss/orassistant-frontend:cache,mode=max diff --git a/docker-compose.yml b/docker-compose.yml index 36ba3e52..b72566c4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: retries: 5 backend: - image: ghcr.io/the-openroad-project/orassistant/backend:latest + image: ghcr.io/luarss/orassistant-backend:latest build: context: ./backend container_name: "backend" @@ -45,7 +45,7 @@ services: start_period: ${HEALTHCHECK_START_PERIOD:-1200s} frontend: - image: ghcr.io/the-openroad-project/orassistant/frontend:latest + image: ghcr.io/luarss/orassistant-frontend:latest build: context: ./frontend/nextjs-frontend depends_on: From fc4b2d8ceb128e5c82ea2b45ccdc9875a64b4cf6 Mon Sep 17 00:00:00 2001 From: Jack Luar Date: Fri, 5 Dec 2025 09:56:07 +0000 Subject: [PATCH 6/7] fix frontend image, PR caches from not to Signed-off-by: Jack Luar --- .github/workflows/ci.yaml | 17 ++--------------- frontend/nextjs-frontend/Dockerfile | 4 +++- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 99b8ed6d..183fd729 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -51,35 +51,22 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: luarss - password: ${{ secrets.GH_PAT }} - - - name: Set lowercase repository name - run: | - echo "REPO_LOWER=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV - - name: Build backend Docker image with cache uses: docker/build-push-action@v5 with: context: ./backend push: false - tags: ghcr.io/luarss/orassistant-backend:pr-${{ github.event.pull_request.number }} + tags: orassistant-backend:pr-${{ github.event.pull_request.number }} cache-from: | type=registry,ref=ghcr.io/luarss/orassistant-backend:cache type=registry,ref=ghcr.io/luarss/orassistant-backend:latest - cache-to: type=registry,ref=ghcr.io/luarss/orassistant-backend:cache,mode=max - name: Build frontend Docker image with cache uses: docker/build-push-action@v5 with: context: ./frontend/nextjs-frontend push: false - tags: ghcr.io/luarss/orassistant-frontend:pr-${{ github.event.pull_request.number }} + tags: orassistant-frontend:pr-${{ github.event.pull_request.number }} cache-from: | type=registry,ref=ghcr.io/luarss/orassistant-frontend:cache type=registry,ref=ghcr.io/luarss/orassistant-frontend:latest - cache-to: type=registry,ref=ghcr.io/luarss/orassistant-frontend:cache,mode=max diff --git a/frontend/nextjs-frontend/Dockerfile b/frontend/nextjs-frontend/Dockerfile index 70c7e5ad..d1560a32 100644 --- a/frontend/nextjs-frontend/Dockerfile +++ b/frontend/nextjs-frontend/Dockerfile @@ -20,11 +20,13 @@ COPY --from=deps /app/node_modules ./node_modules # Copy only necessary source files COPY package.json ./ -COPY next.config.ts ./ COPY tsconfig.json ./ COPY tailwind.config.ts ./ COPY postcss.config.mjs ./ COPY app ./app +COPY components ./components +COPY hooks ./hooks +COPY styles ./styles COPY public ./public # Build the application From 3cfaf0d97bb46301ee965705d5925303c62529b3 Mon Sep 17 00:00:00 2001 From: Jack Luar Date: Fri, 5 Dec 2025 10:20:36 +0000 Subject: [PATCH 7/7] use mypy caching + incremental, remove mypy from secret CI Signed-off-by: Jack Luar --- .github/workflows/ci-secret.yaml | 6 +++--- .github/workflows/ci.yaml | 10 ++++++++++ backend/Makefile | 5 +++-- backend/pyproject.toml | 2 ++ evaluation/Makefile | 5 +++-- evaluation/pyproject.toml | 2 ++ 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-secret.yaml b/.github/workflows/ci-secret.yaml index e27c7ee0..a5e406dd 100644 --- a/.github/workflows/ci-secret.yaml +++ b/.github/workflows/ci-secret.yaml @@ -34,9 +34,9 @@ jobs: - name: Setup prereqs run: | make init-dev - - name: Run formatting checks - run: | - make check + # - name: Run formatting checks + # run: | + # make check - name: Run unit tests working-directory: backend run: | diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 183fd729..2b99ef0a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -36,6 +36,16 @@ jobs: run: | make init-dev + - name: Cache mypy + uses: actions/cache@v4 + with: + path: | + backend/.mypy_cache + evaluation/.mypy_cache + key: mypy-${{ runner.os }}-${{ hashFiles('backend/**/*.py', 'evaluation/**/*.py', 'backend/pyproject.toml', 'evaluation/pyproject.toml') }} + restore-keys: | + mypy-${{ runner.os }}- + - name: Run formatting checks run: | make check diff --git a/backend/Makefile b/backend/Makefile index 0088ce3a..c7e25ecd 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -15,8 +15,9 @@ format: .PHONY: check check: - @uv run mypy . && \ - uv run ruff check + @uv run mypy . & \ + uv run ruff check & \ + wait .PHONY: build-docs build-docs: diff --git a/backend/pyproject.toml b/backend/pyproject.toml index 1a762332..ffbe547b 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -76,3 +76,5 @@ exclude = [ ] python_version = "3.13" disallow_untyped_defs = true +cache_dir = ".mypy_cache" +incremental = true diff --git a/evaluation/Makefile b/evaluation/Makefile index d4383c80..0ebda052 100644 --- a/evaluation/Makefile +++ b/evaluation/Makefile @@ -12,8 +12,9 @@ format: .PHONY: check check: - @uv run mypy . && \ - uv run ruff check + @uv run mypy . & \ + uv run ruff check & \ + wait .PHONY: clean clean: diff --git a/evaluation/pyproject.toml b/evaluation/pyproject.toml index c1220b08..d5697021 100644 --- a/evaluation/pyproject.toml +++ b/evaluation/pyproject.toml @@ -54,6 +54,8 @@ warn_unused_ignores = true strict_optional = true disable_error_code = ["call-arg"] explicit_package_bases = true +cache_dir = ".mypy_cache" +incremental = true exclude = [ "src/post_install.py", ".venv",