fix(chat): honor configurable context windows #72
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: CI | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| tags: ["v*"] | ||
| pull_request: | ||
| branches: [main] | ||
| jobs: | ||
| test: | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
| go-version: ["1.22"] | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20" | ||
| cache: npm | ||
| cache-dependency-path: web/package-lock.json | ||
| - name: Build web UI (required for go:embed) | ||
| shell: bash | ||
| run: | | ||
| set -e | ||
| (cd web && npm ci && npm run build) | ||
| rm -rf internal/server/static/assets \ | ||
| internal/server/static/*.html \ | ||
| internal/server/static/*.js \ | ||
| internal/server/static/*.css \ | ||
| internal/server/static/*.svg 2>/dev/null || true | ||
| mkdir -p internal/server/static | ||
| cp -r web/dist/. internal/server/static/ | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: ${{ matrix.go-version }} | ||
| # Use bash on Windows too: PowerShell parses coverage.out as member access on $coverage. | ||
| - name: Run tests | ||
| shell: bash | ||
| run: go test -race -count=1 -coverprofile=coverage.out ./... | ||
| - name: Build binary | ||
| shell: bash | ||
| run: go build -o bin/csghub-lite ./cmd/csghub-lite | ||
| - name: Verify version flag | ||
| shell: bash | ||
| run: ./bin/csghub-lite --version | ||
| - name: Upload coverage | ||
| if: matrix.os == 'ubuntu-latest' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage | ||
| path: coverage.out | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20" | ||
| cache: npm | ||
| cache-dependency-path: web/package-lock.json | ||
| - name: Build web UI (required for go:embed) | ||
| shell: bash | ||
| run: | | ||
| set -e | ||
| (cd web && npm ci && npm run build) | ||
| rm -rf internal/server/static/assets \ | ||
| internal/server/static/*.html \ | ||
| internal/server/static/*.js \ | ||
| internal/server/static/*.css \ | ||
| internal/server/static/*.svg 2>/dev/null || true | ||
| mkdir -p internal/server/static | ||
| cp -r web/dist/. internal/server/static/ | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.22" | ||
| - name: golangci-lint | ||
| uses: golangci/golangci-lint-action@v6 | ||
| with: | ||
| version: latest | ||
| # Lint is informational: full golangci-lint config still flags legacy issues in non-test code. | ||
| release: | ||
| needs: [test] | ||
| runs-on: ubuntu-latest | ||
| if: startsWith(github.ref, 'refs/tags/v') | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20" | ||
| cache: npm | ||
| cache-dependency-path: web/package-lock.json | ||
| - name: Build web UI (required for go:embed) | ||
| shell: bash | ||
| run: | | ||
| set -e | ||
| (cd web && npm ci && npm run build) | ||
| rm -rf internal/server/static/assets \ | ||
| internal/server/static/*.html \ | ||
| internal/server/static/*.js \ | ||
| internal/server/static/*.css \ | ||
| internal/server/static/*.svg 2>/dev/null || true | ||
| mkdir -p internal/server/static | ||
| cp -r web/dist/. internal/server/static/ | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.22" | ||
| # Without HOMEBREW_TAP_TOKEN, publishing the tap fails with 401 and marks the job failed | ||
| # even though the GitHub release assets already uploaded. | ||
| - uses: goreleaser/goreleaser-action@v6 | ||
| with: | ||
| version: latest | ||
| args: release --clean${{ secrets.HOMEBREW_TAP_TOKEN == '' && ' --skip=homebrew' || '' }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} | ||
| # GitLab releases are not created by GoReleaser. Mirror the five platform archives | ||
| # to GitLab generic packages + release links (same layout as scripts/push.sh). | ||
| - name: Upload release assets to GitLab | ||
| if: ${{ secrets.GITLAB_TOKEN != '' }} | ||
| env: | ||
| GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} | ||
| run: | | ||
| set -euo pipefail | ||
| ./scripts/rename-dist-for-gitlab.sh "${GITHUB_REF_NAME#v}" | ||
| ./scripts/push.sh --skip-github --skip-build --skip-gitlab-git --tag "${GITHUB_REF_NAME}" | ||