-
Notifications
You must be signed in to change notification settings - Fork 525
189 lines (185 loc) · 6.95 KB
/
validate.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#
# Copyright 2021 The Dapr Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Validate Tutorials
on:
workflow_dispatch:
push:
branches:
- master
- feature/new_quickstarts
- release-*
tags:
- v*
pull_request:
branches:
- master
- feature/new_quickstarts
- release-*
jobs:
deploy:
name: Validate tutorials on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
env:
GOVER: 1.17
KUBERNETES_VERSION: v1.21.1
KIND_VERSION: v0.12.0
KIND_IMAGE_SHA: sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6
strategy:
matrix:
os: [ubuntu-latest]
fail-fast: false
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Load environment variables
uses: artursouza/export-env-action@v2
with:
envFile: './.github/env/global.env'
expand: 'true'
- name: Pinning Python to ${{ env.MACOS_PYTHON_VERSION }} on MacOS
if: matrix.os == 'macos-latest'
run: brew install python@${{ env.MACOS_PYTHON_VERSION }} && brew unlink python@${{ env.MACOS_PYTHON_VERSION }} && brew link --overwrite python@${{ env.MACOS_PYTHON_VERSION }}
- name: Verify Python version
run: python3 --version
- name: Upgrade pip and setuptools
if: matrix.os == 'macos-latest'
run: pip3 install --upgrade pip && python3 -m pip install --upgrade setuptools
- name: Show .Net version
run: dotnet --version
- name: Install Docker - MacOS
if: matrix.os == 'macos-latest'
uses: docker-practice/actions-setup-docker@v1
with:
docker_buildx: false
docker_version: 20.10
- name: Install Helm - MacOS
if: matrix.os == 'macos-latest'
run: brew install helm
- name: Configure KinD
if: matrix.os == 'ubuntu-latest'
# Generate a KinD configuration file that uses:
# A couple of worker nodes: this is needed to run both
# ZooKeeper + Kakfa
working-directory: ./
run: |
cat > kind.yaml <<EOF
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
image: kindest/node:${{ env.KUBERNETES_VERSION }}@${{ env.KIND_IMAGE_SHA }}
- role: worker
image: kindest/node:${{ env.KUBERNETES_VERSION }}@${{ env.KIND_IMAGE_SHA }}
- role: worker
image: kindest/node:${{ env.KUBERNETES_VERSION }}@${{ env.KIND_IMAGE_SHA }}
- role: worker
image: kindest/node:${{ env.KUBERNETES_VERSION }}@${{ env.KIND_IMAGE_SHA }}
- role: worker
image: kindest/node:${{ env.KUBERNETES_VERSION }}@${{ env.KIND_IMAGE_SHA }}
EOF
# Log the generated kind.yaml for easy reference.
cat kind.yaml
- name: Create KinD Cluster - Linux
if: matrix.os == 'ubuntu-latest'
uses: helm/[email protected]
with:
config: kind.yaml
cluster_name: kind
version: ${{ env.KIND_VERSION }}
- name: Install minikube - MacOS
if: matrix.os == 'macos-latest'
run: |
brew install kubernetes-cli || brew link --overwrite kubernetes-cli
brew install minikube
minikube start --driver=virtualbox --memory 8192 --host-only-cidr "192.168.59.1/24"
- name: Get KinD info
if: matrix.os == 'ubuntu-latest'
run: |
kubectl cluster-info --context kind-kind
NODE_IP=$(kubectl get nodes \
-lkubernetes.io/hostname!=kind-control-plane \
-ojsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}')
echo "SERVICE_IP=$NODE_IP" >> $GITHUB_ENV
- name: Set up Go ${{ env.GOVER }}
uses: actions/setup-go@v2
with:
go-version: ${{ env.GOVER }}
- name: Set up Dapr CLI - Mac/Linux
if: matrix.os != 'windows-latest'
run: wget -q ${{ env.DAPR_INSTALL_URL }}/install.sh -O - | /bin/bash -s ${{ env.DAPR_CLI_VERSION }}
- name: Set up Dapr CLI - Windows
if: matrix.os == 'windows-latest'
run: powershell -Command "\$$script=iwr -useb ${{ env.DAPR_INSTALL_URL }}/install.ps1; \$$block=[ScriptBlock]::Create(\$$script); invoke-command -ScriptBlock \$$block -ArgumentList ${{ env.DAPR_CLI_VERSION }}"
- name: Install Dapr
run: |
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
dapr init --runtime-version=${{ env.DAPR_RUNTIME_VERSION }}
dapr --version
- name: Install Dapr - Kubernetes
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
helm install redis bitnami/redis
dapr init -k --runtime-version=${{ env.DAPR_RUNTIME_VERSION }} --wait || kubectl get pods --all-namespaces
kubectl get nodes -o wide
for pod in `dapr status -k | awk '/dapr/ {print $1}'`; do kubectl describe pod -l app=$pod -n dapr-system ; kubectl logs -l app=$pod -n dapr-system; done
- name: Install utilities dependencies
run: |
echo "PATH=$PATH:$HOME/.local/bin" >> $GITHUB_ENV
pip3 install setuptools wheel
pip3 install mechanical-markdown
- name: Validate hello-world
run: |
pushd tutorials/hello-world
make validate
popd
- name: Validate hello-kubernetes
if: matrix.os == 'ubuntu-latest'
run: |
pushd tutorials/hello-kubernetes
make validate
popd
- name: Validate distributed-calculator
if: matrix.os == 'ubuntu-latest'
run: |
pushd tutorials/distributed-calculator
make validate
popd
- name: Validate pub-sub
if: matrix.os == 'ubuntu-latest'
run: |
pushd tutorials/pub-sub
make validate
popd
- name: Validate bindings
if: matrix.os == 'ubuntu-latest'
run: |
pushd tutorials/bindings
make validate
popd
- name: Validate secretstore
if: matrix.os == 'ubuntu-latest'
run: |
pushd tutorials/secretstore
make validate
popd
- name: Validate observability
if: matrix.os == 'ubuntu-latest'
run: |
pushd tutorials/observability
make validate
popd
- name: Linkcheck README.md
run: |
make validate