Skip to content

Commit 1db9b63

Browse files
authored
Share setup sub-action in CI (#615)
* Share setup sub-action in CI Signed-off-by: Yuri Shkuro <github@ysh.us>
1 parent 4aab996 commit 1db9b63

File tree

2 files changed

+59
-29
lines changed

2 files changed

+59
-29
lines changed
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Prepare K8s for Helm tests
2+
runs:
3+
using: "composite"
4+
steps:
5+
- name: Set up Helm
6+
uses: azure/setup-helm@v4
7+
with:
8+
version: v3.14.4
9+
10+
# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
11+
# yamllint (https://github.com/adrienverge/yamllint) which require Python
12+
- name: Set up Python
13+
uses: actions/setup-python@v2
14+
with:
15+
python-version: 3.7
16+
17+
- name: Set up chart-testing
18+
uses: helm/chart-testing-action@v2.6.1
19+
with:
20+
version: v3.10.1
21+
22+
- name: Create kind cluster
23+
uses: helm/kind-action@v1.9.0
24+
25+
- name: Install kubectl
26+
uses: azure/setup-kubectl@v4.0.0
27+
with:
28+
version: 'v1.28.8'
29+
id: install
30+
31+
- name: Set up cert-manager
32+
shell: bash
33+
run: |
34+
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml --namespace ingress-nginx
35+
kubectl label node --all ingress-ready=true
36+
kubectl describe pod --selector=app.kubernetes.io/component=controller -n ingress-nginx
37+
kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=5m
38+
kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v1.6.1/cert-manager.yaml
39+
40+
- name: Set up cmctl
41+
shell: bash
42+
run: |
43+
curl -sSL -o cmctl.tar.gz https://github.com/cert-manager/cert-manager/releases/download/v1.6.1/cmctl-linux-amd64.tar.gz
44+
tar xzf cmctl.tar.gz
45+
sudo mv cmctl /usr/local/bin
46+
cmctl version
47+
48+
- name: Check if cert-manager is up
49+
shell: bash
50+
run: |
51+
cmctl check api --wait=5m

.github/workflows/lint-test.yaml

+8-29
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ name: Lint and Test Charts
33
on: pull_request
44

55
jobs:
6-
lint-test:
6+
lint:
77
runs-on: ubuntu-latest
88
steps:
9-
- name: Checkout
10-
uses: actions/checkout@v2
9+
- uses: actions/checkout@v2
1110
with:
1211
fetch-depth: 0
1312

@@ -39,34 +38,14 @@ jobs:
3938
- name: Run chart-testing (lint)
4039
run: ct lint --config ct.yaml
4140

42-
- name: Create kind cluster
43-
uses: helm/kind-action@v1.9.0
44-
if: steps.list-changed.outputs.changed == 'true'
45-
46-
- name: Install kubectl
47-
uses: azure/setup-kubectl@v4.0.0
41+
test-with-cassandra:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v2
4845
with:
49-
version: 'v1.28.8'
50-
id: install
51-
52-
- name: Set up cert-manager
53-
run: |
54-
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml --namespace ingress-nginx
55-
kubectl label node --all ingress-ready=true
56-
kubectl describe pod --selector=app.kubernetes.io/component=controller -n ingress-nginx
57-
kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=5m
58-
kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v1.6.1/cert-manager.yaml
59-
60-
- name: Set up cmctl
61-
run: |
62-
curl -sSL -o cmctl.tar.gz https://github.com/cert-manager/cert-manager/releases/download/v1.6.1/cmctl-linux-amd64.tar.gz
63-
tar xzf cmctl.tar.gz
64-
sudo mv cmctl /usr/local/bin
65-
cmctl version
46+
fetch-depth: 0
6647

67-
- name: Check if cert-manager is up
68-
run: |
69-
cmctl check api --wait=5m
48+
- uses: ./.github/actions/prepare-k8s
7049

7150
- name: Run chart-testing (install)
7251
run: ct install --config ct.yaml

0 commit comments

Comments
 (0)