From 2ed96ce97d4f01992090463bc7418a8c77cfabfa Mon Sep 17 00:00:00 2001 From: Qasim Sarfraz Date: Fri, 27 Oct 2023 14:42:01 +0200 Subject: [PATCH] docs: Add test-docs This change add support for testing documentation using exec-docs Signed-off-by: Qasim Sarfraz --- .github/workflows/kubectl-aks.yml | 28 ++++++++++++++++++++++++++++ .gitignore | 1 + Makefile | 6 ++++++ README.md | 7 +++++-- 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/.github/workflows/kubectl-aks.yml b/.github/workflows/kubectl-aks.yml index d7d3224..843a05b 100644 --- a/.github/workflows/kubectl-aks.yml +++ b/.github/workflows/kubectl-aks.yml @@ -258,6 +258,34 @@ jobs: export AZURE_NODE_NAME=$(echo '${{ needs.create-aks-cluster.outputs.nodes }}' | jq -r ".[${{ strategy.job-index }}]") make integration-test -o kubectl-aks + documentation-test: + name: Test docs + runs-on: ubuntu-latest + needs: [ build, unit-tests ] + steps: + - uses: actions/checkout@v3 + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version: '>=1.20.0' # ie requires go 1.20+ + check-latest: true + - name: Get kubectl-aks from artifact + uses: actions/download-artifact@v3 + with: + name: kubectl-aks-linux-amd64-tar-gz + - name: Prepare kubectl-aks binary + shell: bash + run: | + tar zxvf kubectl-aks-linux-amd64.tar.gz + chmod +x kubectl-aks + mv kubectl-aks /usr/local/bin + ls -la + - name: Download ie + run: | + go install github.com/Azure/InnovationEngine/cmd/ie@03880d11fadcf98e39c465248aa1d5b64f99cdb7 + - name: Run Documentation tests + run: make documentation-test + release: name: Release needs: [ integration-tests ] diff --git a/.gitignore b/.gitignore index 22ae6f6..7e510d7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ *.exe~ *.dll *.so +*.log *.dylib /kubectl-aks /kubectl-aks-*-* diff --git a/Makefile b/Makefile index a137ab5..ca02c8a 100644 --- a/Makefile +++ b/Makefile @@ -83,6 +83,12 @@ integration-test: kubectl-aks AZURE_CLUSTER_NAME=$(AZURE_CLUSTER_NAME) \ go test -v ./test/integration/... -integration +# Run documentation tests +.PHONY: documentation-test +documentation-test: install + ie --help > /dev/null || (echo "ie is not installed, please install it from https://github.com/Azure/InnovationEngine" && exit 1) + ie execute README.md + # Clean .PHONY: clean clean: diff --git a/README.md b/README.md index 4c25989..ed6fbd2 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ It is possible to download the asset for a given release and platform from the move the `kubectl-aks` executable to any folder in your `$PATH`. ```bash -VERSION=v0.2.0 +VERSION=$(curl -s https://api.github.com/repos/azure/kubectl-aks/releases/latest | jq -r .tag_name) curl -sL https://github.com/azure/kubectl-aks/releases/latest/download/kubectl-aks-linux-amd64-${VERSION}.tar.gz | sudo tar -C /usr/local/bin -xzf - kubectl-aks kubectl aks version ``` @@ -77,7 +77,10 @@ kubectl aks version ## Usage ```bash -$ kubectl aks --help +kubectl aks --help +```` + +``` Azure Kubernetes Service (AKS) kubectl plugin Usage: