Skip to content

Commit

Permalink
ci: upgrade validation workflow
Browse files Browse the repository at this point in the history
Signed-off-by: mikeee <[email protected]>
  • Loading branch information
mikeee committed Jun 20, 2024
1 parent 5dbfee5 commit 01e1668
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 23 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/validate-examples/details.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"daprd": "0.0.0-dev",
"dashboard": "0.0.0-dev",
"cli": "0.0.0-dev",
"daprBinarySubDir": "dist",
"dockerImageSubDir": "docker",
"daprImageName": "daprio/dapr:0.0.0-dev",
"daprImageFileName": "daprio-dapr-0.0.0-dev.tar.gz"
}
83 changes: 68 additions & 15 deletions .github/workflows/validate_examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ jobs:
run: |
cd cli
make
echo "artifactPath=$HOME/artifacts/$GITHUB_SHA" >> $GITHUB_ENV
echo "artifactPath=~/artifacts/$GITHUB_SHA/" >> $GITHUB_ENV
mkdir -p $HOME/artifacts/$GITHUB_SHA/
sudo cp dist/linux_amd64/release/dapr $artifactpath/dapr
cp dist/linux_amd64/release/dapr $HOME/artifacts/$GITHUB_SHA/dapr
CLI_VERSION=edge
echo "DAPR_CLI_VER=$CLI_VERSION" >> $GITHUB_ENV
Expand All @@ -111,16 +111,61 @@ jobs:
run: |
cd dapr_runtime
make
mkdir -p $HOME/artifacts/$GITHUB_SHA/
cp dist/linux_amd64/release/* $artifactPath
echo "artifactPath=~/artifacts/$GITHUB_SHA/" >> $GITHUB_ENV
RUNTIME_VERSION=edge
echo "DAPR_RUNTIME_VER=$RUNTIME_VERSION" >> $GITHUB_ENV
- name: Build Docker Image
if: env.DAPR_REF != ''
run: |
mkdir ~/dapr_docker
cd dapr_runtime
docker build --build-arg "PKG_FILES=*" -f ./docker/Dockerfile ./dist/linux_amd64/release -t daprio/dapr:edge-linux-amd64 --output type=tar,dest=$artifactPath/dapr_docker.tar
docker build --build-arg "PKG_FILES=*" -f ./docker/Dockerfile ./dist/linux_amd64/release -t daprio/dapr:0.0.0-dev
- name: Download Install Bundle CLI
if: env.DAPR_REF != '' && env.DAPR_CLI_REF == ''
run: |
mkdir -p cli/dist/linux_amd64/release
cd cli/dist/linux_amd64/release/
curl -L --remote-name https://github.com/dapr/cli/releases/download/v$DAPR_CLI_VER/dapr_linux_amd64.tar.gz
tar xvzf dapr_linux_amd64.tar.gz
ls -la
- name: Build Custom Install Bundle
if: env.DAPR_REF != '' && env.DAPR_CLI_REF != ''
run: |
: # Create daprbundle
mkdir ~/daprbundle
cp .github/workflows/validate-examples/details.json ~/daprbundle/
: # Add cli
cp ~/artifacts/$GITHUB_SHA/dapr ~/daprbundle/dapr
: # Zip daprd/dashboard/placement/scheduler/sentry /dist/ appending _linux_amd64 to tar.gz
mkdir ~/daprbundle/dist
cd dapr_runtime/dist/linux_amd64/release/
for file in $(ls -1)
do
echo "packing $file"
tar czvf ~/daprbundle/dist/${file}_linux_amd64.tar.gz ${file}
done
cd ~/daprbundle/dist/
curl -L --remote-name https://github.com/dapr/dashboard/releases/download/v0.14.0/dashboard_linux_amd64.tar.gz
: # Add docker image
mkdir ~/daprbundle/docker
docker save daprio/dapr:0.0.0-dev | gzip > ~/daprbundle/docker/daprio-dapr-0.0.0-dev.tar.gz
: # Bundle
cd ~/daprbundle
tar czvf $HOME/artifacts/$GITHUB_SHA/daprbundle.tar.gz .
- name: List artifacts
if: env.DAPR_REF != '' || env.DAPR_CLI_REF != ''
run: |
ls -la $HOME/artifacts/$GITHUB_SHA/
- name: Upload dapr-artifacts
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -190,24 +235,19 @@ jobs:
uses: actions/download-artifact@v4
with:
name: dapr-artifacts
path: $HOME/artifacts/$GITHUB_SHA/
path: ~/artifacts/${{ env.GITHUB_SHA }}

- name: Display downloaded artifacts
if: env.DAPR_CLI_VER == 'edge' || env.DAPR_RUNTIME_VER == 'edge'
run: |
ls ~/artifacts/$GITHUB_SHA
ls -la $HOME/artifacts/$GITHUB_SHA/
- name: Set up Go
id: setup-go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

- name: Import Dapr Image (edge)
if: env.DAPR_RUNTIME_VER == 'edge'
run: |
cat $HOME/artifacts/$GITHUB_SHA/dapr_docker.tar | docker import - daprio/dapr:edge
- name: Set up Dapr CLI
if: env.DAPR_CLI_VER != 'edge'
run: wget -q ${{ env.DAPR_INSTALL_URL }} -O - | /bin/bash -s ${{ env.DAPR_CLI_VER }}
Expand All @@ -216,17 +256,30 @@ jobs:
if: env.DAPR_CLI_VER == 'edge'
run: |
sudo cp $HOME/artifacts/$GITHUB_SHA/dapr /usr/local/bin/dapr
sudo chmod +x /usr/local/bin/dapr
- name: Initialize Dapr runtime ${{ env.DAPR_RUNTIME_VER }}
if: env.DAPR_RUNTIME_VER != 'edge'
run: |
dapr uninstall --all
dapr init --runtime-version ${{ env.DAPR_RUNTIME_VER }}
- name: Override daprd with referenced commit.
- name: Initialize Dapr runtime EDGE
if: env.DAPR_RUNTIME_VER == 'edge'
run: |
mkdir -p $HOME/.dapr/bin/
cp $HOME/artifacts/$GITHUB_SHA/daprd $HOME/.dapr/bin/daprd
: # Unpack Bundle
mkdir ~/daprbundle
tar xvzf $HOME/artifacts/$GITHUB_SHA/daprbundle.tar.gz -C ~/daprbundle
: # Run installer
dapr uninstall --all
dapr init --from-dir ~/daprbundle/
: # Initialize redis and zipkin
docker run --name "dapr_redis" --restart always -d -p 6379:6379 redislabs/rejson
docker run --name "dapr_zipkin" --restart always -d -p 9411:9411 openzipkin/zipkin
docker ps -a
- name: Set up Python ${{ env.PYTHON_VER }}
uses: actions/setup-python@v5
Expand Down
8 changes: 4 additions & 4 deletions examples/hello-world/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ expected_stdout_lines:
-->

```bash
dapr run --app-id order-app --dapr-grpc-port 3500 --log-level error -- ./order put --id 20
dapr run --app-id order-app --dapr-grpc-port 3500 --log-level error --resources-path ./config -- ./order put --id 20
```

<!-- END_STEP -->
Expand All @@ -105,7 +105,7 @@ expected_stdout_lines:
-->

```bash
dapr run --app-id order-app --dapr-grpc-port 3500 --log-level error ./order get
dapr run --app-id order-app --dapr-grpc-port 3500 --log-level error --resources-path ./config ./order get
```

<!-- END_STEP -->
Expand All @@ -116,7 +116,7 @@ dapr run --app-id order-app --dapr-grpc-port 3500 --log-level error ./order get
Alternatively, you can start a standalone Dapr runtime, and call the app from another shell:

```bash
dapr run --app-id order-app --dapr-grpc-port 3500 --log-level error
dapr run --app-id order-app --dapr-grpc-port 3500 --log-level error --resources-path ./config
```


Expand All @@ -140,7 +140,7 @@ You can run more than one app in Dapr runtime. In this example you will call `or
Another instance of the `order` app will read the state.

```sh
dapr run --app-id order-app --dapr-grpc-port 3500 --log-level error ./order seq
dapr run --app-id order-app --dapr-grpc-port 3500 --log-level error --resources-path ./config ./order seq
```

```sh
Expand Down
12 changes: 12 additions & 0 deletions examples/hello-world/config/redis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
spec:
type: state.redis
version: v1
metadata:
- name: redisHost
value: localhost:6379
- name: redisPassword
value: ""
8 changes: 4 additions & 4 deletions examples/socket/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ expected_stdout_lines:
-->

```bash
dapr run --app-id order-app --log-level error --unix-domain-socket /tmp -- ./order put --id 20
dapr run --app-id order-app --log-level error --resources-path ./config --unix-domain-socket /tmp -- ./order put --id 20
```

<!-- END_STEP -->
Expand All @@ -93,15 +93,15 @@ expected_stdout_lines:
-->

```bash
dapr run --app-id order-app --log-level error --unix-domain-socket /tmp ./order get
dapr run --app-id order-app --log-level error --resources-path ./config --unix-domain-socket /tmp ./order get
```

<!-- END_STEP -->

Alternatively, you can start a standalone Dapr runtime, and call the app from another shell:

```bash
dapr run --app-id order-app --log-level error --unix-domain-socket /tmp
dapr run --app-id order-app --log-level error --resources-path ./config --unix-domain-socket /tmp
```


Expand All @@ -124,7 +124,7 @@ You can run more than one app in Dapr runtime. In this example you will call `or
Another instance of the `order` app will read the state.

```sh
dapr run --app-id order-app --log-level error --unix-domain-socket /tmp ./order seq
dapr run --app-id order-app --log-level error --resources-path ./config --unix-domain-socket /tmp ./order seq
```

```sh
Expand Down
12 changes: 12 additions & 0 deletions examples/socket/config/redis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
spec:
type: state.redis
version: v1
metadata:
- name: redisHost
value: localhost:6379
- name: redisPassword
value: ""

0 comments on commit 01e1668

Please sign in to comment.