mirror of
https://github.com/truecharts/library-charts.git
synced 2026-07-05 17:26:23 -03:00
123 lines
3.9 KiB
YAML
123 lines
3.9 KiB
YAML
name: Common Library Tests
|
|
|
|
on:
|
|
pull_request:
|
|
# paths:
|
|
# - library/**
|
|
# - .github/workflows/common_tests.yaml
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint Common
|
|
runs-on: ubuntu-22.04
|
|
outputs:
|
|
changed: ${{ steps.list-changed.outputs.changed }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install Helm
|
|
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # tag=v3
|
|
with:
|
|
version: v3.10.3
|
|
|
|
- uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # tag=v4
|
|
with:
|
|
python-version: "3.10"
|
|
|
|
- name: Set up chart-testing
|
|
uses: helm/chart-testing-action@afea100a513515fbd68b0e72a7bb0ae34cb62aec # tag=v2.3.1
|
|
|
|
- name: Gather changed charts
|
|
id: list-changed
|
|
run: |
|
|
changed=$(ct list-changed --config .github/ct-install-config/ct-lint.yaml)
|
|
if [[ -n "$changed" ]]; then
|
|
echo "changes_detected=true" >> $GITHUB_OUTPUT
|
|
echo "changed_charts=$changed" >> $GITHUB_OUTPUT
|
|
fi
|
|
echo "Changed Charts: $changed"
|
|
|
|
- name: Run chart-testing (lint)
|
|
id: lint
|
|
if: ${{ steps.list-changed.outputs.changes_detected }} == 'true'
|
|
run: |
|
|
ct lint --config .github/ct-install-config/ct-lint.yaml \
|
|
--lint-conf .github/ct-install-config/lint-conf.yaml \
|
|
--charts "${{ steps.list-changed.outputs.changed_charts }}" \
|
|
--debug
|
|
|
|
unittest:
|
|
needs:
|
|
- lint
|
|
name: Unit Tests
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install Helm
|
|
uses: azure/setup-helm@f382f75448129b3be48f8121b9857be18d815a82 # tag=v3
|
|
with:
|
|
version: v3.10.3
|
|
|
|
- name: Run tests
|
|
run: |
|
|
helm plugin install https://github.com/quintush/helm-unittest --version v0.2.11
|
|
cd library/common-test/
|
|
helm dependency update
|
|
helm unittest --helm3 -f "tests/*/*.yaml" .
|
|
|
|
install:
|
|
needs:
|
|
- lint
|
|
name: Install Charts
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install Helm
|
|
uses: azure/setup-helm@f382f75448129b3be48f8121b9857be18d815a82 # tag=v3
|
|
with:
|
|
version: v3.10.3
|
|
|
|
- uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # tag=v4
|
|
with:
|
|
python-version: "3.10"
|
|
|
|
- name: Set up chart-testing
|
|
uses: helm/chart-testing-action@afea100a513515fbd68b0e72a7bb0ae34cb62aec # tag=v2.3.1
|
|
|
|
- name: Gather changed charts
|
|
id: list-changed
|
|
run: |
|
|
changed=$(ct list-changed --config .github/ct-install-config/ct-install.yaml)
|
|
if [[ -n "$changed" ]]; then
|
|
echo "changes_detected=true" >> $GITHUB_OUTPUT
|
|
echo "changed_charts=$changed" >> $GITHUB_OUTPUT
|
|
fi
|
|
echo "Changed Charts: $changed"
|
|
|
|
- name: Create k3d cluster
|
|
if: ${{ steps.list-changed.outputs.changes_detected }} == 'true'
|
|
uses: nolar/setup-k3d-k3s@293b8e5822a20bc0d5bcdd4826f1a665e72aba96 # tag=v1.0.9
|
|
with:
|
|
# version: v1.22.4+k3s1
|
|
# This version greps wrong deployment name and it fails.
|
|
version: v1.25.4+k3s1
|
|
|
|
- name: Run chart-testing (install)
|
|
if: ${{ steps.list-changed.outputs.changes_detected }} == 'true'
|
|
run: |
|
|
ct install --config .github/ct-install-config/ct-install.yaml \
|
|
--charts "${{ steps.list-changed.outputs.changed_charts }}" \
|
|
--upgrade \
|
|
--debug
|