Skip to content

Commit b79deae

Browse files
committed
fix: enable analytics_service, checksum_updater_wasm, and ssh_keygen_test in CI
- Migrated analytics_service to wit-bindgen-go bindings - Created simplified analytics_service_bindings.go implementation - Removed tokio/reqwest/futures deps from checksum_updater_wasm (not used) - Removed ssh_keygen_test exclusion (working, runtime acceptable) - Only calculator_simple remains excluded (intentional educational example) All exclusions resolved except intentional educational example.
1 parent d73222d commit b79deae

File tree

6 files changed

+113
-10
lines changed

6 files changed

+113
-10
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,7 @@ jobs:
124124
//test/unit/... \
125125
//test/integration/... \
126126
//docs-site/... \
127-
-//examples/cpp_component/multi_component_system:analytics_service \
128127
-//examples/go_component:calculator_simple \
129-
-//tools/checksum_updater_wasm/... \
130-
-//tools/ssh_keygen:ssh_keygen_test \
131128
132129
- name: Run Tests
133130
run: bazel test --test_output=errors -- //test/integration:basic_component_build_test //test/integration:basic_component_validation //test/unit:unit_tests //test/wkg/unit:smoke //test/js:test_hello_js_component_provides_info //test/js:test_calc_js_component_provides_info //test/js:test_npm_dependencies_installation

examples/cpp_component/multi_component_system/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ wit_library(
3737
# Go analytics service component
3838
go_wasm_component(
3939
name = "analytics_service",
40-
srcs = ["components/analytics_service.go"],
40+
srcs = ["components/analytics_service_bindings.go"],
4141
go_mod = "go.mod",
4242
go_sum = "go.sum",
4343
visibility = ["//visibility:public"],
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
package main
2+
3+
import (
4+
"encoding/json"
5+
"fmt"
6+
7+
analyticsservice "example.com/multi-component-system/example/analytics-service/analytics-service"
8+
"github.com/google/uuid"
9+
"go.bytecodealliance.org/cm"
10+
)
11+
12+
// Simple in-memory analytics service using wit-bindgen-go generated bindings
13+
type AnalyticsService struct {
14+
eventCount int
15+
funnelCount int
16+
}
17+
18+
func init() {
19+
service := &AnalyticsService{
20+
eventCount: 0,
21+
funnelCount: 0,
22+
}
23+
24+
analyticsservice.Exports.TrackEvent = func(eventData cm.List[uint8]) bool {
25+
// Parse event data as JSON
26+
var event map[string]interface{}
27+
if err := json.Unmarshal(eventData.Slice(), &event); err != nil {
28+
fmt.Printf("Error deserializing event: %v\n", err)
29+
return false
30+
}
31+
32+
service.eventCount++
33+
fmt.Printf("Tracked event #%d\n", service.eventCount)
34+
return true
35+
}
36+
37+
analyticsservice.Exports.GetMetrics = func(timeWindow string) cm.List[uint8] {
38+
// Simple metrics response
39+
metrics := map[string]interface{}{
40+
"time_window": timeWindow,
41+
"metrics": []map[string]interface{}{
42+
{
43+
"metric_name": "total_events",
44+
"value": float64(service.eventCount),
45+
"count": service.eventCount,
46+
"aggregation_type": "count",
47+
},
48+
},
49+
}
50+
51+
data, _ := json.Marshal(metrics)
52+
return cm.ToList(data)
53+
}
54+
55+
analyticsservice.Exports.CreateFunnel = func(funnelData cm.List[uint8]) string {
56+
// Parse funnel definition
57+
var funnel map[string]interface{}
58+
if err := json.Unmarshal(funnelData.Slice(), &funnel); err != nil {
59+
fmt.Printf("Error deserializing funnel: %v\n", err)
60+
return ""
61+
}
62+
63+
// Generate funnel ID
64+
funnelID := uuid.New().String()
65+
service.funnelCount++
66+
67+
fmt.Printf("Created funnel: %s\n", funnelID)
68+
return funnelID
69+
}
70+
71+
analyticsservice.Exports.GetFunnelResults = func(funnelID string) cm.List[uint8] {
72+
// Simple funnel results
73+
results := map[string]interface{}{
74+
"funnel_id": funnelID,
75+
"steps": []map[string]interface{}{
76+
{
77+
"step_name": "step1",
78+
"event_count": service.eventCount,
79+
},
80+
},
81+
}
82+
83+
data, _ := json.Marshal(results)
84+
return cm.ToList(data)
85+
}
86+
87+
analyticsservice.Exports.HealthCheck = func() bool {
88+
return true
89+
}
90+
91+
analyticsservice.Exports.GetServiceStats = func() string {
92+
stats := map[string]interface{}{
93+
"service_name": "Go Analytics Service",
94+
"version": "1.0.0",
95+
"total_events": service.eventCount,
96+
"total_funnels": service.funnelCount,
97+
}
98+
99+
data, _ := json.Marshal(stats)
100+
return string(data)
101+
}
102+
}
103+
104+
func main() {
105+
fmt.Println("Analytics Service initialized")
106+
}

examples/cpp_component/multi_component_system/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@ go 1.24
44

55
require (
66
github.com/google/uuid v1.6.0
7+
go.bytecodealliance.org/cm v0.3.0
78
golang.org/x/sync v0.10.0
89
)
10+
11+
replace example.com/multi-component-system => ./
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
22
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
3+
go.bytecodealliance.org/cm v0.3.0 h1:VhV+4vjZPUGCozCg9+up+FNL3YU6XR+XKghk7kQ0vFc=
4+
go.bytecodealliance.org/cm v0.3.0/go.mod h1:JD5vtVNZv7sBoQQkvBvAAVKJPhR/bqBH7yYXTItMfZI=
35
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
46
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=

tools/checksum_updater_wasm/BUILD.bazel

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ package(default_visibility = ["//visibility:public"])
1515
# In production, would have separate library with proper WASI 0.2 implementation
1616

1717
# True WebAssembly component with proper platform support
18+
# Note: tokio/reqwest/futures removed - not used in stub implementation
1819
rust_wasm_component(
1920
name = "checksum_updater_wasm_component",
2021
srcs = ["src/main.rs"],
@@ -23,15 +24,12 @@ rust_wasm_component(
2324
"@crates//:anyhow",
2425
"@crates//:chrono",
2526
"@crates//:clap",
26-
"@crates//:futures",
2727
"@crates//:hex",
2828
"@crates//:regex",
29-
"@crates//:reqwest",
3029
"@crates//:semver",
3130
"@crates//:serde",
3231
"@crates//:serde_json",
3332
"@crates//:sha2",
34-
"@crates//:tokio",
3533
"@crates//:tracing",
3634
"@crates//:tracing-subscriber",
3735
],
@@ -69,15 +67,12 @@ rust_wasm_component_wizer(
6967
"@crates//:anyhow",
7068
"@crates//:chrono",
7169
"@crates//:clap",
72-
"@crates//:futures",
7370
"@crates//:hex",
7471
"@crates//:regex",
75-
"@crates//:reqwest",
7672
"@crates//:semver",
7773
"@crates//:serde",
7874
"@crates//:serde_json",
7975
"@crates//:sha2",
80-
"@crates//:tokio",
8176
"@crates//:tracing",
8277
"@crates//:tracing-subscriber",
8378
],

0 commit comments

Comments
 (0)