TrueChartsClone/.github/workflows/common.test.yaml

110 lines
3.5 KiB
YAML

name: "common: Tests"
on:
pull_request:
branches:
- '**'
tags-ignore:
- '**'
paths:
- 'charts/library/**'
- '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@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
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 update
- name: Run chart-testing (lint)
run: ct lint --config .github/ct-lint.yaml --charts 'charts/library/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@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
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 update
- uses: actions/setup-python@f38219332975fe8f9c04cca981d674bf22aea1d3 # renovate: tag=v2
if: ${{ matrix.app != '.gitkee' }}
with:
python-version: 3.7
- name: Set up chart-testing
if: ${{ matrix.app != '.gitkee' }}
uses: helm/chart-testing-action@5f16c27cf7a4fa9c776ff73734df3909b2b65127 # renovate: tag=v2.1.0
##
# Chart-Testing Section
##
- uses: actions/setup-python@f38219332975fe8f9c04cca981d674bf22aea1d3 # renovate: tag=v2
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 'charts/library/common-test'