Skip to content

Allow adding health check callback to Dapr App run in gRPC #1743

Allow adding health check callback to Dapr App run in gRPC

Allow adding health check callback to Dapr App run in gRPC #1743

name: validate-examples
on:
push:
branches:
- main
- feature/*
tags:
- v*
- workflow-v*
- grpc-v*
- fastapi-v*
- flask-v*
pull_request:
branches:
- main
- release-*
- feature/*
workflow_dispatch:
inputs:
daprdapr_commit:
description: 'Dapr/Dapr commit to build custom daprd from'
required: false
default: ''
daprcli_commit:
description: 'Dapr/CLI commit to build custom dapr CLI from'
required: false
default: ''
repository_dispatch:
types: [validate-examples]
merge_group:
jobs:
validate:
runs-on: ubuntu-latest
env:
GOVER: 1.21
GOOS: linux
GOARCH: amd64
GOPROXY: https://proxy.golang.org
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/master/install/install.sh
DAPR_CLI_REF: ${{ github.event.inputs.daprcli_commit }}
DAPR_REF: ${{ github.event.inputs.daprdapr_commit }}
CHECKOUT_REPO: ${{ github.repository }}
CHECKOUT_REF: ${{ github.ref }}
strategy:
fail-fast: false
matrix:
python_ver: [3.8, 3.9, "3.10", "3.11", "3.12"]
steps:
- name: Parse repository_dispatch payload
if: github.event_name == 'repository_dispatch'
run: |
if [ ${{ github.event.client_payload.command }} = "ok-to-test" ]; then
echo "CHECKOUT_REPO=${{ github.event.client_payload.pull_head_repo }}" >> $GITHUB_ENV
echo "CHECKOUT_REF=${{ github.event.client_payload.pull_head_ref }}" >> $GITHUB_ENV
echo "DAPR_REF=master" >> $GITHUB_ENV
fi
- name: Check out code onto GOPATH
uses: actions/checkout@v4
with:
repository: ${{ env.CHECKOUT_REPO }}
ref: ${{ env.CHECKOUT_REF }}
- uses: azure/setup-helm@v4
- name: Determine latest Dapr Runtime version
run: |
helm repo add dapr https://dapr.github.io/helm-charts/ && helm repo update && export RUNTIME_VERSION=$(helm search repo dapr/dapr --devel --versions | awk '/dapr\/dapr/ {print $3; exit}' )
echo "DAPR_RUNTIME_VER=$RUNTIME_VERSION" >> $GITHUB_ENV
echo "Found $RUNTIME_VERSION"
- name: Determine latest Dapr Cli version
run: |
export CLI_VERSION=$(curl "https://api.github.com/repos/dapr/cli/releases?per_page=1&page=1" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | jq '.[0].tag_name'| tr -d '",v')
echo "DAPR_CLI_VER=$CLI_VERSION" >> $GITHUB_ENV
echo "Found $CLI_VERSION"
- name: Set up Python ${{ matrix.python_ver }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_ver }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine tox
- name: Set up Dapr CLI
run: wget -q ${{ env.DAPR_INSTALL_URL }} -O - | /bin/bash -s ${{ env.DAPR_CLI_VER }}
- name: Set up Go ${{ env.GOVER }}
if: env.DAPR_REF != '' || env.DAPR_CLI_REF != ''
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOVER }}
- name: Checkout Dapr CLI repo to override dapr command.
uses: actions/checkout@v4
if: env.DAPR_CLI_REF != ''
with:
repository: dapr/cli
ref: ${{ env.DAPR_CLI_REF }}
path: cli
- name: Checkout Dapr repo to override daprd.
uses: actions/checkout@v4
if: env.DAPR_REF != ''
with:
repository: dapr/dapr
ref: ${{ env.DAPR_REF }}
path: dapr_runtime
- name: Build and override dapr cli with referenced commit.
if: env.DAPR_CLI_REF != ''
run: |
cd cli
make
sudo cp dist/linux_amd64/release/dapr /usr/local/bin/dapr
cd ..
- name: Initialize Dapr runtime ${{ env.DAPR_RUNTIME_VER }}
run: |
dapr uninstall --all
dapr init --runtime-version ${{ env.DAPR_RUNTIME_VER }}
- name: Build and override daprd with referenced commit.
if: env.DAPR_REF != ''
run: |
cd dapr_runtime
make
mkdir -p $HOME/.dapr/bin/
cp dist/linux_amd64/release/daprd $HOME/.dapr/bin/daprd
cd ..
- name: Override placement service.
if: env.DAPR_REF != ''
run: |
docker stop dapr_placement
cd dapr_runtime
./dist/linux_amd64/release/placement --healthz-port 9091 &
cd ..
- name: Check Examples
run: |
tox -e examples