name: "common: Tests" on: pull_request: branches: - '**' tags-ignore: - '**' paths: - 'charts/**' - 'helper-charts/**' - 'tests/**' - '.github/workflows/common.test.yaml' - '.github/ct-install.yaml' - '.github/ct-lint.yaml' jobs: unit-and-lint: name: Unit and Lint tests runs-on: ubuntu-latest container: image: tccr.io/truecharts/devcontainer:v2.2.1 steps: - name: Cache helm repo cache id: cache uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed # renovate: tag=v2 with: key: helmrepocache-${{ github.sha }} path: | ~/.cache/helm/repository ~/.config/helm/repositories.yaml - uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3 name: Checkout with: fetch-depth: 100 - name: update helm repo cache run: | helm repo add truecharts https://truecharts.org helm repo add bitnami https://charts.bitnami.com/bitnami helm repo add metallb https://metallb.github.io/metallb helm repo add grafana https://grafana.github.io/helm-charts helm repo add prometheus https://prometheus-community.github.io/helm-charts helm repo add amd-gpu-helm https://radeonopencompute.github.io/k8s-device-plugin/ helm repo update - name: Run chart-testing (lint) run: ct lint --config .github/ct-lint.yaml --charts 'helper-charts/common-test' - name: Run common unit tests run: | bundle exec m -r tests run-tests: name: Run tests runs-on: ubuntu-latest needs: [unit-and-lint] steps: - name: Cache helm repo cache id: cache uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed # renovate: tag=v2 with: key: helmrepocache-${{ github.sha }} path: | ~/.cache/helm/repository ~/.config/helm/repositories.yaml - uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3 name: Checkout with: fetch-depth: 100 - name: Install Helm if: ${{ matrix.app != '.gitkee' }} uses: azure/setup-helm@18bc76811624f360dbd7f18c2d4ecb32c7b87bab # renovate: tag=v1 with: version: v3.7.1 - name: update helm repo cache run: | helm repo add truecharts https://truecharts.org helm repo add bitnami https://charts.bitnami.com/bitnami helm repo add metallb https://metallb.github.io/metallb helm repo add prometheus https://prometheus-community.github.io/helm-charts helm repo add amd-gpu-helm https://radeonopencompute.github.io/k8s-device-plugin/ helm repo update - uses: actions/setup-python@0ebf233433c08fb9061af664d501c3f3ff0e9e20 # tag=v3 if: ${{ matrix.app != '.gitkee' }} with: python-version: 3.7 - name: Set up chart-testing if: ${{ matrix.app != '.gitkee' }} uses: helm/chart-testing-action@dae259e86a35ff09145c0805e2d7dd3f7207064a # tag=v2.2.1 ## # Chart-Testing Section ## - uses: actions/setup-python@0ebf233433c08fb9061af664d501c3f3ff0e9e20 # tag=v3 if: ${{ matrix.app != '.gitkee' }} with: python-version: 3.7 - name: Create k3d cluster uses: nolar/setup-k3d-k3s@v1 with: version: v1.22.4+k3s1 - name: Run chart-testing (install) run: find ./ -type f -name *.yaml -exec sed -i 's/tccr.io/ghcr.io/gI' {} \; && ct install --config .github/ct-install.yaml --charts 'helper-charts/common-test'