[type: ci] fix CI(lint and test) (#8)
Signed-off-by: Bird <aflybird0@gmail.com>
Co-Committer: erdengk <37730787+erdengk@users.noreply.github.com>
diff --git a/.github/actions/chart-testing-action b/.github/actions/chart-testing-action
new file mode 160000
index 0000000..e38d23e
--- /dev/null
+++ b/.github/actions/chart-testing-action
@@ -0,0 +1 @@
+Subproject commit e38d23e463607d96fd08c2464363b1ce104446d3
diff --git a/.github/actions/kind-action b/.github/actions/kind-action
new file mode 160000
index 0000000..d08cf6f
--- /dev/null
+++ b/.github/actions/kind-action
@@ -0,0 +1 @@
+Subproject commit d08cf6ff1575077dee99962540d77ce91c62387d
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 0c928ff..fd58add 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -1,4 +1,4 @@
-name: CI
+name: Lint and Test Charts
on:
pull_request:
@@ -7,59 +7,38 @@
- main
jobs:
-
- helm:
- name: K8s chart test
+ lint-test:
runs-on: ubuntu-latest
- strategy:
- matrix:
- k8s: [v1.16.15]
-
steps:
-
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
+ # ct needs history to compare
+ fetch-depth: 0
- - name: Lint
- run: |
- docker run --rm --interactive --network host \
- --name ct-lint \
- --volume $PWD:/workdir \
- --workdir /workdir/charts/shenyu \
- quay.io/helmpack/chart-testing:v3.4.0 sh -c 'helm dependency update \
- && cd ../.. \
- && helm repo add shenyu https://apache.github.io/incubator-shenyu-helm-chart \
- && ct lint \
- --charts charts/shenyu '
-
- - name: fix permissions
- run: |
- sudo mkdir -p $HOME/.kube
- sudo chmod -R 777 $HOME/.kube
-
- - name: KinD (Kubernetes in Docker) Action
- uses: engineerd/setup-kind@v0.5.0
+ - name: Set up Helm
+ uses: azure/setup-helm@v3.0
with:
- version: v0.11.0
- config: test/kind.yaml
- image: kindest/node:${{ matrix.k8s }}
+ version: v3.8.2
+ - name: Set up chart-testing
+ uses: ./.github/actions/chart-testing-action
- - name: Test
- env:
- KIND_CLUSTER_NAME: kind
- SKIP_CLUSTER_CREATION: true
+ - name: Run chart-testing (lint)
+ run: ct lint --config ct.yaml
+
+ - name: Run chart-testing (list-changed)
+ id: list-changed
run: |
- kind get kubeconfig > $HOME/.kube/kind-config-kind
- docker run --rm --interactive --network host \
- --name ct \
- --volume $HOME/.kube/kind-config-kind:/root/.kube/config \
- --volume $PWD:/workdir \
- --workdir /workdir/charts/shenyu \
- quay.io/helmpack/chart-testing:v3.4.0 sh -c 'helm dependency update \
- && cd ../.. \
- && helm repo add shenyu https://apache.github.io/incubator-shenyu-helm-chart \
- && ct install \
- --charts charts/shenyu '
\ No newline at end of file
+ changed=$(ct list-changed --config ct.yaml)
+ if [[ -n "$changed" ]]; then
+ echo "::set-output name=changed::true"
+ fi
+
+ - name: Create kind cluster
+ uses: ./.github/actions/kind-action
+ if: steps.list-changed.outputs.changed == 'true'
+
+ - name: Run chart-testing (install)
+ run: ct install --config ct.yaml
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..98fb360
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,6 @@
+[submodule ".github/actions/chart-testing-action"]
+ path = .github/actions/chart-testing-action
+ url = https://github.com/helm/chart-testing-action.git
+[submodule ".github/actions/kind-action"]
+ path = .github/actions/kind-action
+ url = https://github.com/helm/kind-action.git
diff --git a/charts/shenyu/Chart.yaml b/charts/shenyu/Chart.yaml
index f31bb2d..4ca434a 100644
--- a/charts/shenyu/Chart.yaml
+++ b/charts/shenyu/Chart.yaml
@@ -1,8 +1,8 @@
apiVersion: v2
name: shenyu
-description: A Helm chart for Kubernetes
+description: Helm Chart for deploying Apache ShenYu in Kubernetes
type: application
-version: 2.4.2
+version: 2.4.3
appVersion: "1.16.0"
icon: https://shenyu.apache.org/img/logo.png
maintainers:
diff --git a/ct.yaml b/ct.yaml
index f5ece48..bb09cca 100644
--- a/ct.yaml
+++ b/ct.yaml
@@ -1,7 +1,5 @@
remote: origin
-target-branch: gh-pages
+target-branch: main
chart-dirs:
- charts
-chart-repos:
- - shenyu=https://apache.github.io/incubator-shenyu-helm-chart
-helm-extra-args: --timeout 600s
\ No newline at end of file
+helm-extra-args: --timeout 600s