2021-01-11 01:29:16 +00:00
|
|
|
name: "Charts: Lint and test"
|
2020-11-24 13:30:11 +00:00
|
|
|
|
2021-01-26 18:17:14 +00:00
|
|
|
on:
|
2021-01-11 01:29:16 +00:00
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- 'charts/**'
|
|
|
|
- '!charts/**/README.md'
|
2021-02-17 22:43:56 +00:00
|
|
|
- '!charts/**/README.md.gotmpl'
|
2021-02-17 22:53:55 +00:00
|
|
|
- '!charts/**/README_CHANGELOG.md.gotmpl'
|
|
|
|
- '!charts/**/README_CONFIG.md.gotmpl'
|
2020-11-24 13:30:11 +00:00
|
|
|
|
2020-01-10 15:52:38 +00:00
|
|
|
jobs:
|
2021-01-05 17:34:42 +00:00
|
|
|
lint:
|
2020-01-10 15:52:38 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-01-05 17:34:42 +00:00
|
|
|
outputs:
|
|
|
|
changed: ${{ steps.list-changed.outputs.changed }}
|
|
|
|
common: ${{ steps.list-changed.outputs.common }}
|
2020-01-10 15:52:38 +00:00
|
|
|
steps:
|
2021-02-17 22:43:56 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Install Helm
|
|
|
|
uses: azure/setup-helm@v1
|
|
|
|
with:
|
|
|
|
version: v3.4.0
|
|
|
|
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: 3.7
|
|
|
|
|
|
|
|
- name: Set up chart-testing
|
|
|
|
uses: helm/chart-testing-action@v2.0.1
|
|
|
|
|
|
|
|
- name: Run chart-testing (list-changed)
|
|
|
|
id: list-changed
|
|
|
|
run: |
|
|
|
|
changed=$(ct list-changed --config .github/ct.yaml)
|
|
|
|
if [[ -n "$changed" ]]; then
|
|
|
|
echo "::set-output name=changed::true"
|
|
|
|
fi
|
|
|
|
|
|
|
|
changed_unfiltered=$(ct list-changed --config .github/ct.yaml --excluded-charts "")
|
|
|
|
if [[ $(grep -E "^charts/common(-test)?$" <<< "$changed_unfiltered") ]]; then
|
|
|
|
echo "::set-output name=common::true"
|
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Run chart-testing (lint)
|
|
|
|
id: lint
|
|
|
|
run: ct lint --config .github/ct.yaml --excluded-charts ""
|
|
|
|
if: steps.list-changed.outputs.changed == 'true' || steps.list-changed.outputs.common == 'true'
|
2020-12-16 16:26:35 +00:00
|
|
|
|
2021-01-05 17:34:42 +00:00
|
|
|
unittest:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: lint
|
|
|
|
steps:
|
2021-02-17 22:43:56 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2021-01-05 17:34:42 +00:00
|
|
|
|
2021-02-17 22:43:56 +00:00
|
|
|
- name: Install Dev tools
|
|
|
|
run: sudo apt-get update && sudo apt-get install -y jq libjq-dev
|
2021-01-05 17:34:42 +00:00
|
|
|
|
2021-02-17 22:43:56 +00:00
|
|
|
- name: Install Helm
|
|
|
|
uses: azure/setup-helm@v1
|
|
|
|
with:
|
|
|
|
version: v3.4.0
|
2021-01-05 17:34:42 +00:00
|
|
|
|
2021-02-17 22:43:56 +00:00
|
|
|
- name: Install Ruby
|
|
|
|
uses: ruby/setup-ruby@v1
|
|
|
|
with:
|
|
|
|
ruby-version: 2.7
|
2021-01-26 18:17:14 +00:00
|
|
|
|
2021-02-17 22:43:56 +00:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
export RUBYJQ_USE_SYSTEM_LIBRARIES=1
|
|
|
|
bundle install
|
2021-01-26 18:17:14 +00:00
|
|
|
|
2021-02-17 22:43:56 +00:00
|
|
|
- name: Run tests
|
|
|
|
run: |
|
|
|
|
bundle exec m -r test/charts
|
2021-01-05 17:34:42 +00:00
|
|
|
|
|
|
|
install:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: lint
|
|
|
|
steps:
|
2021-02-17 22:43:56 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Install Helm
|
|
|
|
uses: azure/setup-helm@v1
|
|
|
|
with:
|
|
|
|
version: v3.4.0
|
|
|
|
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: 3.7
|
|
|
|
|
|
|
|
- name: Set up chart-testing
|
|
|
|
uses: helm/chart-testing-action@v2.0.1
|
|
|
|
|
|
|
|
- name: Create kind cluster
|
|
|
|
uses: helm/kind-action@v1.1.0
|
|
|
|
if: needs.lint.outputs.changed == 'true' || needs.lint.outputs.common == 'true'
|
|
|
|
|
|
|
|
- name: Run chart-testing (install)
|
|
|
|
run: ct install --config .github/ct.yaml --excluded-charts ""
|
|
|
|
if: needs.lint.outputs.changed == 'true'
|
|
|
|
|
|
|
|
- name: Run chart-testing (common-test)
|
|
|
|
run: |
|
|
|
|
ct install --config .github/ct.yaml --charts 'charts/common-test'
|
|
|
|
if: needs.lint.outputs.common == 'true'
|