Skip to content

Commit 67ebca3

Browse files
authored
Merge pull request #161 from obeli-sk/readd-go
Readd go
2 parents 382d979 + 8363d95 commit 67ebca3

442 files changed

Lines changed: 27357 additions & 3 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/check-test-e2e.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,15 @@ jobs:
7373
TURSO_LOCATION: ${{ secrets.E2E_TURSO_LOCATION }}
7474
run: |
7575
nix develop --command ./scripts/test-e2e.sh ./obelisk-local-js-all.toml truncate
76+
77+
- name: Build Go WASM components
78+
run: nix develop --command ./scripts/build-components-go.sh
79+
80+
- name: Verify obelisk-local-go-all.toml
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.E2E_GITHUB_TOKEN }}
83+
TEST_GITHUB_LOGIN: ${{ secrets.TEST_GITHUB_LOGIN }}
84+
TURSO_TOKEN: ${{ secrets.E2E_TURSO_TOKEN }}
85+
TURSO_LOCATION: ${{ secrets.E2E_TURSO_LOCATION }}
86+
run: |
87+
nix develop --command ./scripts/test-e2e.sh ./obelisk-local-go-all.toml truncate
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: check-verify-go
2+
permissions:
3+
contents: read
4+
issues: read
5+
checks: write
6+
pull-requests: write
7+
8+
on:
9+
push:
10+
pull_request:
11+
workflow_dispatch:
12+
inputs:
13+
ref:
14+
description: "The ref (branch or SHA) to process"
15+
required: false
16+
type: string
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
20+
cancel-in-progress: true
21+
22+
defaults:
23+
run:
24+
shell: bash -xe {0}
25+
26+
jobs:
27+
verify:
28+
runs-on: ubuntu-24.04
29+
steps:
30+
- uses: actions/checkout@v6
31+
with:
32+
ref: ${{ github.event.inputs.ref }} # Use the ref if provided, otherwise defaults to the current branch/commit
33+
34+
- uses: nixbuild/nix-quick-install-action@v34
35+
with:
36+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
37+
nix_conf: |
38+
extra-substituters = https://cache.garnix.io
39+
extra-trusted-public-keys = cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g
40+
- name: Populate the nix store
41+
run: |
42+
nix develop --command echo
43+
44+
- name: Build Rust Components
45+
run: nix develop --command just rust
46+
47+
- name: Build Go Components
48+
run: nix develop --command just go
49+
50+
- name: Verify obelisk-local-go variants
51+
run: |
52+
nix develop --command obelisk server verify --ignore-missing-env-vars --deployment obelisk-local-go-activity.toml
53+
nix develop --command obelisk server verify --ignore-missing-env-vars --deployment obelisk-local-go-workflow.toml
54+
nix develop --command obelisk server verify --ignore-missing-env-vars --deployment obelisk-local-go-webhook.toml
55+
# obelisk-local-go-all.toml is verified by e2e workflow

Justfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Build all components (Rust, JS)
2-
build: rust js
1+
# Build all components (Rust, JS, Go)
2+
build: rust js go
33

44
# Build Rust components
55
rust:
@@ -13,6 +13,10 @@ rust:
1313
js:
1414
./scripts/build-components-js.sh
1515

16+
# Build Go components
17+
go:
18+
./scripts/build-components-go.sh
19+
1620
serve:
1721
obelisk server run --config ./obelisk-local.toml
1822

@@ -24,3 +28,5 @@ test-e2e: rust
2428
./scripts/test-e2e.sh ./obelisk-local.toml truncate
2529
test-e2e-js: js
2630
./scripts/test-e2e.sh ./obelisk-local-js-all.toml truncate
31+
test-e2e-go: go
32+
./scripts/test-e2e.sh ./obelisk-local-go-all.toml truncate

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,9 @@ To build JavaScript components use
116116
just js
117117
```
118118

119+
To build Go components use
120+
```sh
121+
just go
122+
```
123+
119124
Make sure to use tools and versions as specified in [dev-deps.txt](./dev-deps.txt).

activity/llm/openai-go/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# openai-go Activity
2+
3+
Go reimplementation of [openai](../openai/) activity.
4+
5+
## Setting up
6+
Required versions of `tinygo`, `wit-bindgen-go-cli`, `wasm-tools` can be found in [dev-deps.txt](../dev-deps.txt).
7+
See [Go tooling](https://component-model.bytecodealliance.org/language-support/go.html) for more information.
8+
9+
10+
Regenerate bindings after modifying `wit` folder:
11+
```sh
12+
./regen.sh
13+
```
14+
15+
## Building
16+
```sh
17+
./build.sh
18+
```
19+
20+
## Deplying and running with Obelisk
21+
```sh
22+
# in repo root
23+
obelisk server run --config obelisk-local-go-activity.toml
24+
```
25+
26+
## Testing
27+
```sh
28+
obelisk execution submit --follow stargazers:llm/llm.respond \
29+
'["Tell me about Rust programming", "{\"model\": \"gpt-3.5-turbo\", \"max_tokens\": 50}"]'
30+
```

activity/llm/openai-go/build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
set -exuo pipefail
3+
cd "$(dirname "$0")"
4+
5+
module_name=$(grep '^module ' go.mod | awk '{print $2}')
6+
component_name=$(basename "$module_name")
7+
tinygo build -target=wasip2 -o dist/$component_name.wasm --wit-package wit/ --wit-world root main.go
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// This file exists for testing this package without WebAssembly,
2+
// allowing empty function bodies with a //go:wasmimport directive.
3+
// See https://pkg.go.dev/cmd/compile for more information.

activity/llm/openai-go/gen/obelisk/log/log/log.wasm.go

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

activity/llm/openai-go/gen/obelisk/log/log/log.wit.go

Lines changed: 63 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)