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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ workers/python/**/__pycache__/
workers/typescript/harness/dist/
workers/typescript/harness/dist-test/
workers/typescript/harness/src/generated/
workers/**/.rubocop_cache/
workers/*/omes-temp-*/
workers/*/prepared/
workers/**/project-build-*/
Expand Down
7 changes: 7 additions & 0 deletions cmd/dev/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ func installRuby(ctx context.Context) error {
return err
}
fmt.Println("✅ Ruby worker dependencies installed successfully!")

harnessDir := targetDir + "/harness"
fmt.Println("Installing Ruby harness dependencies...")
if err := runCommandInDir(ctx, harnessDir, "bundle", "install"); err != nil {
return err
}
fmt.Println("✅ Ruby harness dependencies installed successfully!")
return nil
}

Expand Down
17 changes: 17 additions & 0 deletions cmd/dev/lint_and_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,23 @@ func lintAndFormatRubyWorker(ctx context.Context, workerDir string) error {
return err
}

harnessDir := workerDir + "/harness"

fmt.Println("Formatting Ruby harness...")
if err := runCommandInDir(ctx, harnessDir, "bundle", "exec", "rubocop", "-A"); err != nil {
return err
}

fmt.Println("Linting Ruby harness...")
if err := runCommandInDir(ctx, harnessDir, "bundle", "exec", "rubocop"); err != nil {
return err
}

fmt.Println("Type checking Ruby harness...")
if err := runCommandInDir(ctx, harnessDir, "bundle", "exec", "steep", "check"); err != nil {
return err
}

fmt.Println("✅ Ruby lint-and-format completed successfully!")
return nil
}
Expand Down
33 changes: 33 additions & 0 deletions cmd/dev/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ func runTestWorker(ctx context.Context, language string) error {
return err
}
}
if language == "ruby" {
if err := runRubyHarnessTests(ctx, repoDir); err != nil {
return err
}
}
return testWorkerLocally(ctx, repoDir, language, sdkVersion)
}

Expand Down Expand Up @@ -125,6 +130,34 @@ func runTypeScriptHarnessTests(ctx context.Context, repoDir string) error {
return nil
}

func runRubyHarnessTests(ctx context.Context, repoDir string) error {
harnessDir := filepath.Join(repoDir, "workers", "ruby", "harness")
rubyVersion, err := getVersion("ruby")
if err != nil {
return err
}
if err := checkMise(); err != nil {
return err
}
fmt.Println("Running Ruby harness tests...")
if err := runCommandInDir(
ctx,
harnessDir,
"mise",
"exec",
"ruby@"+rubyVersion,
"--",
"bundle",
"exec",
"rake",
"test",
); err != nil {
return fmt.Errorf("failed Ruby harness tests: %w", err)
}
fmt.Println("✅ Ruby harness tests completed successfully!")
return nil
}

func testWorkerLocally(ctx context.Context, repoDir, language, sdkVersion string) error {
args := []string{
"go", "run", "./cmd", "run-scenario-with-worker",
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.11.1
github.com/temporalio/features v0.0.0-20260331150122-757294c2a9e9
github.com/temporalio/features v0.0.0-20260427223549-86e4c0deedd7
github.com/temporalio/omes/workers/go/harness/api v0.0.0-00010101000000-000000000000
go.temporal.io/api v1.62.7
go.temporal.io/sdk v1.42.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/temporalio/features v0.0.0-20260331150122-757294c2a9e9 h1:9ifP6KcfPhf22qFb4t7L8M11nkWGD8cyAFQ3fUrLqFw=
github.com/temporalio/features v0.0.0-20260331150122-757294c2a9e9/go.mod h1:LsZUh/AkCjnOKrEpnEklGmsJ3g758Hyq2X+hzMofMjw=
github.com/temporalio/features v0.0.0-20260427223549-86e4c0deedd7 h1:gBLwgyi8xw0oqZgxMwxTRGIfP8RxtI7r1igm3G6aXGY=
github.com/temporalio/features v0.0.0-20260427223549-86e4c0deedd7/go.mod h1:BUWwBMK+Ga5h9xPTS7+kmutSIfY4K1gfSH8eG7fSbU0=
github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4=
github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4=
github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso=
Expand Down
37 changes: 11 additions & 26 deletions workers/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,37 +285,22 @@ func (b *Builder) buildDotNet(ctx context.Context, baseDir string) (sdkbuild.Pro
}

func (b *Builder) buildRuby(ctx context.Context, baseDir string) (sdkbuild.Program, error) {
// If version not provided, read the version constraint from the gemspec.
version := b.SdkOptions.Version
if version == "" {
gemspecBytes, err := os.ReadFile(filepath.Join(baseDir, "omes.gemspec"))
if err != nil {
return nil, fmt.Errorf("failed reading omes.gemspec: %w", err)
}
for _, line := range strings.Split(string(gemspecBytes), "\n") {
line = strings.TrimSpace(line)
if strings.Contains(line, "'temporalio'") || strings.Contains(line, `"temporalio"`) {
parts := strings.Split(line, ",")
if len(parts) >= 2 {
version = strings.TrimSpace(parts[1])
version = strings.Trim(version, `"'`)
}
break
}
}
if version == "" {
return nil, fmt.Errorf("version not found in omes.gemspec")
}
}

prog, err := sdkbuild.BuildRubyProgram(ctx, sdkbuild.BuildRubyProgramOptions{
options := sdkbuild.BuildRubyProgramOptions{
BaseDir: baseDir,
SourceDir: baseDir,
DirName: b.DirName,
Version: version,
Version: b.SdkOptions.Version,
Stdout: b.stdout,
Stderr: b.stderr,
})
}
if b.ProjectName == "" {
options.MoreDependencies = []sdkbuild.RubyDependency{{
Name: "harness",
Path: filepath.Join(baseDir, "harness"),
}}
}

prog, err := sdkbuild.BuildRubyProgram(ctx, options)
if err != nil {
return nil, fmt.Errorf("failed preparing: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions workers/go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/temporalio/features v0.0.0-20260331150122-757294c2a9e9 h1:9ifP6KcfPhf22qFb4t7L8M11nkWGD8cyAFQ3fUrLqFw=
github.com/temporalio/features v0.0.0-20260331150122-757294c2a9e9/go.mod h1:LsZUh/AkCjnOKrEpnEklGmsJ3g758Hyq2X+hzMofMjw=
github.com/temporalio/features v0.0.0-20260427223549-86e4c0deedd7 h1:gBLwgyi8xw0oqZgxMwxTRGIfP8RxtI7r1igm3G6aXGY=
github.com/temporalio/features v0.0.0-20260427223549-86e4c0deedd7/go.mod h1:BUWwBMK+Ga5h9xPTS7+kmutSIfY4K1gfSH8eG7fSbU0=
github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4=
github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4=
github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso=
Expand Down
5 changes: 5 additions & 0 deletions workers/ruby/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
AllCops:
TargetRubyVersion: 3.3
NewCops: enable
SuggestExtensions: false
Exclude:
- "harness/**/*"
- "protos/**/*"
- "vendor/**/*"
- "omes-temp-*/**/*"
Expand Down Expand Up @@ -44,3 +46,6 @@ Metrics/PerceivedComplexity:

Metrics/AbcSize:
Max: 25

Metrics/ParameterLists:
CountKeywordArgs: false
3 changes: 3 additions & 0 deletions workers/ruby/Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
source 'https://rubygems.org'

gemspec
gem 'harness', path: 'harness'

group :development do
gem 'rbs', '~> 3.10'
gem 'rubocop', '~> 1.0'
gem 'steep', '~> 1.10'
end
Loading
Loading