Skip to content

Commit 255fb34

Browse files
committed
add operator ci
Signed-off-by: zhzhuang-zju <[email protected]>
1 parent eebb807 commit 255fb34

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

.github/workflows/operator.yaml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Operator
2+
on:
3+
# Run this workflow every time a new commit pushed to upstream/fork repository.
4+
# Run workflow on fork repository will help contributors find and resolve issues before sending a PR.
5+
push:
6+
# Exclude branches created by Dependabot to avoid triggering current workflow
7+
# for PRs initiated by Dependabot.
8+
branches-ignore:
9+
- 'dependabot/**'
10+
pull_request:
11+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.actor }}-${{ github.head_ref || github.run_id }}
14+
cancel-in-progress: true
15+
permissions:
16+
contents: read # for actions/checkout to fetch code
17+
jobs:
18+
test-on-kubernetes-matrix:
19+
name: Test on Kubernetes
20+
runs-on: ubuntu-22.04
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
# Here support the latest three minor releases of Kubernetes, this can be considered to be roughly
25+
# the same as the End of Life of the Kubernetes release: https://kubernetes.io/releases/
26+
# Please remember to update the CI Schedule Workflow when we add a new version.
27+
k8s: [ v1.29.0, v1.30.0, v1.31.0 ]
28+
steps:
29+
# Free up disk space on Ubuntu
30+
- name: Free Disk Space (Ubuntu)
31+
uses: jlumbroso/free-disk-space@main
32+
with:
33+
# this might remove tools that are actually needed, if set to "true" but frees about 6 GB
34+
tool-cache: false
35+
# all of these default to true, but feel free to set to "false" if necessary for your workflow
36+
android: true
37+
dotnet: true
38+
haskell: true
39+
large-packages: false
40+
docker-images: false
41+
swap-storage: false
42+
- name: checkout code
43+
uses: actions/checkout@v4
44+
with:
45+
# Number of commits to fetch. 0 indicates all history for all branches and tags.
46+
# We need to guess version via git tags.
47+
fetch-depth: 0
48+
- name: install Go
49+
uses: actions/setup-go@v5
50+
with:
51+
go-version-file: go.mod
52+
- name: setup operator test environment
53+
run: |
54+
export CLUSTER_VERSION=kindest/node:${{ matrix.k8s }}
55+
hack/local-up-karmada-by-operator.sh
56+
- name: run operator test
57+
run: |
58+
# run a single e2e
59+
export KUBECONFIG=${HOME}/.kube/karmada.config
60+
kubectl config use-context karmada-apiserver
61+
GO111MODULE=on go install github.com/onsi/ginkgo/v2/ginkgo
62+
ginkgo -v --race --trace -p --focus="[BasicPropagation] propagation testing deployment propagation testing" ./test/e2e/
63+
- name: export logs
64+
if: always()
65+
run: |
66+
export ARTIFACTS_PATH=${{ github.workspace }}/karmada-operator-test-logs/${{ matrix.k8s }}/
67+
mkdir -p $ARTIFACTS_PATH
68+
69+
mkdir -p $ARTIFACTS_PATH/karmada-host
70+
kind export logs --name=karmada-host $ARTIFACTS_PATH/karmada-host
71+
- name: upload logs
72+
if: always()
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: karmada_operator_test_logs_${{ matrix.k8s }}
76+
path: ${{ github.workspace }}/karmada-operator-test-logs/${{ matrix.k8s }}/
77+
- name: upload kind logs
78+
if: always()
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: karmada_kind_log_${{ matrix.k8s }}
82+
path: /tmp/karmada/

0 commit comments

Comments
 (0)