mirror of
https://github.com/kubevela/kubevela.git
synced 2026-05-23 01:33:29 +00:00
* Feat: Refactoring the API Server module for better layering Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: code style Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: code style Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: fix the lint errors Signed-off-by: barnettZQG <barnett.zqg@gmail.com>
143 lines
4.3 KiB
YAML
143 lines
4.3 KiB
YAML
name: APIServer Unit Test & E2E Test
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- release-*
|
|
- apiserver
|
|
tags:
|
|
- v*
|
|
workflow_dispatch: { }
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- release-*
|
|
- apiserver
|
|
|
|
env:
|
|
# Common versions
|
|
GO_VERSION: '1.17'
|
|
GOLANGCI_VERSION: 'v1.38'
|
|
KIND_VERSION: 'v0.7.0'
|
|
KIND_IMAGE_VERSION: '[\"v1.20.7\"]'
|
|
KIND_IMAGE_VERSIONS: '[\"v1.18.20\",\"v1.20.7\",\"v1.22.7\"]'
|
|
|
|
jobs:
|
|
|
|
detect-noop:
|
|
runs-on: ubuntu-20.04
|
|
outputs:
|
|
noop: ${{ steps.noop.outputs.should_skip }}
|
|
steps:
|
|
- name: Detect No-op Changes
|
|
id: noop
|
|
uses: fkirc/skip-duplicate-actions@v3.3.0
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
|
|
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
|
|
concurrent_skipping: false
|
|
|
|
set-k8s-matrix:
|
|
runs-on: ubuntu-20.04
|
|
outputs:
|
|
matrix: ${{ steps.set-k8s-matrix.outputs.matrix }}
|
|
steps:
|
|
- id: set-k8s-matrix
|
|
run: |
|
|
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
|
|
echo "pushing tag: ${{ github.ref_name }}"
|
|
echo "::set-output name=matrix::${{ env.KIND_IMAGE_VERSIONS }}"
|
|
else
|
|
echo "::set-output name=matrix::${{ env.KIND_IMAGE_VERSION }}"
|
|
fi
|
|
|
|
|
|
apiserver-unit-tests:
|
|
runs-on: aliyun
|
|
needs: [ detect-noop,set-k8s-matrix ]
|
|
if: needs.detect-noop.outputs.noop != 'true'
|
|
strategy:
|
|
matrix:
|
|
k8s-version: ${{ fromJson(needs.set-k8s-matrix.outputs.matrix) }}
|
|
|
|
steps:
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v1
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Get dependencies
|
|
run: |
|
|
go get -v -t -d ./...
|
|
|
|
- name: Setup Kind
|
|
uses: engineerd/setup-kind@v0.5.0
|
|
with:
|
|
version: ${{ env.KIND_VERSION }}
|
|
skipClusterCreation: true
|
|
|
|
- name: Setup Kind Cluster (Worker)
|
|
run: |
|
|
kind delete cluster --name worker
|
|
kind create cluster --image kindest/node:${{ matrix.k8s-version }} --name worker
|
|
kubectl version
|
|
kubectl cluster-info
|
|
kind get kubeconfig --name worker --internal > /tmp/worker.kubeconfig
|
|
kind get kubeconfig --name worker > /tmp/worker.client.kubeconfig
|
|
|
|
- name: Setup Kind Cluster (Hub)
|
|
run: |
|
|
kind delete cluster
|
|
kind create cluster --image kindest/node:${{ matrix.k8s-version }}
|
|
kubectl version
|
|
kubectl cluster-info
|
|
|
|
- name: Run api server unit test
|
|
run: make unit-test-apiserver
|
|
|
|
- name: Load Image to kind cluster
|
|
run: make kind-load
|
|
|
|
- name: Cleanup for e2e tests
|
|
run: |
|
|
make e2e-cleanup
|
|
make vela-cli
|
|
make e2e-setup-core
|
|
bin/vela addon enable fluxcd
|
|
timeout 600s bash -c -- 'while true; do kubectl get ns flux-system; if [ $? -eq 0 ] ; then break; else sleep 5; fi;done'
|
|
kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=vela-core,app.kubernetes.io/instance=kubevela -n vela-system --timeout=600s
|
|
kubectl wait --for=condition=Ready pod -l app=source-controller -n flux-system --timeout=600s
|
|
kubectl wait --for=condition=Ready pod -l app=helm-controller -n flux-system --timeout=600s
|
|
|
|
- name: Run api server e2e test
|
|
run: |
|
|
export ALIYUN_ACCESS_KEY_ID=${{ secrets.ALIYUN_ACCESS_KEY_ID }}
|
|
export ALIYUN_ACCESS_KEY_SECRET=${{ secrets.ALIYUN_ACCESS_KEY_SECRET }}
|
|
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
|
|
make e2e-apiserver-test
|
|
|
|
- name: Stop kubevela, get profile
|
|
run: make end-e2e-core
|
|
|
|
- name: Upload coverage report
|
|
uses: codecov/codecov-action@v1
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: ./coverage.txt,/tmp/e2e_apiserver_test.out
|
|
flags: apiserver-unittests
|
|
name: codecov-umbrella
|
|
|
|
- name: Clean e2e profile
|
|
run: rm /tmp/e2e-profile.out
|
|
|
|
- name: Cleanup image
|
|
if: ${{ always() }}
|
|
run: make image-cleanup |