fix(chats): escape regex in search highlight and fix repr'd output (#… #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| branches: [ master ] | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| build-docker: | |
| name: Docker | |
| runs-on: ubuntu-latest | |
| env: | |
| SHOULD_PUSH: ${{ startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master' }} | |
| permissions: | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| driver: docker | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| if: env.SHOULD_PUSH == 'true' | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set environment variables | |
| run: | | |
| echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} | |
| # Sanitize the ref name to be used as a Docker tag | |
| SANITIZED_REF_NAME=$(echo "${GITHUB_REF_NAME}" | tr '/' '-') | |
| echo "SANITIZED_REF_NAME=${SANITIZED_REF_NAME}" >>${GITHUB_ENV} | |
| env: | |
| OWNER: '${{ github.repository_owner }}' | |
| # First build the base image locally (needed for subsequent builds) | |
| - name: Build Docker image (base) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| tags: gptme:latest | |
| file: ./scripts/Dockerfile | |
| context: . | |
| push: false | |
| # Push base image to registry if on master/tag | |
| - name: Push Docker image (base) | |
| uses: docker/build-push-action@v6 | |
| if: env.SHOULD_PUSH == 'true' | |
| with: | |
| tags: | | |
| ghcr.io/${{ env.OWNER_LC }}/gptme:latest | |
| ghcr.io/${{ env.OWNER_LC }}/gptme:${{ env.SANITIZED_REF_NAME }} | |
| file: ./scripts/Dockerfile | |
| context: . | |
| push: true | |
| # Build and push eval image | |
| - name: Build and push Docker image (server) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| tags: | | |
| ghcr.io/${{ env.OWNER_LC }}/gptme-server:latest | |
| ghcr.io/${{ env.OWNER_LC }}/gptme-server:${{ env.SANITIZED_REF_NAME }} | |
| file: ./scripts/Dockerfile.server | |
| context: . | |
| build-args: | | |
| BASE=gptme:latest | |
| push: ${{ env.SHOULD_PUSH }} | |
| # Build and push eval image | |
| - name: Build and push Docker image (eval) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| tags: | | |
| ghcr.io/${{ env.OWNER_LC }}/gptme-eval:latest | |
| ghcr.io/${{ env.OWNER_LC }}/gptme-eval:${{ env.SANITIZED_REF_NAME }} | |
| file: ./scripts/Dockerfile.eval | |
| context: . | |
| push: ${{ env.SHOULD_PUSH }} | |
| # Now the full eval image | |
| # NOTE: takes a long time and leads to a big (1GB+) image | |
| #- name: Build and push Docker image (eval-full) | |
| # uses: docker/build-push-action@v6 | |
| # with: | |
| # tags: | | |
| # ghcr.io/${{ env.OWNER_LC }}/gptme-eval-full:latest | |
| # ghcr.io/${{ env.OWNER_LC }}/gptme-eval-full:${{ env.SANITIZED_REF_NAME }} | |
| # file: ./scripts/Dockerfile.eval | |
| # context: . | |
| # push: true | |
| # build-args: | | |
| # RUST=yes | |
| # BROWSER=yes | |
| # Report and check image sizes | |
| - name: Check image sizes | |
| run: | | |
| echo "## Docker Image Sizes" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Image | Size |" >> $GITHUB_STEP_SUMMARY | |
| echo "|-------|------|" >> $GITHUB_STEP_SUMMARY | |
| for img in gptme:latest ghcr.io/${OWNER_LC}/gptme-server:latest ghcr.io/${OWNER_LC}/gptme-eval:latest; do | |
| SIZE=$(docker image inspect "$img" --format '{{.Size}}' 2>/dev/null || echo "0") | |
| SIZE_MB=$((SIZE / 1024 / 1024)) | |
| echo "| $img | ${SIZE_MB}MB |" >> $GITHUB_STEP_SUMMARY | |
| echo "$img: ${SIZE_MB}MB" | |
| # Warn if base image exceeds 900MB (leave headroom, but catch regressions) | |
| if [ "$img" = "gptme:latest" ] && [ "$SIZE_MB" -gt 900 ]; then | |
| echo "::warning::Base image $img is ${SIZE_MB}MB (limit: 900MB)" | |
| fi | |
| done | |
| build-pyinstaller: | |
| name: PyInstaller binaries on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] # windows-latest | |
| python_version: ['3.13'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install poetry | |
| run: pipx install poetry | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python_version }} | |
| cache: 'poetry' | |
| #cache-dependency-path: | | |
| # pyproject.toml | |
| # poetry.lock | |
| - name: Install system dependencies (Ubuntu) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y python3-dev build-essential libffi-dev | |
| - name: Install dependencies | |
| run: | | |
| make build | |
| poetry install --extras server --extras pyinstaller --with dev | |
| - name: Build PyInstaller executable | |
| run: make build-server-exe | |
| - name: Test executable (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| ./dist/gptme-server --help | |
| echo "✅ gptme-server --help executed successfully" | |
| - name: Test executable (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| .\dist\gptme-server.exe --help | |
| echo "✅ gptme-server.exe --help executed successfully" | |
| - name: Upload executable artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: gptme-server-${{ matrix.os }} | |
| path: | | |
| dist/gptme-server* | |
| retention-days: 7 |