feat: added tests

This commit is contained in:
Serhiy Mytrovtsiy 2022-06-04 00:19:49 +02:00
parent 676db7743f
commit fbe51cd0e1
2 changed files with 56 additions and 1 deletions

55
.github/workflows/tests.yaml vendored Normal file
View File

@ -0,0 +1,55 @@
name: tests
on: [push]
jobs:
default-cmd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
curl --silent --fail https://raw.githubusercontent.com/rancher/k3d/main/install.sh | bash
k3d cluster delete testing
k3d cluster create testing
KUBECONFIG=$(k3d kubeconfig get testing | base64 | sed ':a;N;$!ba;s/\n//g')
echo "KUBE_CONFIG=${KUBECONFIG}" >> $GITHUB_ENV
- uses: ./
get-pods:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
curl --silent --fail https://raw.githubusercontent.com/rancher/k3d/main/install.sh | bash
k3d cluster delete testing
k3d cluster create testing
KUBECONFIG=$(k3d kubeconfig get testing | base64 | sed ':a;N;$!ba;s/\n//g')
echo "KUBE_CONFIG=${KUBECONFIG}" >> $GITHUB_ENV
- uses: ./
with:
args: get pods
multiply:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
curl --silent --fail https://raw.githubusercontent.com/rancher/k3d/main/install.sh | bash
k3d cluster delete testing
k3d cluster create testing
KUBECONFIG=$(k3d kubeconfig get testing | base64 | sed ':a;N;$!ba;s/\n//g')
echo "KUBE_CONFIG=${KUBECONFIG}" >> $GITHUB_ENV
- uses: ./
- uses: ./
with:
args: get pods
kustomize:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
echo 'configMapGenerator:
- name: example
literals:
- FOO=Bar' > kustomization.yaml
- uses: ./
with:
args: kustomize

View File

@ -16,7 +16,7 @@ jobs:
- name: Check if new version exist - name: Check if new version exist
id: check id: check
run: | run: |
SDK_VERSION=$(curl --silent "https://api.github.com/repos/kubernetes/kubernetes/releases" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sort -V -r | head -n 1) SDK_VERSION=$(curl --silent "https://api.github.com/repos/kubernetes/kubernetes/releases" | jq '.[] | select(.prerelease==false) | .tag_name' | sort -V -r | head -n 1 | tr -d '"')
LATEST_VERSION=$(curl --silent "https://api.github.com/repos/actions-hub/kubectl/releases/latest" | tac | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') LATEST_VERSION=$(curl --silent "https://api.github.com/repos/actions-hub/kubectl/releases/latest" | tac | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
DOCKER_VERSION=$(cat $GITHUB_WORKSPACE/Dockerfile | grep "ARG KUBE_VERSION=" | sed -E 's/ARG KUBE_VERSION=//' | tr -d '"') DOCKER_VERSION=$(cat $GITHUB_WORKSPACE/Dockerfile | grep "ARG KUBE_VERSION=" | sed -E 's/ARG KUBE_VERSION=//' | tr -d '"')