name: GoChat CI/CD Pipeline on: pull_request: branches: [main] push: branches: [main] permissions: contents: read jobs: backend: name: Backend (SQLite) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version-file: backend/go.mod cache-dependency-path: backend/go.sum - uses: actions/setup-python@v5 with: python-version: "3.12" - uses: browser-actions/setup-chrome@v2 id: chrome - name: Install browser harness run: python -m pip install browser-harness==0.1.9 - name: Test working-directory: backend env: GOCHAT_TEST_DB: sqlite GOCHAT_BROWSER_SMOKE: "1" BU_CDP_URL: http://127.0.0.1:9222 run: | "${{ steps.chrome.outputs.chrome-path }}" --headless=new --no-sandbox --disable-dev-shm-usage --remote-debugging-port=9222 --user-data-dir="$RUNNER_TEMP/chrome" about:blank & chrome_pid=$! trap 'kill "$chrome_pid" 2>/dev/null || true; browser-harness --reload > /dev/null 2>&1 || true' EXIT curl --fail --silent --show-error --retry 10 --retry-connrefused --retry-delay 1 http://127.0.0.1:9222/json/version > /dev/null browser-harness <<'PY' print(page_info()) PY go test ./internal/... ./pkg/... ./cmd/... - name: Build working-directory: backend run: go build ./... - name: Vet working-directory: backend run: go vet ./... backend-postgres: name: Backend (PostgreSQL concurrency) runs-on: ubuntu-latest services: postgres: image: postgres:16-alpine env: POSTGRES_DB: gochat_test POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres ports: - 5432:5432 options: >- --health-cmd "pg_isready -U postgres -d gochat_test" --health-interval 5s --health-timeout 5s --health-retries 5 steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version-file: backend/go.mod cache-dependency-path: backend/go.sum - name: Test auto-assignment concurrency working-directory: backend env: GOCHAT_TEST_DB: postgres GOCHAT_TEST_DB_URL: postgres://postgres:postgres@localhost:5432/gochat_test?sslmode=disable run: go test ./internal/autoassignment -run '^TestAssignmentServiceOnlyOneConcurrentWorkerWinsPostgres$' -count=3 frontend: name: Frontend Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 - run: corepack enable - run: pnpm install --frozen-lockfile - name: ESLint representative JS/Vue files run: pnpm --dir frontend exec eslint app/javascript/dashboard/components-next/captain/assistant/AssistantPlayground.spec.js app/javascript/dashboard/components-next/captain/assistant/AssistantPlayground.vue - name: Prettier representative JS/TS/Vue files run: pnpm --dir frontend exec prettier --check app/javascript/dashboard/components-next/captain/assistant/AssistantPlayground.spec.js app/javascript/dashboard/components-next/captain/assistant/AssistantPlayground.vue vite.config.ts app/javascript/histoire.setup.ts - run: pnpm --dir frontend build