From fbe51cd0e19acbbef2673545500ff3d61565f3ba Mon Sep 17 00:00:00 2001 From: Serhiy Mytrovtsiy Date: Sat, 4 Jun 2022 00:19:49 +0200 Subject: [PATCH] feat: added tests --- .github/workflows/tests.yaml | 55 +++++++++++++++++++++++++++++++++ .github/workflows/upgrader.yaml | 2 +- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/tests.yaml diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..5459c78 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -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 \ No newline at end of file diff --git a/.github/workflows/upgrader.yaml b/.github/workflows/upgrader.yaml index 152ef1b..5a0dcbd 100644 --- a/.github/workflows/upgrader.yaml +++ b/.github/workflows/upgrader.yaml @@ -16,7 +16,7 @@ jobs: - name: Check if new version exist id: check 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/') DOCKER_VERSION=$(cat $GITHUB_WORKSPACE/Dockerfile | grep "ARG KUBE_VERSION=" | sed -E 's/ARG KUBE_VERSION=//' | tr -d '"')