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
227 changes: 169 additions & 58 deletions .github/workflows/validate_tutorials.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,64 +185,175 @@ jobs:
# pushd tutorials/observability
# make validate
# popd
# Validation for workflows is intentionally commented out.
# Mechanical markdown is not able to invoke the workflow services.
# Once this feature has been added to Mechanical Markdown the
# workflow validations can be enabled.
#- name: Validate workflow/csharp/child-workflows
# if: matrix.os == 'ubuntu-latest'
# run: |
# pushd tutorials/workflow/csharp/child-workflows
# make validate
# popd
#- name: Validate workflow/csharp/combined-patterns
# if: matrix.os == 'ubuntu-latest'
# run: |
# pushd tutorials/workflow/csharp/combined-patterns
# make validate
# popd
#- name: Validate workflow/csharp/external-system-interaction
# if: matrix.os == 'ubuntu-latest'
# run: |
# pushd tutorials/workflow/csharp/external-system-interaction
# make validate
# popd
#- name: Validate workflow/csharp/fan-out-fan-in
# if: matrix.os == 'ubuntu-latest'
# run: |
# pushd tutorials/workflow/csharp/fan-out-fan-in
# make validate
# popd
#- name: Validate workflow/csharp/fundamentals
# if: matrix.os == 'ubuntu-latest'
# run: |
# pushd tutorials/workflow/csharp/fundamentals
# make validate
# popd
#- name: Validate workflow/csharp/monitor-pattern
# if: matrix.os == 'ubuntu-latest'
# run: |
# pushd tutorials/workflow/csharp/monitor-pattern
# make validate
# popd
#- name: Validate workflow/csharp/resiliency-and-compensation
# if: matrix.os == 'ubuntu-latest'
# run: |
# pushd tutorials/workflow/csharp/resiliency-and-compensation
# make validate
# popd
#- name: Validate workflow/csharp/task-chaining
# if: matrix.os == 'ubuntu-latest'
# run: |
# pushd tutorials/workflow/csharp/task-chaining
# make validate
# popd
#- name: Validate workflow/csharp/workflow-management
# if: matrix.os == 'ubuntu-latest'
# run: |
# pushd tutorials/workflow/csharp/workflow-management
# make validate
# popd
#- name: Linkcheck README.md
# run: |
# make validate

# Validation of the workflow tutorials. Mechanical Markdown cannot drive their long-running
# services, so tutorials/workflow/validate.sh starts each tutorial, sends the requests of its
# .http file and checks every workflow instance through the Dapr workflow API.
# The challenges-tips tutorials are excluded: they hold code snippets only and have nothing to run.
workflow-tutorials:
name: Workflow tutorial ${{ matrix.lang }}/${{ matrix.topic }}
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- { lang: python, topic: child-workflows }
- { lang: python, topic: external-system-interaction }
- { lang: python, topic: fan-out-fan-in }
- { lang: python, topic: fundamentals }
- { lang: python, topic: history-propagation }
- { lang: python, topic: monitor-pattern }
- { lang: python, topic: resiliency-and-compensation }
- { lang: python, topic: task-chaining }
- { lang: python, topic: versioning }
- { lang: python, topic: workflow-management }
- { lang: csharp, topic: child-workflows }
- { lang: csharp, topic: external-system-interaction }
- { lang: csharp, topic: fan-out-fan-in }
- { lang: csharp, topic: fundamentals }
- { lang: csharp, topic: history-propagation }
- { lang: csharp, topic: monitor-pattern }
- { lang: csharp, topic: resiliency-and-compensation }
- { lang: csharp, topic: task-chaining }
- { lang: csharp, topic: versioning }
- { lang: csharp, topic: workflow-management }
- { lang: go, topic: history-propagation }
- { lang: java, topic: child-workflows }
- { lang: java, topic: external-system-interactions }
- { lang: java, topic: fan-out-fan-in }
- { lang: java, topic: fundamentals }
- { lang: java, topic: history-propagation }
- { lang: java, topic: monitor-pattern }
- { lang: java, topic: resiliency-and-compensation }
- { lang: java, topic: task-chaining }
- { lang: java, topic: versioning }
- { lang: java, topic: workflow-management }
- { lang: java, topic: combined-patterns }
steps:
- name: Check out code
uses: actions/checkout@v7
- name: Load environment variables
uses: artursouza/export-env-action@v2
with:
envFile: './.github/env/global.env'
expand: 'true'
- name: Install uv
if: matrix.lang == 'python'
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install .NET
if: matrix.lang == 'csharp'
uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.0.x
- name: Set up Go ${{ env.GOVER }}
if: matrix.lang == 'go'
uses: actions/setup-go@v7
with:
go-version: ${{ env.GOVER }}
cache: false
- name: Set up OpenJDK 17
if: matrix.lang == 'java'
uses: actions/setup-java@v6
with:
distribution: 'temurin'
java-version: 17
- name: Set up Dapr CLI
run: wget -q ${{ env.DAPR_INSTALL_URL }}/install.sh -O - | /bin/bash -s ${{ env.DAPR_CLI_VERSION }}
- name: Install the Dapr binaries
# Java tutorials start Dapr with Testcontainers and need no local Dapr runtime.
if: matrix.lang != 'java'
run: |
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
dapr init --slim --runtime-version=${{ env.DAPR_RUNTIME_VERSION }}
dapr --version
- name: Start the Scheduler and Placement services
# The commands of "Run the tutorials without Docker" in the language README.
if: matrix.lang != 'java'
run: |
mkdir -p "$RUNNER_TEMP/scheduler-data"
nohup "$HOME/.dapr/bin/scheduler" --etcd-data-dir "$RUNNER_TEMP/scheduler-data" > "$RUNNER_TEMP/scheduler.log" 2>&1 &
nohup "$HOME/.dapr/bin/placement" --healthz-port 8081 --metrics-port 9091 > "$RUNNER_TEMP/placement.log" 2>&1 &
for port in 8080 8081; do
curl --silent --fail --retry 30 --retry-connrefused --retry-delay 1 "http://localhost:$port/healthz" > /dev/null
done
- name: Validate workflow/${{ matrix.lang }}/${{ matrix.topic }}
run: bash tutorials/workflow/validate.sh ${{ matrix.lang }} ${{ matrix.topic }}

# combined-patterns uses Redis for pub/sub, so these topics run with a Redis service container.
workflow-tutorials-redis:
name: Workflow tutorial ${{ matrix.lang }}/${{ matrix.topic }} (Redis)
runs-on: ubuntu-latest
timeout-minutes: 60
services:
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 10
strategy:
fail-fast: false
matrix:
include:
- { lang: python, topic: combined-patterns }
- { lang: csharp, topic: combined-patterns }
steps:
- name: Check out code
uses: actions/checkout@v7
- name: Load environment variables
uses: artursouza/export-env-action@v2
with:
envFile: './.github/env/global.env'
expand: 'true'
- name: Install uv
if: matrix.lang == 'python'
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install .NET
if: matrix.lang == 'csharp'
uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.0.x
- name: Set up Go ${{ env.GOVER }}
if: matrix.lang == 'go'
uses: actions/setup-go@v7
with:
go-version: ${{ env.GOVER }}
cache: false
- name: Set up OpenJDK 17
if: matrix.lang == 'java'
uses: actions/setup-java@v6
with:
distribution: 'temurin'
java-version: 17
- name: Set up Dapr CLI
run: wget -q ${{ env.DAPR_INSTALL_URL }}/install.sh -O - | /bin/bash -s ${{ env.DAPR_CLI_VERSION }}
- name: Install the Dapr binaries
# Java tutorials start Dapr with Testcontainers and need no local Dapr runtime.
if: matrix.lang != 'java'
run: |
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
dapr init --slim --runtime-version=${{ env.DAPR_RUNTIME_VERSION }}
dapr --version
- name: Start the Scheduler and Placement services
# The commands of "Run the tutorials without Docker" in the language README.
if: matrix.lang != 'java'
run: |
mkdir -p "$RUNNER_TEMP/scheduler-data"
nohup "$HOME/.dapr/bin/scheduler" --etcd-data-dir "$RUNNER_TEMP/scheduler-data" > "$RUNNER_TEMP/scheduler.log" 2>&1 &
nohup "$HOME/.dapr/bin/placement" --healthz-port 8081 --metrics-port 9091 > "$RUNNER_TEMP/placement.log" 2>&1 &
for port in 8080 8081; do
curl --silent --fail --retry 30 --retry-connrefused --retry-delay 1 "http://localhost:$port/healthz" > /dev/null
done
- name: Validate workflow/${{ matrix.lang }}/${{ matrix.topic }}
run: bash tutorials/workflow/validate.sh ${{ matrix.lang }} ${{ matrix.topic }}
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ When adding code, hold to the patterns already present across the repo (browse a

Workflows in `.github/workflows/validate_<lang>_quickstarts.yaml` run on PRs to `master`/`release-*`. Each installs the pinned Dapr CLI/runtime from `.github/env/global.env`, the language toolchain, and `mechanical-markdown`, then loops the building-block quickstarts running `make validate`. To reproduce a CI failure locally, `cd` into the failing quickstart directory and run `make validate`. The repo-root `make validate` link-checks the top-level `README.md`.

`validate_tutorials.yaml` covers tutorials, but only `hello-world` and `hello-kubernetes` are actually enabled — the rest (including **all** of `tutorials/workflow/*`) are commented out because mechanical-markdown can't drive their long-running services. **Treat the workflow tutorials as untested by CI: validate them manually before relying on them.**
`validate_tutorials.yaml` covers tutorials. The `hello-world` and `hello-kubernetes` jobs run the README with mechanical-markdown. The workflow tutorials (`tutorials/workflow/*`) run in a matrix job through `tutorials/workflow/validate.sh <lang> <topic>`, because mechanical-markdown cannot drive their long-running services: the script starts the tutorial, sends the requests of its `.http` file and checks the status of each workflow instance. To reproduce a failure locally, run the same script from the repo root.

## Contributing constraints

Expand Down
2 changes: 1 addition & 1 deletion tutorials/workflow/csharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ By default, the tutorials use Redis in Docker as the workflow state store, and t

Use this option when Docker is not available or not allowed, for example on a locked-down laptop, in a CI job, or in a dev container without Docker. It also starts faster, because it has fewer moving parts.

The [Combined Patterns](./combined-patterns/README.md) tutorial also uses Redis for pub/sub, so it does not run this way. The [History Propagation](./history-propagation/README.md) and Versioning tutorials do not have a `dapr-sqlite.yaml` file. The commands are for Linux and macOS, and for Windows (PowerShell).
The [Combined Patterns](./combined-patterns/README.md) tutorial also uses Redis for pub/sub, so it does not run this way. The commands are for Linux and macOS, and for Windows (PowerShell).

1. Install the Dapr binaries. This command installs `daprd`, `placement`, and `scheduler` in `$HOME/.dapr/bin` (`$env:USERPROFILE\.dapr\bin` on Windows, with the `.exe` extension). It does not start them.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 1
common:
resourcesPath: ../../resources-sqlite
apps:
- appID: patient-intake
appDirPath: ./patient-intake/
command: ["dotnet", "run"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 1
common:
resourcesPath: ../../../resources-sqlite
apps:
- appID: workflow-versioning
appDirPath: ./
appPort: 5087
daprHTTPPort: 3500
daprGRPCPort: 50001
command: ["dotnet", "run"]
appLogDestination: console
daprdLogDestination: console
10 changes: 10 additions & 0 deletions tutorials/workflow/csharp/versioning/Versioning/versioning.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@apphost=http://localhost:5087

### Start the NotifyUserWorkflow workflow
# @name startWorkflowRequest
GET {{ apphost }}/start

### Get the workflow status
@instanceId={{startWorkflowRequest.response.body.*}}
@daprHost=http://localhost:3500
GET {{ daprHost }}/v1.0/workflows/dapr/{{ instanceId }}
Loading
Loading