-
Notifications
You must be signed in to change notification settings - Fork 22
136 lines (116 loc) · 4.16 KB
/
pr.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Linting & Integration tests
on:
pull_request:
types:
- opened
- synchronize
- reopened
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3.5
with:
version: v3.12.1
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install pre-commit and helm-docs
run: |
pip install pre-commit==3.6.0
curl -fSsL -o - https://github.com/norwoodj/helm-docs/releases/download/v1.12.0/helm-docs_1.12.0_Linux_x86_64.tar.gz | tar -xz -C /usr/local/bin helm-docs
- name: Run pre-commit hooks
run: pre-commit run --all-files
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.3.1
- name: Install additional Helm repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=$(echo "$changed" | tr '\n' ',' | sed 's/,$/\n/')" >> $GITHUB_OUTPUT
fi
- name: Run chart-testing (lint)
run: |
ct lint \
--target-branch ${{ github.event.repository.default_branch }} \
--lint-conf chart-testing/lintconf.yaml \
--charts ${{ steps.list-changed.outputs.changed }}
if: steps.list-changed.outputs.changed
- name: Create kind cluster
uses: helm/kind-action@v1.7.0
with:
node_image: kindest/node:v1.28.0
config: chart-testing/kind-config.yaml
wait: 5m
if: steps.list-changed.outputs.changed
- name: Replace secrets in Helm charts
env:
# TODO: rename the secret to avoid confusion
SMF_CONFIG_MATRIX_ACCESS_TOKEN: ${{ secrets.SMF_BOT_MATRIX_ACCESS_TOKEN }}
STAKING_MINER_CONFIG_SEED: ${{ secrets.STAKING_MINER_CONFIG_SEED }}
run: |
shopt -s globstar
for f in $(find **/ci/*-values.yaml); do
sed -i "s/__GITHUB_SECRET_SMF_CONFIG_MATRIX_ACCESS_TOKEN/$SMF_CONFIG_MATRIX_ACCESS_TOKEN/g" $f
sed -i "s/__GITHUB_SECRET_STAKING_MINER_CONFIG_SEED/$STAKING_MINER_CONFIG_SEED/g" $f
done
if: steps.list-changed.outputs.changed
- name: Run chart-testing (install)
run: |
# Exclude charts/node as it is covered by proper tests. Exclude more charts if needed
CHARTS_WITHOUT_TESTS=$(printf "${{ steps.list-changed.outputs.changed }}" | sed -E 's|charts/node,?||g')
if [[ -n "$CHARTS_WITHOUT_TESTS" ]]; then
ct install \
--target-branch ${{ github.event.repository.default_branch }} \
--charts $CHARTS_WITHOUT_TESTS
fi
if: steps.list-changed.outputs.changed
- uses: actions/setup-go@v4
with:
go-version: '1.20'
cache-dependency-path: "charts/**/ginkgo/go.sum"
if: steps.list-changed.outputs.changed
- name: Run ginkgo tests
run: |
export KUBECONFIG=~/.kube/config
CHANGED_CHARTS=${{ steps.list-changed.outputs.changed }}
for chart in ${CHANGED_CHARTS//,/$IFS}; do
if [[ -f $chart/ci/Makefile ]]; then
pushd $chart/ci && make test
popd
fi
done
if: steps.list-changed.outputs.changed
validate-manifests:
runs-on: ubuntu-latest
container: docker.io/paritytech/kube-manifests-validation:k8s-1.28.5-gator-3.12.0-datree-1.9.19-261faca
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- run: |
git config --system --add safe.directory $GITHUB_WORKSPACE
git fetch origin "+${GITHUB_BASE_REF}:${GITHUB_BASE_REF}"
- name: Validate manifests
run: |
/app/validate-k8s-manifests.sh \
--datree-policy-config /app/datree-policies.yaml \
--git-ref-changed-paths $GITHUB_BASE_REF \
--skip-gatekeeper \
charts