charts/.github/workflows/charts-lint-test.yaml

121 lines
3.1 KiB
YAML
Raw Normal View History

2021-01-11 01:29:16 +00:00
name: "Charts: Lint and test"
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'
jobs:
lint:
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
runs-on: ubuntu-20.04
outputs:
changed: ${{ steps.list-changed.outputs.changed }}
common: ${{ steps.list-changed.outputs.common }}
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-lint.yaml)
2021-02-17 22:43:56 +00:00
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
changed_unfiltered=$(ct list-changed --config .github/ct-lint.yaml --excluded-charts "")
2021-02-17 22:43:56 +00:00
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-lint.yaml --excluded-charts ""
2021-02-17 22:43:56 +00:00
if: steps.list-changed.outputs.changed == 'true' || steps.list-changed.outputs.common == 'true'
unittest:
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
runs-on: ubuntu-20.04
needs: lint
steps:
2021-02-17 22:43:56 +00:00
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
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-02-17 22:43:56 +00:00
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.4.0
2021-02-17 22:43:56 +00:00
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
2021-02-17 22:43:56 +00:00
- name: Install dependencies
run: |
export RUBYJQ_USE_SYSTEM_LIBRARIES=1
bundle install
2021-02-17 22:43:56 +00:00
- name: Run tests
run: |
bundle exec m -r test/charts
install:
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
runs-on: ubuntu-20.04
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-install.yaml
2021-02-17 22:43:56 +00:00
if: needs.lint.outputs.changed == 'true'
- name: Run chart-testing (common-test)
run: |
ct install --config .github/ct-install.yaml --charts 'charts/common-test'
2021-02-17 22:43:56 +00:00
if: needs.lint.outputs.common == 'true'