Skip to content

Commit 5d17d1d

Browse files
authored
Scaffolding and bare-bones client (#155)
1 parent fd0bfe0 commit 5d17d1d

File tree

97 files changed

+9401
-30
lines changed

Some content is hidden

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

97 files changed

+9401
-30
lines changed

.github/workflows/ci.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Continuous Integration
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
- "releases/*"
8+
9+
jobs:
10+
build-lint-test:
11+
strategy:
12+
fail-fast: true
13+
matrix:
14+
# TODO(cretz): Enable Windows (it's slow)
15+
#
16+
# TODO(cretz): Enable Linux ARM. It's not natively supported with setup-ruby (see
17+
# https://github.com/ruby/setup-ruby#supported-platforms). So we need to set ruby-version to 'none' per
18+
# https://github.com/oxidize-rb/actions/tree/main/setup-ruby-and-rust and install Ruby ourselves maybe. See
19+
# https://github.com/ruby/setup-ruby?tab=readme-ov-file#using-self-hosted-runners. The error states:
20+
# Error: The current runner (ubuntu-24.04-arm64) was detected as self-hosted because the platform does not match a GitHub-hosted runner image (or that image is deprecated and no longer supported).
21+
# In such a case, you should install Ruby in the $RUNNER_TOOL_CACHE yourself, for example using https://github.com/rbenv/ruby-build
22+
# You can take inspiration from this workflow for more details: https://github.com/ruby/ruby-builder/blob/master/.github/workflows/build.yml
23+
#
24+
#os: [ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest]
25+
os: [ubuntu-latest, macos-intel, macos-arm]
26+
# Earliest and latest supported
27+
rubyVersion: ["3.1", "3.3"]
28+
29+
include:
30+
- os: ubuntu-latest
31+
rubyVersion: "3.3"
32+
checkTarget: true
33+
- os: macos-intel
34+
runsOn: macos-12
35+
- os: macos-arm
36+
runsOn: macos-14
37+
runs-on: ${{ matrix.runsOn || matrix.os }}
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v2
41+
with:
42+
submodules: recursive
43+
44+
- name: Setup Ruby and Rust
45+
uses: oxidize-rb/actions/setup-ruby-and-rust@v1
46+
with:
47+
ruby-version: ${{ matrix.rubyVersion }}
48+
bundler-cache: true
49+
cargo-cache: true
50+
51+
- name: Setup Rust cache
52+
uses: Swatinem/rust-cache@v2
53+
with:
54+
workspaces: temporalio/ext -> temporalio/target
55+
56+
# Needed for tests currently
57+
- name: Install Go
58+
uses: actions/setup-go@v5
59+
with:
60+
go-version: stable
61+
62+
- name: Install protoc
63+
uses: arduino/setup-protoc@v3
64+
with:
65+
# TODO(cretz): Can upgrade proto when https://github.com/arduino/setup-protoc/issues/99 fixed
66+
version: "23.x"
67+
repo-token: ${{ secrets.GITHUB_TOKEN }}
68+
69+
- name: Lint Rust
70+
if: ${{ matrix.checkTarget }}
71+
working-directory: ./temporalio
72+
run: cargo clippy && cargo fmt --check
73+
74+
# TODO(cretz): For checkTarget, regen protos and ensure no diff
75+
76+
- name: Lint, compile, test Ruby
77+
working-directory: ./temporalio
78+
run: bundle install && bundle exec rake TESTOPTS="--verbose"
79+
80+
# TODO(cretz): Build gem and smoke test against separate dir

.gitignore

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,9 @@
1-
.bundle/
2-
.yardoc
3-
_yardoc/
4-
5-
/coverage/
6-
/doc/
7-
/examples/vendor/
8-
/pkg/
9-
/spec/reports/
10-
/tmp/
11-
12-
*.gem
13-
14-
# Thermite artefacts
15-
mkmf.log
16-
lib/temporal_sdk_ruby_bridge.*
17-
18-
# rspec failure tracking
19-
.rspec_status
20-
21-
.idea/*
22-
23-
# Rust builds
24-
bridge/target
25-
26-
# Go binaries
27-
spec/support/go_server/main
28-
spec/support/go_worker/main
1+
tmp/
2+
target/
3+
Gemfile.lock
4+
.gem_rbs_collection
5+
*.so
6+
temporalio/test/golangworker/golangworker
7+
temporalio/.yardoc
8+
temporalio/doc
9+
temporalio/pkg

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "temporalio/ext/sdk-core"]
2+
path = temporalio/ext/sdk-core
3+
url = https://github.com/temporalio/sdk-core.git

README.md

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,58 @@
11
# Temporal Ruby SDK
22

3-
The Ruby SDK is under active development/refresh.
3+
⚠️ UNDER ACTIVE DEVELOPMENT
44

55
The last tag before this refresh is [v0.1.1](https://github.com/temporalio/sdk-ruby/tree/v0.1.1). Please reference that
6-
tag for the previous code.
6+
tag for the previous code.
7+
8+
**TODO: Usage documentation**
9+
10+
## Development
11+
12+
### Build
13+
14+
Prerequisites:
15+
16+
* [Ruby](https://www.ruby-lang.org/) >= 3.1 (i.e. `ruby` and `bundle` on the `PATH`)
17+
* [Rust](https://www.rust-lang.org/) latest stable (i.e. `cargo` on the `PATH`)
18+
* [Protobuf Compiler](https://protobuf.dev/) (i.e. `protoc` on the `PATH`)
19+
* This repository, cloned recursively
20+
* Change to the `temporalio/` directory
21+
22+
To build shared library for development use:
23+
24+
bundle exec rake compile:dev
25+
26+
To build and test release:
27+
28+
bundle exec rake
29+
30+
### Testing
31+
32+
This project uses `minitest`. To test:
33+
34+
bundle exec rake test
35+
36+
Can add options via `TESTOPTS`. E.g. single test:
37+
38+
bundle exec rake test TESTOPTS="--name=test_start_workflows_async"
39+
40+
### Code Formatting and Type Checking
41+
42+
This project uses `rubocop`:
43+
44+
bundle exec rake rubocop:autocorrect
45+
46+
This project uses `steep`. First may need the RBS collection:
47+
48+
bundle exec rake rbs:install_collection
49+
50+
Now can run `steep`:
51+
52+
bundle exec rake steep
53+
54+
### Proto Generation
55+
56+
Run:
57+
58+
bundle exec rake proto:generate

temporalio/.rubocop.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
inherit_mode:
2+
merge:
3+
- Exclude
4+
5+
AllCops:
6+
NewCops: enable
7+
TargetRubyVersion: 3.1
8+
SuggestExtensions: false
9+
Exclude:
10+
- ext/**/*
11+
- lib/temporalio/api/**/*
12+
- target/**/*
13+
- tmp/**/*
14+
- vendor/**/*
15+
16+
# Keep cop rule settings in alphabetical order. For each rule setting, provide
17+
# justification for the change from default.
18+
19+
# We want development dependencies in the gemspec
20+
Gemspec/DevelopmentDependencies:
21+
EnforcedStyle: gemspec
22+
23+
# We want our classes in a certain order
24+
Layout/ClassStructure:
25+
Enabled: true
26+
27+
# The default is too small and triggers simply setting lots of values on a proto
28+
Metrics/AbcSize:
29+
Max: 75
30+
31+
# The default is too small
32+
Metrics/BlockLength:
33+
Max: 100
34+
35+
# The default is too small
36+
Metrics/ClassLength:
37+
Max: 400
38+
39+
# The default is too small
40+
Metrics/CyclomaticComplexity:
41+
Max: 25
42+
43+
# The default is too small
44+
Metrics/MethodLength:
45+
Max: 100
46+
47+
# The default is too small
48+
Metrics/PerceivedComplexity:
49+
Max: 25
50+
51+
# We want methods to be documented
52+
Style/DocumentationMethod:
53+
Enabled: true
54+
55+
# Ok to have global vars in tests
56+
Style/GlobalVars:
57+
Exclude:
58+
- test/**/*
59+
60+
# We want our require lists to be in order
61+
Style/RequireOrder:
62+
Enabled: true
63+
64+
# We are ok with large amount of keyword args
65+
Metrics/ParameterLists:
66+
CountKeywordArgs: false

0 commit comments

Comments
 (0)