-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (59 loc) · 1.9 KB
/
unit-tests.yml
File metadata and controls
65 lines (59 loc) · 1.9 KB
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
name: Helm Unit testing
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- "**"
jobs:
find_charts:
name: Find Charts
runs-on: ubuntu-latest
outputs:
charts: ${{ steps.find_charts.outputs.charts }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Find charts
id: find_charts
run: |
sudo apt install jq --yes
echo "Finding all folders containing Chart.yaml files..."
cd charts
ls
find . -name Chart.yaml -exec dirname {} \; | sed 's|^\./||' | grep -vE '^(charts|docs|tests|common)' > charts.txt || true
if [ -s charts.txt ]; then
echo "Json list of charts found:"
charts=$(jq -R -s -c 'split("\n")[:-1]' charts.txt)
echo "Found charts: $charts"
else
echo "No charts found."
exit 1;
fi
echo "::set-output name=charts::$charts"
test:
name: Run Helm Unit Tests
needs: find_charts
runs-on: ubuntu-latest
container: ghcr.io/interledger/builders/chartvalidator:v0.5
strategy:
matrix:
chart: ${{ fromJson(needs.find_charts.outputs.charts) }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Run Helm Unit Tests
run: |
echo "Running unit tests for chart: ${{ matrix.chart }}"
cd charts
ls
helm plugin install https://github.com/helm-unittest/helm-unittest.git
helm unittest ${{ matrix.chart }}
- name: Run Kubeconform Validation
run: |
cd charts
pwd
ls
helm template ${{ matrix.chart }} | kubeconform -strict -summary -ignore-missing-schemas