Skip to content

Commit 19a47aa

Browse files
authored
Merge pull request #7 from Paca-AI/ci/implement-ci-pipeline
ci: implement ci pipeline
2 parents ce1fd24 + c045b43 commit 19a47aa

5 files changed

Lines changed: 296 additions & 11 deletions

File tree

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: backend-pr-ci
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "backend/**"
7+
- ".github/workflows/backend-pr-ci.yml"
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: backend-pr-ci-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
17+
env:
18+
GO_VERSION: "1.24"
19+
20+
jobs:
21+
lint:
22+
name: Lint
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 10
25+
26+
defaults:
27+
run:
28+
working-directory: backend
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 1
35+
36+
- name: Setup Go
37+
uses: actions/setup-go@v5
38+
with:
39+
go-version: ${{ env.GO_VERSION }}
40+
cache-dependency-path: backend/go.sum
41+
42+
- name: Install golangci-lint
43+
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
44+
45+
- name: Run golangci-lint
46+
run: golangci-lint run --timeout=5m
47+
48+
build:
49+
name: Build
50+
runs-on: ubuntu-latest
51+
timeout-minutes: 10
52+
53+
defaults:
54+
run:
55+
working-directory: backend
56+
57+
steps:
58+
- name: Checkout repository
59+
uses: actions/checkout@v4
60+
with:
61+
fetch-depth: 1
62+
63+
- name: Setup Go
64+
uses: actions/setup-go@v5
65+
with:
66+
go-version: ${{ env.GO_VERSION }}
67+
cache-dependency-path: backend/go.sum
68+
69+
- name: Build WASM
70+
run: GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o github.wasm .
71+
72+
test:
73+
name: Tests
74+
runs-on: ubuntu-latest
75+
timeout-minutes: 15
76+
77+
defaults:
78+
run:
79+
working-directory: backend
80+
81+
steps:
82+
- name: Checkout repository
83+
uses: actions/checkout@v4
84+
with:
85+
fetch-depth: 1
86+
87+
- name: Setup Go
88+
uses: actions/setup-go@v5
89+
with:
90+
go-version: ${{ env.GO_VERSION }}
91+
cache-dependency-path: backend/go.sum
92+
93+
- name: Run tests (race detector)
94+
run: go test -race -timeout 60s -coverprofile=coverage.out $(go list ./...)
95+
96+
- name: Upload coverage report
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: coverage-report
100+
path: backend/coverage.out
101+
retention-days: 7
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: frontend-pr-ci
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "frontend/**"
7+
- ".github/workflows/frontend-pr-ci.yml"
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: frontend-pr-ci-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
web-quality:
19+
name: Typecheck and build frontend
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 20
22+
23+
defaults:
24+
run:
25+
working-directory: frontend
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 1
32+
33+
- name: Setup Bun
34+
uses: oven-sh/setup-bun@v2
35+
with:
36+
bun-version: "1.2.23"
37+
38+
- name: Cache Bun packages
39+
uses: actions/cache@v4
40+
with:
41+
path: ~/.bun/install/cache
42+
key: ${{ runner.os }}-bun-${{ hashFiles('frontend/bun.lock') }}
43+
restore-keys: |
44+
${{ runner.os }}-bun-
45+
46+
- name: Install dependencies
47+
run: bun install --frozen-lockfile
48+
49+
- name: Typecheck
50+
run: bun run typecheck
51+
52+
- name: Build production bundle
53+
run: bun run build

.github/workflows/mcp-pr-ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: mcp-pr-ci
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "mcp/**"
7+
- ".github/workflows/mcp-pr-ci.yml"
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: mcp-pr-ci-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
mcp-quality:
19+
name: Typecheck and build MCP server
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 10
22+
23+
defaults:
24+
run:
25+
working-directory: mcp
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 1
32+
33+
- name: Setup Bun
34+
uses: oven-sh/setup-bun@v2
35+
with:
36+
bun-version: "1.2.23"
37+
38+
- name: Cache Bun packages
39+
uses: actions/cache@v4
40+
with:
41+
path: ~/.bun/install/cache
42+
key: ${{ runner.os }}-bun-mcp-${{ hashFiles('mcp/bun.lock') }}
43+
restore-keys: |
44+
${{ runner.os }}-bun-mcp-
45+
46+
- name: Install dependencies
47+
run: bun install --frozen-lockfile
48+
49+
- name: Typecheck
50+
run: bun run typecheck
51+
52+
- name: Build
53+
run: bun run build

backend/plugin_test.go

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
package main
2+
3+
import (
4+
"encoding/json"
5+
"testing"
6+
7+
plugin "github.com/Paca-AI/plugin-sdk-go"
8+
"github.com/Paca-AI/plugin-sdk-go/plugintest"
9+
)
10+
11+
// ── Helpers ───────────────────────────────────────────────────────────────────
12+
13+
const (
14+
testProjectID = "project-1"
15+
testTaskID = "task-1"
16+
)
17+
18+
func setupPlugin(t *testing.T) *plugintest.Context {
19+
t.Helper()
20+
tc := plugintest.NewContext(t)
21+
22+
// Seed the shared tables referenced by FK.
23+
tc.DB.SeedRows("tasks", []string{"id", "project_id", "deleted_at"}, [][]any{
24+
{testTaskID, testProjectID, nil},
25+
})
26+
27+
// Seed empty plugin tables so queries return empty result sets instead of errors.
28+
tc.DB.SeedRows("github_integrations",
29+
[]string{"id", "project_id", "access_token_enc", "created_at", "updated_at"},
30+
nil)
31+
tc.DB.SeedRows("github_repositories",
32+
[]string{"id", "project_id", "integration_id", "owner", "repo_name", "full_name",
33+
"webhook_id", "webhook_secret_enc", "default_branch", "created_at", "updated_at"},
34+
nil)
35+
tc.DB.SeedRows("github_pull_requests",
36+
[]string{"id", "project_id", "repo_id", "pr_number", "github_pr_id", "title",
37+
"state", "html_url", "head_branch", "base_branch", "author", "merged_at", "created_at", "updated_at"},
38+
nil)
39+
tc.DB.SeedRows("github_task_pr_links",
40+
[]string{"id", "task_id", "pull_request_id", "created_at"},
41+
nil)
42+
tc.DB.SeedRows("github_task_branches",
43+
[]string{"id", "task_id", "repo_id", "branch_name", "created_at"},
44+
nil)
45+
46+
var p githubPlugin
47+
if err := p.Init(tc.PluginContext()); err != nil {
48+
t.Fatal("Init failed:", err)
49+
}
50+
return tc
51+
}
52+
53+
func callerReq() plugintest.Request {
54+
return plugintest.Request{
55+
Caller: plugin.CallerIdentity{
56+
ProjectID: testProjectID,
57+
CallerID: "member-1",
58+
CallerRole: "PROJECT_MEMBER",
59+
},
60+
PathParams: map[string]string{},
61+
}
62+
}
63+
64+
// ── Integration tests ─────────────────────────────────────────────────────────
65+
66+
func TestGetIntegration_NotConnected(t *testing.T) {
67+
tc := setupPlugin(t)
68+
res := tc.Call("GET", "/github", callerReq())
69+
70+
if res.StatusCode != 200 {
71+
t.Fatalf("expected 200, got %d: %s", res.StatusCode, res.BodyString())
72+
}
73+
var env struct {
74+
Success bool `json:"success"`
75+
Data integrationResponse `json:"data"`
76+
}
77+
if err := json.Unmarshal(res.Body, &env); err != nil {
78+
t.Fatal(err)
79+
}
80+
if !env.Success {
81+
t.Fatal("expected success=true")
82+
}
83+
if env.Data.Connected {
84+
t.Fatal("expected Connected=false when no token is set")
85+
}
86+
if env.Data.ProjectID != testProjectID {
87+
t.Fatalf("expected project_id=%s, got %s", testProjectID, env.Data.ProjectID)
88+
}
89+
}

backend/scanner.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,3 @@ func (s *scanner) int64Val(col string) int64 {
5555
func (s *scanner) intVal(col string) int {
5656
return int(s.int64Val(col))
5757
}
58-
59-
func (s *scanner) boolVal(col string) bool {
60-
i, ok := s.idx[col]
61-
if !ok || i >= len(s.row) || s.row[i] == nil {
62-
return false
63-
}
64-
if v, ok := s.row[i].(bool); ok {
65-
return v
66-
}
67-
return false
68-
}

0 commit comments

Comments
 (0)