add deploy action #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Helm Deploy and Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [ opened, synchronize, reopened ] | |
jobs: | |
helm: | |
name: Deploy and Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- name: Run Internal Test | |
run: mvn test && echo "Maven Run Internal Test succeeded" || { echo "Run Internal Test failed."; exit 1; } | |
- name: Install Helm | |
run: | | |
curl https://baltocdn.com/helm/signing.asc | sudo apt-key add - | |
sudo apt-get install apt-transport-https --yes | |
echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list | |
sudo apt-get update | |
sudo apt-get install helm | |
- name: Install Kubectl | |
run: | | |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
chmod +x ./kubectl | |
sudo mv ./kubectl /usr/local/bin/kubectl | |
- name: Set up Kind | |
run: | | |
curl -Lo kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64 | |
chmod +x kind | |
sudo mv kind /usr/local/bin/ | |
- name: Check if Kind cluster exists | |
id: check-cluster | |
run: | | |
cluster_name="kind" | |
if kind get clusters | grep -q $cluster_name; then | |
echo "Cluster $cluster_name already exists" | |
echo "::set-output name=cluster_exists::true" | |
else | |
echo "Cluster $cluster_name does not exist" | |
echo "::set-output name=cluster_exists::false" | |
fi | |
- name: Delete existing Kind cluster | |
if: steps.check-cluster.outputs.cluster_exists == 'true' | |
run: | | |
kind delete cluster --name kind | |
- name: Create Kind cluster | |
run: | | |
kind create cluster | |
- name: Set KubeConfig | |
run: | | |
mkdir -p $HOME/.kube | |
kind get kubeconfig > $HOME/.kube/config | |
- name: Deploy with Helm | |
run: | | |
helm repo add rill-flow https://rill-flow.github.io/rill-flow-helm-chart | |
helm upgrade --install rill-flow rill-flow/rill-flow -n=rill-flow --create-namespace | |
- name: Run API Test | |
run: mvn test -P flow_api_test && echo "Run API Test succeeded" || { echo "Run API Test failed."; exit 1; } | |