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
17 changes: 17 additions & 0 deletions .github/workflows/all-docker-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ on:
cs-ver:
description: .NET SDK ver to build. Skipped if not specified. Must start with v.
type: string
rb-ver:
description: Ruby SDK ver to build. Skipped if not specified. Must start with v.
type: string
do-push:
description: If set, push the built images to Docker Hub.
type: boolean
Expand Down Expand Up @@ -58,6 +61,9 @@ on:
cs-ver:
description: .NET SDK ver to build. Skipped if not specified. Must start with v.
type: string
rb-ver:
description: Ruby SDK ver to build. Skipped if not specified. Must start with v.
type: string
do-push:
description: If set, push the built images to Docker Hub.
type: boolean
Expand Down Expand Up @@ -137,3 +143,14 @@ jobs:
semver-latest: major
do-push: ${{ inputs.do-push }}
skip-cloud: ${{ inputs.skip-cloud }}

build-rb-docker-images:
if: inputs.rb-ver
uses: ./.github/workflows/docker-images.yaml
secrets: inherit
with:
lang: rb
sdk-version: ${{ inputs.rb-ver }}
semver-latest: major
do-push: ${{ inputs.do-push }}
skip-cloud: ${{ inputs.skip-cloud }}
61 changes: 55 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ on: # rebuild any PRs and main branch changes
dotnet_sdk_version:
default: ''
type: string
ruby_sdk_version:
default: ''
type: string

permissions:
contents: read
Expand All @@ -48,6 +51,7 @@ jobs:
php_latest: ${{ steps.latest_version.outputs.php_latest }}
python_latest: ${{ steps.latest_version.outputs.python_latest }}
csharp_latest: ${{ steps.latest_version.outputs.csharp_latest }}
ruby_latest: ${{ steps.latest_version.outputs.ruby_latest }}
steps:
- name: Print build information
run: 'echo head_ref: "$GITHUB_HEAD_REF", ref: "$GITHUB_REF", os: ${{ matrix.os }}'
Expand All @@ -60,49 +64,64 @@ jobs:

- name: Get the latest release version
id: latest_version
env:
INPUT_GO_SDK_VERSION: ${{ github.event.inputs.go_sdk_version }}
INPUT_TS_SDK_VERSION: ${{ github.event.inputs.typescript_sdk_version }}
INPUT_JAVA_SDK_VERSION: ${{ github.event.inputs.java_sdk_version }}
INPUT_PHP_SDK_VERSION: ${{ github.event.inputs.php_sdk_version }}
INPUT_PYTHON_SDK_VERSION: ${{ github.event.inputs.python_sdk_version }}
INPUT_DOTNET_SDK_VERSION: ${{ github.event.inputs.dotnet_sdk_version }}
INPUT_RUBY_SDK_VERSION: ${{ github.event.inputs.ruby_sdk_version }}
run: |
go_latest="${{ github.event.inputs.go_sdk_version }}"
go_latest="$INPUT_GO_SDK_VERSION"
if [ -z "$go_latest" ]; then
go_latest=$(./temporal-features latest-sdk-version --lang go)
echo "Derived latest Go SDK release version: $go_latest"
fi
echo "go_latest=$go_latest" >> $GITHUB_OUTPUT

typescript_latest="${{ github.event.inputs.typescript_sdk_version }}"
typescript_latest="$INPUT_TS_SDK_VERSION"
if [ -z "$typescript_latest" ]; then
typescript_latest=$(./temporal-features latest-sdk-version --lang ts)
echo "Derived latest Typescript SDK release version: $typescript_latest"
fi
echo "typescript_latest=$typescript_latest" >> $GITHUB_OUTPUT

java_latest="${{ github.event.inputs.java_sdk_version }}"
java_latest="$INPUT_JAVA_SDK_VERSION"
if [ -z "$java_latest" ]; then
java_latest=$(./temporal-features latest-sdk-version --lang java)
echo "Derived latest Java SDK release version: $java_latest"
fi
echo "java_latest=$java_latest" >> $GITHUB_OUTPUT

php_latest="${{ github.event.inputs.php_sdk_version }}"
php_latest="$INPUT_PHP_SDK_VERSION"
if [ -z "$php_latest" ]; then
php_latest=$(./temporal-features latest-sdk-version --lang php)
echo "Derived latest PHP SDK release version: $php_latest"
fi
echo "php_latest=$php_latest" >> $GITHUB_OUTPUT

python_latest="${{ github.event.inputs.python_sdk_version }}"
python_latest="$INPUT_PYTHON_SDK_VERSION"
if [ -z "$python_latest" ]; then
python_latest=$(./temporal-features latest-sdk-version --lang py)
echo "Derived latest Python SDK release version: $python_latest"
fi
echo "python_latest=$python_latest" >> $GITHUB_OUTPUT

csharp_latest="${{ github.event.inputs.dotnet_sdk_version }}"
csharp_latest="$INPUT_DOTNET_SDK_VERSION"
if [ -z "$csharp_latest" ]; then
csharp_latest=$(./temporal-features latest-sdk-version --lang cs)
echo "Derived latest Dotnet SDK release version: $csharp_latest"
fi
echo "csharp_latest=$csharp_latest" >> $GITHUB_OUTPUT

ruby_latest="$INPUT_RUBY_SDK_VERSION"
if [ -z "$ruby_latest" ]; then
ruby_latest=$(./temporal-features latest-sdk-version --lang rb)
echo "Derived latest Ruby SDK release version: $ruby_latest"
fi
echo "ruby_latest=$ruby_latest" >> $GITHUB_OUTPUT

build-ts:
strategy:
fail-fast: true
Expand Down Expand Up @@ -187,6 +206,23 @@ jobs:
- run: dotnet build
- run: dotnet test

build-ruby:
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Print build information
run: 'echo head_ref: "$GITHUB_HEAD_REF", ref: "$GITHUB_REF", os: ${{ matrix.os }}'
- uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '4.0'
- run: gem install rubocop
- run: rubocop

feature-tests-ts:
permissions:
contents: read
Expand Down Expand Up @@ -259,6 +295,18 @@ jobs:
features-repo-ref: ${{ github.head_ref }}
features-repo-path: ${{ github.event.pull_request.head.repo.full_name }}

feature-tests-ruby:
permissions:
contents: read
actions: read
needs: build-go
uses: ./.github/workflows/ruby.yaml
with:
version: ${{ needs.build-go.outputs.ruby_latest }}
version-is-repo-ref: false
features-repo-ref: ${{ github.head_ref }}
features-repo-path: ${{ github.event.pull_request.head.repo.full_name }}

build-docker-images:
needs: build-go
uses: ./.github/workflows/all-docker-images.yaml
Expand All @@ -271,3 +319,4 @@ jobs:
php-ver: 'v${{ needs.build-go.outputs.php_latest }}'
py-ver: 'v${{ needs.build-go.outputs.python_latest }}'
cs-ver: 'v${{ needs.build-go.outputs.csharp_latest }}'
rb-ver: 'v${{ needs.build-go.outputs.ruby_latest }}'
124 changes: 124 additions & 0 deletions .github/workflows/ruby.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Ruby Features Testing
on:
workflow_call:
inputs:
version:
required: true
type: string
# When true, the default version will be used (actually it's the latest tag)
version-is-repo-ref:
required: true
type: boolean
features-repo-path:
type: string
default: 'temporalio/features'
features-repo-ref:
type: string
default: 'main'
# If set, download the docker image for server from the provided artifact name
docker-image-artifact-name:
type: string
required: false

permissions:
contents: read
actions: read

jobs:
test:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
defaults:
run:
working-directory: ./features
steps:
- name: Print git info
run: 'echo head_ref: "$GITHUB_HEAD_REF", ref: "$GITHUB_REF", Ruby sdk version: "$INPUT_VERSION"'
working-directory: '.'
env:
INPUT_VERSION: ${{ inputs.version }}

- name: Download docker artifacts
if: ${{ inputs.docker-image-artifact-name }}
uses: actions/download-artifact@v4
with:
name: ${{ inputs.docker-image-artifact-name }}
path: /tmp/server-docker

- name: Load server Docker Images
if: ${{ inputs.docker-image-artifact-name }}
run: |
docker load --input /tmp/server-docker/temporal-server.tar
docker load --input /tmp/server-docker/temporal-admin-tools.tar
working-directory: '.'

- name: Override IMAGE_TAG environment variable
if: ${{ inputs.docker-image-artifact-name }}
run: |
image_tag=latest
# image_tag won't exist on older builds (like 1.22.0), so default to latest
if [ -f /tmp/server-docker/image_tag ]; then
image_tag=$(cat /tmp/server-docker/image_tag)
fi
echo "IMAGE_TAG=${image_tag}" >> $GITHUB_ENV
working-directory: '.'

- name: Checkout SDK features repo
uses: actions/checkout@v4
with:
path: features
repository: ${{ inputs.features-repo-path }}
ref: ${{ inputs.features-repo-ref }}

- uses: actions/setup-go@v2
with:
go-version: '^1.22'
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '4.0'

- name: Start containerized server and dependencies
id: start-server
if: inputs.docker-image-artifact-name
run: |
docker compose \
-f ./dockerfiles/docker-compose.yml \
up -d cassandra elasticsearch temporal-admin-tools temporal-server temporal-create-namespace

- name: Show all container logs
if: always()
run: |
echo "=== All container logs ==="
docker compose \
-f ./dockerfiles/docker-compose.yml \
logs
working-directory: ./features

- name: Run SDK-features tests directly
if: inputs.docker-image-artifact-name == ''
env:
INPUT_VERSION: ${{ inputs.version-is-repo-ref && '' || inputs.version }}
run: go run . run --lang rb --version "$INPUT_VERSION"

# Running the tests in their own step keeps the logs readable
- name: Run containerized SDK-features tests
if: inputs.docker-image-artifact-name
run: |
docker compose \
-f ./dockerfiles/docker-compose.yml \
up --no-log-prefix --exit-code-from features-tests-rb features-tests-rb

- name: Show all container logs before teardown
if: always() && inputs.docker-image-artifact-name
run: |
echo "=== All container logs before teardown ==="
docker compose \
-f ./dockerfiles/docker-compose.yml \
logs
working-directory: ./features

- name: Tear down docker compose
if: inputs.docker-image-artifact-name && (success() || failure())
run: docker compose -f ./dockerfiles/docker-compose.yml down -v
58 changes: 58 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
inherit_mode:
merge:
- Exclude

AllCops:
NewCops: enable
TargetRubyVersion: 4.0
SuggestExtensions: false
Include:
- harness/ruby/**/*.rb
- harness/ruby/**/*.gemspec
- features/**/feature.rb
Exclude:
- vendor/**/*
- tmp/**/*

# Don't need super for activities/workflows
Lint/MissingSuper:
AllowedParentClasses:
- Temporalio::Activity::Definition
- Temporalio::Workflow::Definition

# Harness methods can be longer
Metrics/AbcSize:
Max: 100

# Harness blocks can be longer
Metrics/BlockLength:
Max: 50

# Harness classes can be longer
Metrics/ClassLength:
Max: 300

# Harness methods can be longer
Metrics/MethodLength:
Max: 100

Metrics/CyclomaticComplexity:
Max: 30

Metrics/PerceivedComplexity:
Max: 30

# Feature files are small and self-contained, no docs needed
Style/Documentation:
Enabled: false

Style/DocumentationMethod:
Enabled: false

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

# We want our require lists to be in order
Style/RequireOrder:
Enabled: true
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ Prerequisites:
- [.NET](https://dotnet.microsoft.com) 7+
- [PHP](https://www.php.net/) 8.1+
- [Composer](https://getcomposer.org/)
- [Ruby](https://www.ruby-lang.org/) 4.0+

Command:

temporal-features run --lang LANG [--version VERSION] [PATTERN...]

Note, `go run .` can be used in place of `go build` + `temporal-features` to save on the build step.

`LANG` can be `go`, `java`, `ts`, `php`, `py`, or `cs`. `VERSION` is per SDK and if left off, uses the latest version set for
`LANG` can be `go`, `java`, `ts`, `php`, `py`, `cs`, or `rb`. `VERSION` is per SDK and if left off, uses the latest version set for
the language in this repository.

`PATTERN` must match either the features relative directory _or_ the relative directory + `/feature.<ext>` via
Expand Down Expand Up @@ -153,6 +154,7 @@ func HelloUniverse() {
mind when writing features.

- A Python feature should be in `feature.py`.
- A Ruby feature should be in `feature.rb`.
- Add a README.md to each feature directory.
- README should have a title summarizing the feature (only first letter needs to be in title case), then a short
paragraph explaining the feature and its purpose, and then optionally another paragraph explaining details of the
Expand Down
2 changes: 2 additions & 0 deletions cmd/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ func (p *Preparer) Prepare(ctx context.Context) error {
_, err = p.BuildPythonProgram(ctx)
case "cs":
_, err = p.BuildDotNetProgram(ctx)
case "rb":
_, err = p.BuildRubyProgram(ctx)
default:
err = fmt.Errorf("unrecognized language")
}
Expand Down
Loading
Loading