-
Notifications
You must be signed in to change notification settings - Fork 2
67 lines (57 loc) · 2.1 KB
/
chart-testing.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
name: Lint and Test Charts
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get base_sha
run: |
set -x
# "Set base sha..."
if [[ -n "${{ inputs.base_sha }}" ]]; then
echo "base_sha=${{ inputs.base_sha }}" >> $GITHUB_OUTPUT
elif [[ -n "${{ github.event.pull_request.base.sha }}" ]] && [[ "${{ github.event.pull_request.base.sha }}" != "0000000000000000000000000000000000000000" ]]; then
echo "base_sha=${{ github.event.pull_request.base.sha }}" >> $GITHUB_OUTPUT
elif [[ -n "${{ github.event.before }}" ]] && [[ "${{ github.event.before }}" != "0000000000000000000000000000000000000000" ]]; then
echo "base_sha=${{ github.event.before }}" >> $GITHUB_OUTPUT
fi
id: base-sha
- name: 'asdf:install'
uses: asdf-vm/actions/[email protected]
- uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Set up chart-testing
uses: helm/[email protected]
- name: Run chart-testing (list-changed)
id: list-changed
run: |
set -euo pipefail
set -x
echo "changed=$(
ct list-changed --since "${BASE_SHA}" --target-branch main --chart-dirs charts \
| awk -v d="," '{gsub(/charts\//, ""); s=(NR==1?s:s d) "\"" $0 "\""}END{print "["s"]"}'
)" >> $GITHUB_OUTPUT
env:
BASE_SHA: ${{ steps.base-sha.outputs.base_sha }}
- name: Run chart-testing (lint)
if: github.ref != 'refs/heads/main'
run: ct lint --since "${BASE_SHA}" --target-branch main --chart-dirs charts
env:
BASE_SHA: ${{ steps.base-sha.outputs.base_sha }}
- name: Check charts documentation
uses: pre-commit/[email protected]
with:
extra_args: --show-diff-on-failure --all-files
outputs:
changed: ${{ steps.list-changed.outputs.changed }}