Skip to content

Importing TPL lib for future imports #40

Importing TPL lib for future imports

Importing TPL lib for future imports #40

---
name: Install Unit Tests
on:
pull_request:
paths:
- .github/**
- charts/**
# Declare default permissions as read only.
permissions: read-all
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
install-test:
runs-on: ubuntu-latest
env:
# renovate: datasource=github-releases depName=helm/helm
HELM_VERSION: v3.15.2
# renovate: datasource=github-tags depName=python/cpython
PYTHON_VERSION: v3.12.4
# renovate: datasource=github-releases depName=kubernetes-sigs/kind
KIND_VERSION: v0.23.0
# renovate: datasource=github-releases depName=operator-framework/operator-lifecycle-manager
OLM_VERSION: v0.28.0
steps:
- name: Checkout 🛎️
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0
- name: Setup Helm 🧰
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4
with:
version: ${{ env.HELM_VERSION }}
- name: Setup Python 🐍
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Setup chart-testing 🧰
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
- name: Find changed Charts 🔎
id: changed-charts
run: |
changed=$(ct list-changed --target-branch main)
echo ${changed}
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Setup kind cluster 🧰
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
version: ${{ env.KIND_VERSION }}
if: steps.changed-charts.outputs.changed == 'true'
# for helm charts we are testing that require installing operators
- name: Setup kind cluster - Install OLM 🧰
run: |
curl -L https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${OLM_VERSION}/install.sh -o install.sh
chmod +x install.sh
./install.sh ${OLM_VERSION}
if: steps.changed-charts.outputs.changed == 'true'
# for helm charts we are testing that require ingress
- name: Setup kind cluster - Install ingress controller 🧰
run: |
helm repo add haproxy-ingress https://haproxy-ingress.github.io/charts
helm install haproxy-ingress haproxy-ingress/haproxy-ingress \
--create-namespace --namespace=ingress-controller \
--set controller.hostNetwork=true
kubectl apply -f - <<EOF
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: haproxy
annotations:
ingressclass.kubernetes.io/is-default-class: 'true'
spec:
controller: haproxy-ingress.github.io/controller
EOF
if: steps.changed-charts.outputs.changed == 'true'
# for helm charts we are testing that require/expect certain default namespaces from Red Hat OpenShift
- name: Setup kind cluster - create expected namespaces 🧰
run: |
kubectl create namespace openshift-operators
if: steps.changed-charts.outputs.changed == 'true'
- name: Run unit tests 🧪
timeout-minutes: 30
run: |
ct install --target-branch main --debug --config _test/ct-config.yaml
if: steps.changed-charts.outputs.changed == 'true'