helm-charts/.github/workflows/charts-test.yaml
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 923ef40a39
feat: Release common version 1.4.0 (#130)
* fix(common):: Fix Integer style image tags (fixes #128)
* feat(common): Reload pod on secret change (#129)
* feat(common): Update code-server to v4.11.0
* fix(common): quote command and args strings (#124)
* feat(common): Update gluetun to v3.33.0

---------

Signed-off-by: angelnu <git@angelnu.com>
Signed-off-by: Maurits van Mastrigt <maurits@funda.nl>
Co-authored-by: Angel Nunez Mencias <github@angelnu.com>
Co-authored-by: Maurits <75321636+maurits-funda@users.noreply.github.com>
2023-04-12 19:30:47 +02:00

135 lines
3.9 KiB
YAML

name: "Charts: Test"
on:
workflow_call:
inputs:
checkoutCommit:
required: true
type: string
chartsToTest:
description: >
A JSON encoded array of charts to lint
type: string
required: true
overrideDeps:
description: >
A JSON encoded array of dependencies to override before testing
type: string
required: false
default: "[]"
env:
HELM_VERSION: 3.11.2
jobs:
install-chart:
name: Install chart
runs-on: ubuntu-22.04
if: ${{ inputs.chartsToTest != '[]' && inputs.chartsToTest != '' }}
strategy:
matrix:
chart: ${{ fromJSON(inputs.chartsToTest) }}
k8s_version: ["v1.22.17", "v1.23.15", "v1.24.9", "v1.25.5"]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ inputs.checkoutCommit }}
- name: Install Kubernetes tools
uses: yokawasa/action-setup-kube-tools@v0.9.3
with:
setup-tools: |
helmv3
kubectl
helm: "${{ env.HELM_VERSION }}"
kubectl: "${{ matrix.k8s_version }}"
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.4.0
- name: Create k3d cluster
uses: nolar/setup-k3d-k3s@v1
with:
version: ${{ matrix.k8s_version }}
- name: Remove node taints
run: |
kubectl taint --all=true nodes node.cloudprovider.kubernetes.io/uninitialized- || true
- name: Override chart dependencies
uses: ./.github/actions/override-chart-deps
if: ${{ inputs.overrideDeps != '[]' }}
with:
chart: ${{ matrix.chart }}
overrides: ${{ inputs.overrideDeps }}
- name: Run chart-testing (install)
run: ct install --config .ci/ct/ct.yaml --charts "charts/${{ matrix.chart }}"
# Summarize matrix https://github.community/t/status-check-for-a-matrix-jobs/127354/7
install_success:
needs:
- install-chart
if: |
always()
name: Install successful
runs-on: ubuntu-22.04
steps:
- name: Check install matrix status
if: ${{ (inputs.chartsToTest != '[]' && inputs.chartsToTest != '') && needs.install-chart.result != 'success' }}
run: exit 1
unittest-chart:
name: Unit-test chart
runs-on: ubuntu-20.04
if: ${{ inputs.chartsToTest != '[]' && inputs.chartsToTest != '' }}
strategy:
matrix:
chart: ${{ fromJSON(inputs.chartsToTest) }}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ inputs.checkoutCommit }}
- name: Install Kubernetes tools
uses: yokawasa/action-setup-kube-tools@v0.9.3
with:
setup-tools: |
helmv3
helm: "${{ env.HELM_VERSION }}"
- name: Override chart dependencies
uses: ./.github/actions/override-chart-deps
if: ${{ inputs.overrideDeps != '[]' }}
with:
chart: ${{ matrix.chart }}
overrides: ${{ inputs.overrideDeps }}
- name: Run tests
run: |
helm plugin install https://github.com/vbehar/helm3-unittest --version v1.0.16
helm dep update "charts/${{ matrix.chart }}"
helm unittest -f "tests/**/*_test.yaml" "charts/${{ matrix.chart }}"
# Summarize matrix https://github.community/t/status-check-for-a-matrix-jobs/127354/7
unittest_success:
needs:
- unittest-chart
if: |
always()
name: Unittest successful
runs-on: ubuntu-22.04
steps:
- name: Check unittest matrix status
if: ${{ (inputs.chartsToTest != '[]' && inputs.chartsToTest != '') && needs.unittest-chart.result != 'success' }}
run: exit 1