charts/.github/workflows/charts-lint-test.yaml
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 34bbd3e3da
[template] Move template chart to outer folder (#518)
* [template] Move template chart to outer folder

* Revert workflow change
2021-01-26 20:31:43 +01:00

115 lines
2.9 KiB
YAML

name: "Charts: Lint and test"
on:
pull_request:
paths:
- 'charts/**'
- '!charts/**/README.md'
jobs:
lint:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.list-changed.outputs.changed }}
common: ${{ steps.list-changed.outputs.common }}
steps:
- 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'
unittest:
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install Dev tools
run: sudo apt-get update && sudo apt-get install -y jq libjq-dev
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.4.0
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Install dependencies
run: |
export RUBYJQ_USE_SYSTEM_LIBRARIES=1
bundle install
- name: Run tests
run: |
bundle exec m -r test/charts
install:
runs-on: ubuntu-latest
needs: lint
steps:
- 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'