Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions .github/workflows/backend-pr-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: backend-pr-ci

on:
pull_request:
paths:
- "backend/**"
- ".github/workflows/backend-pr-ci.yml"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: backend-pr-ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
GO_VERSION: "1.24"

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10

defaults:
run:
working-directory: backend

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: backend/go.sum

- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest

- name: Run golangci-lint
run: golangci-lint run --timeout=5m

build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 10

defaults:
run:
working-directory: backend

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: backend/go.sum

- name: Build WASM
run: GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o bdd.wasm .

test:
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 15

defaults:
run:
working-directory: backend

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: backend/go.sum

- name: Run tests (race detector)
run: go test -race -timeout 60s -coverprofile=coverage.out $(go list ./...)

- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: backend/coverage.out
retention-days: 7
53 changes: 53 additions & 0 deletions .github/workflows/frontend-pr-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: frontend-pr-ci

on:
pull_request:
paths:
- "frontend/**"
- ".github/workflows/frontend-pr-ci.yml"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: frontend-pr-ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
web-quality:
name: Typecheck and build frontend
runs-on: ubuntu-latest
timeout-minutes: 20

defaults:
run:
working-directory: frontend

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.2.23"

- name: Cache Bun packages
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('frontend/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Typecheck
run: bun run typecheck

- name: Build production bundle
run: bun run build
53 changes: 53 additions & 0 deletions .github/workflows/mcp-pr-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: mcp-pr-ci

on:
pull_request:
paths:
- "mcp/**"
- ".github/workflows/mcp-pr-ci.yml"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: mcp-pr-ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
mcp-quality:
name: Typecheck and build MCP server
runs-on: ubuntu-latest
timeout-minutes: 10

defaults:
run:
working-directory: mcp

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.2.23"

- name: Cache Bun packages
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-mcp-${{ hashFiles('mcp/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-mcp-

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Typecheck
run: bun run typecheck

- name: Build
run: bun run build
2 changes: 1 addition & 1 deletion backend/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module github.com/Paca-AI/first-party/bdd

go 1.24

require github.com/Paca-AI/plugin-sdk-go v0.2.0-rc.3
require github.com/Paca-AI/plugin-sdk-go v0.2.0-rc.5

require github.com/google/uuid v1.6.0
4 changes: 2 additions & 2 deletions backend/go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github.com/Paca-AI/plugin-sdk-go v0.2.0-rc.3 h1:2MFHmdVIKVo1/Cyo7GL3S/LsAFxpsqhJSAbTao+xNEw=
github.com/Paca-AI/plugin-sdk-go v0.2.0-rc.3/go.mod h1:5WeC6cSEf2wM1ovICZbDaVky9oi5id/Qpdfc5LDAQnw=
github.com/Paca-AI/plugin-sdk-go v0.2.0-rc.5 h1:xrEPnJLM2sdwtY/wRaGOdfeDPv5zPUpR8QZJ/w2nQVU=
github.com/Paca-AI/plugin-sdk-go v0.2.0-rc.5/go.mod h1:5WeC6cSEf2wM1ovICZbDaVky9oi5id/Qpdfc5LDAQnw=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
37 changes: 37 additions & 0 deletions backend/scenarios.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ func (p *bddPlugin) createScenario(req *plugin.Request, res *plugin.Response) {
CreatedAt: now,
UpdatedAt: now,
}
plugin.RecordActivity(taskID, projectID, req.Caller.UserID, "task.bdd_scenario.created",
map[string]any{"title": b.Title})
created(res, scenario)
}

Expand Down Expand Up @@ -225,6 +227,22 @@ func (p *bddPlugin) updateScenario(req *plugin.Request, res *plugin.Response) {
res.Error(404, "bdd scenario not found")
return
}
// Collect which fields changed for the activity record.
var changedFields []string
if b.Title != nil && *b.Title != sc.str("title") {
changedFields = append(changedFields, "title")
}
if b.Given != nil && *b.Given != sc.str("given_text") {
changedFields = append(changedFields, "given")
}
if b.When != nil && *b.When != sc.str("when_text") {
changedFields = append(changedFields, "when")
}
if b.Then != nil && *b.Then != sc.str("then_text") {
changedFields = append(changedFields, "then")
}
plugin.RecordActivity(taskID, projectID, req.Caller.UserID, "task.bdd_scenario.updated",
map[string]any{"title": updTitle, "changes": changedFields})
Comment thread
pikann marked this conversation as resolved.
ok(res, bddScenario{
ID: scenarioID,
TaskID: taskID,
Expand All @@ -247,6 +265,23 @@ func (p *bddPlugin) deleteScenario(req *plugin.Request, res *plugin.Response) {
return
}

// Fetch title before deletion for the activity record.
titleResult, err := p.db.Query(
`SELECT title FROM bdd_scenarios WHERE id = $1 AND task_id = $2`,
scenarioID, taskID,
)
if err != nil {
p.log.Error("deleteScenario title fetch: " + err.Error())
res.Error(500, "failed to delete bdd scenario")
return
}
if len(titleResult.Rows) == 0 {
res.Error(404, "bdd scenario not found")
return
}
scenarioTitleSC := newRowScanner(titleResult.Columns, titleResult.Rows[0])
scenarioTitle := scenarioTitleSC.str("title")

affected, err := p.db.Exec(
`DELETE FROM bdd_scenarios WHERE id = $1 AND task_id = $2`,
scenarioID, taskID,
Expand All @@ -260,6 +295,8 @@ func (p *bddPlugin) deleteScenario(req *plugin.Request, res *plugin.Response) {
res.Error(404, "bdd scenario not found")
return
}
plugin.RecordActivity(taskID, projectID, req.Caller.UserID, "task.bdd_scenario.deleted",
map[string]any{"title": scenarioTitle})
res.NoContent()
}

Expand Down
Loading
Loading