forked from Mailu/helm-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (98 loc) · 3.74 KB
/
lint-and-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
---
name: Helm lint and test chart
# Controls when the workflow will run
on:
pull_request:
branches:
- master
paths:
- mailu/**
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write
jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.10.0
- name: Install dependencies
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
helm dependency build mailu
- uses: actions/setup-python@v4
with:
python-version: "3.9"
check-latest: true
# - name: Run helm lint
# run: helm lint --strict --values mailu/helm-lint-values.yaml mailu
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.3.1
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config ct.yaml --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Run chart-testing (lint)
run: ct lint --config ct.yaml --target-branch ${{ github.event.repository.default_branch }} --check-version-increment=false
- name: Create kind cluster
if: steps.list-changed.outputs.changed == 'true'
uses: helm/kind-action@v1.4.0
with:
config: kind-cluster.yaml
- name: Install Calico
if: steps.list-changed.outputs.changed == 'true'
run: |
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.24.5/manifests/calico.yaml
kubectl -n kube-system rollout status daemonset/calico-node --timeout=120s
kubectl -n kube-system rollout status deployment calico-kube-controllers --timeout=120s
- name: Fix CoreDNS upstream resolver
if: steps.list-changed.outputs.changed == 'true'
run: |
kubectl -n kube-system get configmaps coredns -o yaml | sed 's/forward . \/etc\/resolv.conf/forward . 8.8.8.8:53/g' | kubectl apply -f -
kubectl -n kube-system rollout restart deployment coredns
kubectl -n kube-system rollout status deployment coredns --timeout=120s
- name: Run chart-testing (install)
id: install
if: steps.list-changed.outputs.changed == 'true'
run: ct install --debug --config ct.yaml
update-readme-metadata:
runs-on: ubuntu-latest
permissions:
contents: write
needs: lint-and-test
steps:
- name: Install readme-generator-for-helm
run: npm install -g @bitnami/readme-generator-for-helm
- name: Checkout mailu/helm-charts
uses: actions/checkout@v3
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
path: charts
token: ${{ secrets.GITHUB_TOKEN }}
- name: Execute readme-generator-for-helm
run: |
echo "Updating README.md for mailu chart"
readme-generator --values "charts/mailu/values.yaml" --readme "charts/mailu/README.md" --schema "/tmp/schema.json"
- name: Push changes
run: |
# Push all the changes
cd charts
git config --global user.email "actions@github.com"
git config --global user.name "Github actions"
git add -A
if ! git diff-index --quiet HEAD; then
git commit -am "Update README.md with readme-generator-for-helm" --signoff
git push
fi