mirror of
https://github.com/truenas/charts.git
synced 2026-06-18 01:26:53 +08:00
101 lines
2.8 KiB
YAML
101 lines
2.8 KiB
YAML
name: Common Library Lint and Test
|
|
|
|
on:
|
|
pull_request:
|
|
# paths:
|
|
# - library/**
|
|
# - .github/workflows/common_tests.yaml
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint Common
|
|
runs-on: ubuntu-20.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.1
|
|
|
|
- uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # tag=v4
|
|
with:
|
|
python-version: 3.7
|
|
|
|
- name: Set up chart-testing
|
|
uses: helm/chart-testing-action@afea100a513515fbd68b0e72a7bb0ae34cb62aec # tag=v2.3.1
|
|
|
|
- name: Run chart-testing (list-changed)
|
|
id: list-changed
|
|
run: |
|
|
changed=$(ct list-changed --config .github/ct-lint.yaml)
|
|
if [[ -n "$changed" ]]; then
|
|
echo "changed=true" >> $env:GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Run chart-testing (lint)
|
|
id: lint
|
|
if: steps.list-changed.outputs.changed == 'true'
|
|
run: ct lint --config .github/ct-lint.yaml
|
|
|
|
unittest:
|
|
needs:
|
|
- lint
|
|
name: Run unit tests
|
|
runs-on: ubuntu-20.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.1
|
|
|
|
- name: Run tests
|
|
run: |
|
|
helm plugin install https://github.com/quintush/helm-unittest --version v0.2.10
|
|
cd library/common-test/
|
|
helm dependency update
|
|
helm unittest --helm3 -f "tests/*/*.yaml" .
|
|
|
|
install:
|
|
needs:
|
|
- lint
|
|
name: Install charts
|
|
runs-on: ubuntu-20.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.1
|
|
|
|
- uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # tag=v4
|
|
with:
|
|
python-version: 3.7
|
|
|
|
- name: Set up chart-testing
|
|
uses: helm/chart-testing-action@afea100a513515fbd68b0e72a7bb0ae34cb62aec # tag=v2.3.1
|
|
|
|
- name: Create k3d cluster
|
|
uses: nolar/setup-k3d-k3s@v1
|
|
with:
|
|
version: v1.25.4+k3s1
|
|
if: needs.lint.outputs.changed == 'true'
|
|
|
|
- name: Run chart-testing (install)
|
|
if: needs.lint.outputs.changed == 'true'
|
|
run: cd library/common-test && ct install --chart-dirs . --charts . --config ../../.github/ct-install.yaml --debug
|