-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efa39fb
commit 1f2c3eb
Showing
1 changed file
with
68 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,33 +3,48 @@ name: "helm-charts/test" | |
on: pull_request | ||
|
||
jobs: | ||
lint: | ||
generate-charts: | ||
runs-on: ubuntu-latest | ||
name: Generate Charts | ||
outputs: | ||
deprecated: ${{ steps.deprecated.outputs.charts }} | ||
maintained: ${{ steps.maintained.outputs.charts }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Fetch history | ||
run: git fetch --prune --unshallow | ||
- name: Install Chart Tester | ||
uses: helm/[email protected] | ||
- name: Add WyriHaximusNet repo | ||
run: helm repo add WyriHaximusNet https://helm.wyrihaximus.net/ | ||
- name: Lint charts | ||
id: lint | ||
run: ct lint --all | ||
with: | ||
sparse-checkout: | | ||
charts/ | ||
- name: Get values files | ||
uses: tj-actions/glob@v22 | ||
id: charts | ||
with: | ||
separator: "," | ||
files: | | ||
charts/${{ matrix.chart }}/**/Chart.yaml | ||
- name: Deprecated Charts | ||
id: deprecated | ||
run: | | ||
printf "charts=%s" $(echo "${{ steps.charts.outputs.paths }}" | docker run -i --rm -v $(pwd):$(pwd) -w $(pwd) ghcr.io/wyrihaximusnet/php:8.4-nts-alpine-root php -r 'echo str_replace(["charts", "Chart.yaml", "/", "\\"], "", json_encode(array_values(array_filter(explode(",", trim(fgets(STDIN))), static fn (string $path): bool => str_contains(file_get_contents($path), "deprecated: true") && !str_contains($path, "commons"))))) . "\n";') >> $GITHUB_OUTPUT | ||
- name: Maintained Charts | ||
id: maintained | ||
run: | | ||
printf "charts=%s" $(echo "${{ steps.charts.outputs.paths }}" | docker run -i --rm -v $(pwd):$(pwd) -w $(pwd) ghcr.io/wyrihaximusnet/php:8.4-nts-alpine-root php -r 'echo str_replace(["charts", "Chart.yaml", "/", "\\"], "", json_encode(array_values(array_filter(explode(",", trim(fgets(STDIN))), static fn (string $path): bool => !str_contains(file_get_contents($path), "deprecated: true") && !str_contains($path, "commons"))))) . "\n";') >> $GITHUB_OUTPUT | ||
- name: Show chart lists | ||
run: | | ||
echo "Deprecated:" | ||
echo ${{ steps.deprecated.outputs.charts }} | ||
echo "Maintained:" | ||
echo ${{ steps.maintained.outputs.charts }} | ||
validate-values-schema: | ||
runs-on: ubuntu-latest | ||
name: Validate values schema json | ||
needs: | ||
- generate-charts | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
chart: | ||
- cron-jobs | ||
- default-backend | ||
- docker-hub-exporter | ||
- pi-hole-exporter | ||
- redirect | ||
- redis-db-assignment-operator | ||
chart: ${{ fromJson(needs.generate-charts.outputs.maintained) }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
@@ -49,23 +64,42 @@ jobs: | |
input: ${{ steps.valueFiles.outputs.paths }} | ||
output: charts/${{ matrix.chart }}/values.schema.json | ||
fail-on-diff: true | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
needs: | ||
- validate-values-schema | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Fetch history | ||
run: git fetch --prune --unshallow | ||
- name: Install Chart Tester | ||
uses: helm/[email protected] | ||
- name: Add WyriHaximusNet repo | ||
run: helm repo add WyriHaximusNet https://helm.wyrihaximus.net/ | ||
- name: Lint charts | ||
id: lint | ||
run: ct lint --all | ||
test: | ||
name: Test on Kubernetes v${{ matrix.k8s }} | ||
runs-on: ubuntu-latest | ||
needs: | ||
- generate-charts | ||
- lint | ||
- validate-values-schema | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
k8s: | ||
- "1.23" | ||
- "1.24" | ||
- "1.25" | ||
- "1.26" | ||
- "1.27" | ||
- "1.28" | ||
- "1.29" | ||
- "1.30" | ||
# - "1.23" | ||
# - "1.24" | ||
# - "1.25" | ||
# - "1.26" | ||
# - "1.27" | ||
# - "1.28" | ||
# - "1.29" | ||
# - "1.30" | ||
- "1.31" | ||
steps: | ||
- name: Checkout | ||
|
@@ -107,17 +141,20 @@ jobs: | |
if [[ -n "$changed" ]]; then | ||
echo "changed=true" >> "$GITHUB_OUTPUT" | ||
fi | ||
- name: Prepare library charts | ||
- name: Prepare charts | ||
run: | | ||
echo -e " PIHOLE_HOSTNAME: \"${{ steps.pihole.outputs.hostname }}\"\r\n" >> charts/pi-hole-exporter/library-ci/secret.yaml | ||
cp charts/commons/library-ci/*.yaml charts/commons/templates/ | ||
cp charts/cron-jobs/library-ci/*.yaml charts/cron-jobs/templates/ | ||
cp charts/pi-hole-exporter/library-ci/*.yaml charts/pi-hole-exporter/templates/ | ||
sed -i 's/library/application/g' charts/commons/Chart.yaml | ||
sed -i 's/library/application/g' charts/cron-jobs/Chart.yaml | ||
rm -Rf charts/commento | ||
rm -Rf charts/commentoplusplus | ||
rm -Rf charts/horizontal-pod-autoscalers | ||
echo "${{ needs.generate-charts.outputs.deprecated }}" > charts.json | ||
jq -c '.[]' charts.json | while read chart; do | ||
echo "${chart}" | ||
# rm -Rf $(printf "charts/${chart}") | ||
# do stuff with $i | ||
done | ||
- run: kubectl get pods -A | ||
- run: kubectl get svc -A | ||
- name: Test Changed Charts | ||
|