Skip to content

-

- #45

name: CLI
on:
# Run this workflow every time a new commit pushed to upstream/fork repository.
# Run workflow on fork repository will help contributors find and resolve issues before sending a PR.
push:
pull_request:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.actor }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # Required to check out the code
jobs:
test-on-kubernetes-matrix:
name: Test on Kubernetes
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
# Here support the latest three minor releases of Kubernetes, this can be considered to be roughly
# the same as the End of Life of the Kubernetes release: https://kubernetes.io/releases/
# Please remember to update the CI Schedule Workflow when we add a new version.
k8s: [ v1.31.0 ]
steps:
- name: checkout code
uses: actions/checkout@v4
with:
# Number of commits to fetch. 0 indicates all history for all branches and tags.
# We need to guess version via git tags.
fetch-depth: 0
- name: install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: run karmadactl init test
run: |
export CLUSTER_VERSION=kindest/node:${{ matrix.k8s }}
# init e2e environment
hack/cli-testing-environment.sh
- name: check metrics of metris-adapter
run: |
export KUBECONFIG=~/.kube/karmada-host.config
comp=karmada-metrics-adapter
i=1; (kubectl port-forward `kubectl get pods -n karmada-system | grep $comp | sed -n $i'p' | awk '{print $1}'` -n karmada-system 8080 &)
sleep 3
curl http://127.0.0.1:8080/metrics
- name: export logs
if: always()
run: |
export ARTIFACTS_PATH=${{ github.workspace }}/karmadactl-test-logs/${{ matrix.k8s }}/
mkdir -p $ARTIFACTS_PATH
mkdir -p $ARTIFACTS_PATH/karmada-host
kind export logs --name=karmada-host $ARTIFACTS_PATH/karmada-host
- name: upload logs
if: always()
uses: actions/upload-artifact@v4
with:
name: karmadactl_test_logs_${{ matrix.k8s }}
path: ${{ github.workspace }}/karmadactl-test-logs/${{ matrix.k8s }}/