Skip to content

Commit

Permalink
Initial client work
Browse files Browse the repository at this point in the history
  • Loading branch information
cretz committed Jul 16, 2024
1 parent d9fecd0 commit 87dbfa3
Show file tree
Hide file tree
Showing 94 changed files with 9,330 additions and 30 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Continuous Integration
on:
pull_request:
push:
branches:
- main
- "releases/*"

jobs:
build-lint-test:
strategy:
fail-fast: true
matrix:
# TODO(cretz): Enable Windows (it's slow)
# os: [ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest]
os: [ubuntu-latest, ubuntu-arm, macos-intel, macos-arm]
# Earliest and latest supported
rubyVersion: ["3.1", "3.3"]

include:
- os: ubuntu-latest
rubyVersion: "3.3"
checkTarget: true
- os: ubuntu-arm
runsOn: ubuntu-24.04-arm64-2-core
- os: macos-intel
runsOn: macos-12
- os: macos-arm
runsOn: macos-14
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive

- name: Setup Ruby and Rust
uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
ruby-version: ${{ matrix.rubyVersion }}
bundler-cache: true
cargo-cache: true

- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: temporalio/ext -> temporalio/target

# Needed for tests currently
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Install protoc
uses: arduino/setup-protoc@v3
with:
# TODO(cretz): Can upgrade proto when https://github.com/arduino/setup-protoc/issues/99 fixed
version: "23.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Lint Rust
if: ${{ matrix.checkTarget }}
working-directory: ./temporalio
run: cargo clippy && cargo fmt --check

# TODO(cretz): For checkTarget, regen protos and ensure no diff

- name: Lint, compile, test Ruby
working-directory: ./temporalio
run: bundle install && bundle exec rake TESTOPTS="--verbose"

# TODO(cretz): Build gem and smoke test against separate dir
37 changes: 9 additions & 28 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
.bundle/
.yardoc
_yardoc/

/coverage/
/doc/
/examples/vendor/
/pkg/
/spec/reports/
/tmp/

*.gem

# Thermite artefacts
mkmf.log
lib/temporal_sdk_ruby_bridge.*

# rspec failure tracking
.rspec_status

.idea/*

# Rust builds
bridge/target

# Go binaries
spec/support/go_server/main
spec/support/go_worker/main
tmp/
target/
Gemfile.lock
.gem_rbs_collection
*.so
temporalio/test/golangworker/golangworker
temporalio/.yardoc
temporalio/doc
temporalio/pkg
56 changes: 54 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,58 @@
# Temporal Ruby SDK

The Ruby SDK is under active development/refresh.
⚠️ UNDER ACTIVE DEVELOPMENT

The last tag before this refresh is [v0.1.1](https://github.com/temporalio/sdk-ruby/tree/v0.1.1). Please reference that
tag for the previous code.
tag for the previous code.

**TODO: Usage documentation**

## Development

### Build

Prerequisites:

* [Ruby](https://www.ruby-lang.org/) >= 3.1 (i.e. `ruby` and `bundle` on the `PATH`)
* [Rust](https://www.rust-lang.org/) latest stable (i.e. `cargo` on the `PATH`)
* [Protobuf Compiler](https://protobuf.dev/) (i.e. `protoc` on the `PATH`)
* This repository, cloned recursively
* Change to the `temporalio/` directory

To build shared library for development use:

bundle exec rake compile:dev

To build and test release:

bundle exec rake

### Testing

This project uses `minitest`. To test:

bundle exec rake test

Can add options via `TESTOPTS`. E.g. single test:

bundle exec rake test TESTOPTS="--name=test_start_workflows_async"

### Code Formatting and Type Checking

This project uses `rubocop`:

bundle exec rake rubocop:autocorrect

This project uses `steep`. First may need the RBS collection:

bundle exec rake rbs:install_collection

Now can run `steep`:

bundle exec rake steep

### Proto Generation

Run:

bundle exec rake proto:generate
66 changes: 66 additions & 0 deletions temporalio/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
inherit_mode:
merge:
- Exclude

AllCops:
NewCops: enable
TargetRubyVersion: 3.1
SuggestExtensions: false
Exclude:
- ext/**/*
- lib/temporalio/api/**/*
- target/**/*
- tmp/**/*
- vendor/**/*

# Keep cop rule settings in alphabetical order. For each rule setting, provide
# justification for the change from default.

# We want development dependencies in the gemspec
Gemspec/DevelopmentDependencies:
EnforcedStyle: gemspec

# We want our classes in a certain order
Layout/ClassStructure:
Enabled: true

# The default is too small and triggers simply setting lots of values on a proto
Metrics/AbcSize:
Max: 75

# The default is too small
Metrics/BlockLength:
Max: 100

# The default is too small
Metrics/ClassLength:
Max: 400

# The default is too small
Metrics/CyclomaticComplexity:
Max: 25

# The default is too small
Metrics/MethodLength:
Max: 100

# The default is too small
Metrics/PerceivedComplexity:
Max: 25

# We want methods to be documented
Style/DocumentationMethod:
Enabled: true

# Ok to have global vars in tests
Style/GlobalVars:
Exclude:
- test/**/*

# We want our require lists to be in order
Style/RequireOrder:
Enabled: true

# We are ok with large amount of keyword args
Metrics/ParameterLists:
CountKeywordArgs: false
Loading

0 comments on commit 87dbfa3

Please sign in to comment.