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
32 changes: 32 additions & 0 deletions .github/actions/install-protoc/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Install protoc"
description: "Installs protoc for the given os"
inputs:
protoc-version:
description: "protoc version"
required: false
default: "21.12"
runs:
using: "composite"
steps:
- name: Install protoc for ${{ runner.os }}
env:
LINK: https://github.com/protocolbuffers/protobuf/releases/download
PROTOC_VERSION: ${{ inputs.protoc-version }}
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
PROTOC_ZIP=protoc-$PROTOC_VERSION-linux-x86_64.zip
elif [ "$RUNNER_OS" == "macOS" ]; then
PROTOC_ZIP=protoc-$PROTOC_VERSION-osx-x86_64.zip
else
echo "$RUNNER_OS not supported"
exit 1
fi
curl -OL $LINK/v$PROTOC_VERSION/$PROTOC_ZIP
unzip -o $PROTOC_ZIP -d $HOME/.local bin/protoc
unzip -o $PROTOC_ZIP -d $HOME/.local 'include/*'
rm -f $PROTOC_ZIP
echo "$HOME/.local" >> $GITHUB_PATH
chmod +x $HOME/.local/bin/protoc
echo "PROTOC=$HOME/.local/bin/protoc" >> $GITHUB_ENV
echo "PROTOC_INCLUDE=$HOME/.local/include" >> $GITHUB_ENV
shell: bash
11 changes: 11 additions & 0 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: "CLA Assistant"
on:
issue_comment:
types: [created]
pull_request_target:
types: [opened, closed, synchronize]

jobs:
CLAAssistant:
uses: restatedev/restate/.github/workflows/cla.yml@main
secrets: inherit
205 changes: 205 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
name: Pre-release updates

on:
workflow_dispatch:
inputs:
restateVersion:
description: "Restate version (without prepending v). The Restate repository must have the tag already!"
required: false
type: string
sdkTypescriptVersion:
description: "sdk-typescript version (without prepending v)."
required: false
type: string
sdkPythonVersion:
description: "sdk-python version (without prepending v)."
required: false
type: string
sdkJavaVersion:
description: "sdk-java version (without prepending v)."
required: false
type: string
sdkGoVersion:
description: "sdk-go version (WITH the prepending v)."
required: false
type: string
sdkRustVersion:
description: 'sdk-rust version (without prepending v). Leave empty if you do not want to update it.'
required: false
type: string

jobs:
updates:
runs-on: ubuntu-latest
timeout-minutes: 45

steps:
- name: Checkout documentation
uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Checkout Restate
uses: actions/checkout@v3
if: ${{ inputs.restateVersion != '' }}
with:
repository: restatedev/restate
ref: v${{ inputs.restateVersion }}
path: temp-restate

# We need rust, protoc and just to compile the runtime to generate the docs
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install protoc
uses: ./.github/actions/install-protoc
- name: Setup just
uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run the runtime generate script
if: ${{ inputs.restateVersion != '' }}
run: |
./tools/generate.sh temp-restate

- name: Parse Restate version
id: semver_parser
uses: booxmedialtd/ws-action-parse-semver@v1
if: ${{ inputs.restateVersion != '' }}
with:
input_string: ${{ inputs.restateVersion }}

# Update the doc config file
- name: Update custom-variables.mdx with new Restate version
if: ${{ inputs.restateVersion != '' }}
run: sed -i 's/RESTATE_VERSION = [0-9A-Za-z.-]*/RESTATE_VERSION = '"${{ format('{0}.{1}', steps.semver_parser.outputs.major, steps.semver_parser.outputs.minor) }}"'/' "docs/snippets/custom-variables.mdx"
- name: Update custom-variables.mdx with new TS sdk version
if: ${{ inputs.sdkTypescriptVersion != '' }}
run: sed -i 's/TYPESCRIPT_SDK_VERSION = [0-9A-Za-z.-]*/TYPESCRIPT_SDK_VERSION = '"${{ inputs.sdkTypescriptVersion }}"'/' "docs/snippets/custom-variables.mdx"
- name: Update custom-variables.mdx with new Python sdk version
if: ${{ inputs.sdkPythonVersion != '' }}
run: sed -i 's/PYTHON_SDK_VERSION = [0-9A-Za-z.-]*/PYTHON_SDK_VERSION = '"${{ inputs.sdkPythonVersion }}"'/' "docs/snippets/custom-variables.mdx"
- name: Update custom-variables.mdx with new Java sdk version
if: ${{ inputs.sdkJavaVersion != '' }}
run: sed -i 's/JAVA_SDK_VERSION = [0-9A-Za-z.-]*/JAVA_SDK_VERSION = '"${{ inputs.sdkJavaVersion }}"'/' "docs/snippets/custom-variables.mdx"
- name: Update custom-variables.mdx with new Go sdk version
if: ${{ inputs.sdkGoVersion != '' }}
run: sed -i 's/GO_SDK_VERSION = [0-9A-Za-z.-]*/GO_SDK_VERSION = '"${{ inputs.sdkGoVersion }}"'/' "docs/snippets/custom-variables.mdx"
- name: Update custom-variables.mdx with new Rust sdk version
if: ${{ inputs.sdkRustVersion != '' }}
run: sed -i 's/RUST_SDK_VERSION = [0-9A-Za-z.-]*/RUST_SDK_VERSION = '"${{ inputs.sdkRustVersion }}"'/' "docs/snippets/custom-variables.mdx"

# Upgrade TS code snippets if new version is provided
- name: Upgrade TS Restate SDK
if: github.event.inputs.sdkTypescriptVersion != ''
run: npm --prefix snippets/ts install @restatedev/restate-sdk@^${{ inputs.sdkTypescriptVersion }}
- name: Upgrade TS Restate SDK Clients
if: github.event.inputs.sdkTypescriptVersion != ''
run: npm --prefix snippets/ts install @restatedev/restate-sdk-clients@^${{ inputs.sdkTypescriptVersion }}
- name: Upgrade TS Restate SDK ZOD
if: github.event.inputs.sdkTypescriptVersion != ''
run: npm --prefix snippets/ts install @restatedev/restate-sdk-zod@^${{ inputs.sdkTypescriptVersion }}
- name: Upgrade TS Restate SDK Testcontainers
if: github.event.inputs.sdkTypescriptVersion != ''
run: npm --prefix snippets/ts install @restatedev/restate-sdk-testcontainers@^${{ inputs.sdkTypescriptVersion }}

# Test if TS code snippets compile and build
- name: Compile TypeScript code snippets
run: npm install --prefix snippets/ts && npm run build --prefix snippets/ts

# Upgrade Python code snippets if new version is provided

# Test if Python code snippets compile
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Bump Python SDK version
if: github.event.inputs.sdkPythonVersion != ''
run: |
cd snippets/python
uv add "restate-sdk[serde]>=${{ inputs.sdkPythonVersion }}"
- name: Test Python
run: |
cd snippets/python
uv sync --locked --all-extras --dev
uv add --dev mypy
uv run mypy .

# Bump Java SDK
- name: Install dasel
if: github.event.inputs.sdkJavaVersion != ''
run: curl -sSLf "$(curl -sSLf https://api.github.com/repos/tomwright/dasel/releases/latest | grep browser_download_url | grep linux_amd64 | grep -v .gz | cut -d\" -f 4)" -L -o dasel && chmod +x dasel && mv ./dasel /usr/local/bin/dasel
# This automatically bumps kotlin as well
- name: Bump Java SDK version in code snippets
if: github.event.inputs.sdkJavaVersion != ''
run: dasel -f snippets/java/gradle/libs.versions.toml put -t string -v "${{ inputs.sdkJavaVersion }}" ".versions.restate"
- uses: actions/setup-java@v4
if: ${{ inputs.sdkJavaVersion != '' }}
with:
distribution: "temurin"
java-version: "21"
- name: Setup Gradle
if: ${{ inputs.sdkJavaVersion != '' }}
uses: gradle/actions/setup-gradle@v3
- name: Test Java code snippets
if: ${{ inputs.sdkJavaVersion != '' }}
run: gradle -p snippets/java check
- name: Test Kotlin code snippets
if: ${{ inputs.sdkJavaVersion != '' }}
run: gradle -p snippets/kotlin check

# Upgrade Go code snippets if new version is provided
- uses: actions/setup-go@v5
if: ${{ inputs.sdkGoVersion != '' }}
with:
go-version: "1.21"
- name: Bump sdk-go
if: github.event.inputs.sdkGoVersion != ''
working-directory: snippets/go
run: |
go get github.com/restatedev/sdk-go@${{ github.event.inputs.sdkGoVersion }}
go mod tidy
- name: Test Go code snippets
working-directory: snippets/go
run: go test ./...

# Bump Rust SDK
- name: Install Rust toolchain
if: inputs.sdkRustVersion != ''
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
rustflags: ""
- name: Bump sdk-rust
if: inputs.sdkRustVersion != ''
run: cargo update --manifest-path ./snippets/rust/Cargo.toml restate-sdk@${{ inputs.sdkRustVersion }}
- name: Run Rust tests
if: inputs.sdkRustVersion != ''
run: cargo clippy --manifest-path ./snippets/rust/Cargo.toml

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
title: "[GithubActions] Update documentation ${{ inputs.restateVersion != '' && format('Restate {0}, ', inputs.restateVersion) }}${{ inputs.sdkTypescriptVersion != '' && format('SDK-Typescript {0}, ', inputs.sdkTypescriptVersion) }}${{ inputs.sdkJavaVersion != '' && format('SDK-Java {0}, ', inputs.sdkJavaVersion) }}${{ inputs.sdkPythonVersion != '' && format('SDK-Python {0}, ', inputs.sdkPythonVersion) }}${{ inputs.sdkGoVersion != '' && format('SDK-Go {0}, ', inputs.sdkGoVersion) }}${{ inputs.sdkRustVersion != '' && format('SDK-Rust {0}, ', inputs.sdkRustVersion) }}"
commit-message: "Update documentation: ${{ inputs.restateVersion != '' && format('\n* Bump Restate to {0}', inputs.restateVersion) }}${{ inputs.sdkTypescriptVersion != '' && format('\n* Bump SDK-Typescript to {0} ', inputs.sdkTypescriptVersion) }}${{ inputs.sdkJavaVersion != '' && format('\n* Bump SDK-Java to {0} ', inputs.sdkJavaVersion) }}${{ inputs.sdkPythonVersion != '' && format('SDK-Python {0}, ', inputs.sdkPythonVersion) }}${{ inputs.sdkGoVersion != '' && format('SDK-Go {0}, ', inputs.sdkGoVersion) }}${{ inputs.sdkRustVersion != '' && format('SDK-Rust {0}, ', inputs.sdkRustVersion) }}"
add-paths: |
docs/snippets/custom-variables.mdx
docs/docs/schemas/*
docs/docs/references/*
snippets/ts/package.json
snippets/ts/package-lock.json
snippets/java/build.gradle.kts
snippets/python/pyproject.toml
snippets/go/go.mod
snippets/go/go.sum
snippets/rust/Cargo.lock
snippets/rust/Cargo.toml
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release on tag

on:
push:
tags:
- v**

jobs:
create-release:
name: Create release
runs-on: ubuntu-latest

steps:
- name: Checkout documentation
uses: actions/checkout@v3
with:
ref: "main"
# fetch complete history to be able to push to production branch
fetch-depth: 0

- name: Push main to production
run: |
git push origin main:production

- name: Create release
uses: softprops/action-gh-release@v1
with:
# create a draft release which needs manual approval
draft: true
114 changes: 114 additions & 0 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Test

on:
pull_request:
branches:
- main

jobs:
ts-build:
name: TS snippets build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20

- name: Compile TypeScript code snippets
run: npm install --prefix snippets/ts && npm run build --prefix snippets/ts

- name: Check if TypeScript code snippets build is successful
run: |
if [ -d "snippets/ts/dist" ]; then
echo "TypeScript compilation successful"
else
echo "TypeScript compilation failed"
exit 1
fi

python-build:
name: Python snippets build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Install dependencies and check Python code snippets
working-directory: snippets/python
run: |
uv sync --locked --all-extras --dev
uv add --dev mypy
uv run mypy .

java-build:
name: Java snippets build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Setup Java
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "21"

# Check Java code snippets
- name: Test Java code snippets
uses: gradle/gradle-build-action@v2
with:
arguments: check
build-root-directory: snippets/java

kotlin-build:
name: Kotlin snippets build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Setup Java
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "21"

# Check Kotlin code snippets
- name: Test Kotlin code snippets
uses: gradle/gradle-build-action@v2
with:
arguments: check
build-root-directory: snippets/kotlin

go-build:
name: Golang snippets build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

# Setup Go
- uses: actions/setup-go@v5
with:
go-version: "1.21"

# Check Go code snippets
- name: Test Go code snippets
working-directory: snippets/go
run: go test ./...

rust-build:
name: Rust snippets build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

# Setup Rust
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
rustflags: ""

# Run Rust tests
- name: Run Rust tests
run: cargo clippy --manifest-path ./snippets/rust/Cargo.toml
Loading
Loading