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
|
|
|
|
2021-06-11 17:56:14 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.head_ref }}-lint
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2020-01-10 15:52:38 +00:00
|
|
|
jobs:
|
2021-03-18 12:11:24 +00:00
|
|
|
changes-lint:
|
|
|
|
name: Detect changes for linting
|
2021-02-22 18:30:40 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2021-01-05 17:34:42 +00:00
|
|
|
outputs:
|
2021-03-18 12:11:24 +00:00
|
|
|
matrix: |
|
|
|
|
{
|
|
|
|
"chart": ${{ steps.list-changed.outputs.charts }}
|
|
|
|
}
|
|
|
|
detected: ${{ steps.list-changed.outputs.detected }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up chart-testing
|
|
|
|
uses: helm/chart-testing-action@v2.0.1
|
|
|
|
|
|
|
|
- name: Install Dev tools
|
|
|
|
run: |
|
|
|
|
sudo wget https://github.com/mikefarah/yq/releases/download/v4.2.0/yq_linux_amd64 -O /usr/bin/yq
|
|
|
|
sudo chmod +x /usr/bin/yq
|
|
|
|
|
|
|
|
- name: Run chart-testing (list-changed)
|
|
|
|
id: list-changed
|
|
|
|
run: |
|
|
|
|
EXCLUDED=$(yq eval -j '.excluded-charts // []' .github/ct-lint.yaml)
|
|
|
|
CHARTS=$(ct list-changed --config .github/ct-lint.yaml)
|
|
|
|
CHARTS_JSON=$(echo "${CHARTS}" | jq -R -s -c 'split("\n")[:-1]')
|
|
|
|
OUTPUT_JSON=$(echo "{\"excluded\": ${EXCLUDED}, \"all\": ${CHARTS_JSON}}" | jq -c '.all-.excluded')
|
|
|
|
echo ::set-output name=charts::${OUTPUT_JSON}
|
|
|
|
if [[ $(echo ${OUTPUT_JSON} | jq -c '. | length') -gt 0 ]]; then
|
|
|
|
echo "::set-output name=detected::true"
|
|
|
|
fi
|
|
|
|
|
|
|
|
changes-install:
|
|
|
|
name: Detect changes for install
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
outputs:
|
|
|
|
matrix: |
|
|
|
|
{
|
|
|
|
"chart": ${{ steps.list-changed.outputs.charts }}
|
|
|
|
}
|
|
|
|
detected: ${{ steps.list-changed.outputs.detected }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up chart-testing
|
|
|
|
uses: helm/chart-testing-action@v2.0.1
|
|
|
|
|
|
|
|
- name: Install Dev tools
|
|
|
|
run: |
|
|
|
|
sudo wget https://github.com/mikefarah/yq/releases/download/v4.2.0/yq_linux_amd64 -O /usr/bin/yq
|
|
|
|
sudo chmod +x /usr/bin/yq
|
|
|
|
|
|
|
|
- name: Run chart-testing (list-changed)
|
|
|
|
id: list-changed
|
|
|
|
run: |
|
|
|
|
EXCLUDED=$(yq eval -j '.excluded-charts // []' .github/ct-install.yaml)
|
|
|
|
CHARTS=$(ct list-changed --config .github/ct-install.yaml)
|
|
|
|
CHARTS_JSON=$(echo "${CHARTS}" | jq -R -s -c 'split("\n")[:-1]')
|
|
|
|
OUTPUT_JSON=$(echo "{\"excluded\": ${EXCLUDED}, \"all\": ${CHARTS_JSON}}" | jq -c '.all-.excluded')
|
|
|
|
echo ::set-output name=charts::${OUTPUT_JSON}
|
|
|
|
if [[ $(echo ${OUTPUT_JSON} | jq -c '. | length') -gt 0 ]]; then
|
|
|
|
echo "::set-output name=detected::true"
|
|
|
|
fi
|
|
|
|
|
2021-04-07 05:32:29 +00:00
|
|
|
lint:
|
|
|
|
needs:
|
|
|
|
- changes-lint
|
2021-06-12 07:07:32 +00:00
|
|
|
if:
|
|
|
|
needs.changes-lint.outputs.detected == 'true'
|
2021-04-07 05:32:29 +00:00
|
|
|
name: Lint charts
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Install Helm
|
|
|
|
uses: azure/setup-helm@v1
|
|
|
|
with:
|
|
|
|
version: v3.5.3
|
|
|
|
|
2021-02-17 22:43:56 +00:00
|
|
|
- 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 (lint)
|
|
|
|
id: lint
|
2021-04-07 05:32:29 +00:00
|
|
|
run: ct lint --config .github/ct-lint.yaml
|
2021-03-18 12:11:24 +00:00
|
|
|
|
2021-01-05 17:34:42 +00:00
|
|
|
unittest:
|
2021-05-01 11:27:23 +00:00
|
|
|
needs:
|
|
|
|
- lint
|
2021-03-18 12:11:24 +00:00
|
|
|
name: Run unit tests
|
2021-02-22 18:30:40 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2021-01-05 17:34:42 +00:00
|
|
|
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:
|
2021-03-12 13:57:27 +00:00
|
|
|
version: v3.5.3
|
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
|
2021-03-18 12:11:24 +00:00
|
|
|
env:
|
|
|
|
RUBYJQ_USE_SYSTEM_LIBRARIES: 1
|
2021-02-17 22:43:56 +00:00
|
|
|
run: |
|
|
|
|
bundle install
|
2021-01-26 18:17:14 +00:00
|
|
|
|
2021-02-17 22:43:56 +00:00
|
|
|
- name: Run tests
|
|
|
|
run: |
|
2021-03-18 12:11:24 +00:00
|
|
|
bundle exec m -r ./test/
|
2021-01-05 17:34:42 +00:00
|
|
|
|
|
|
|
install:
|
2021-03-18 12:11:24 +00:00
|
|
|
needs:
|
|
|
|
- changes-install
|
2021-05-01 11:27:23 +00:00
|
|
|
- lint
|
2021-06-12 07:07:32 +00:00
|
|
|
if:
|
|
|
|
needs.changes-install.outputs.detected == 'true'
|
2021-03-18 12:11:24 +00:00
|
|
|
name: Install charts
|
|
|
|
strategy:
|
|
|
|
matrix: ${{ fromJson(needs.changes-install.outputs.matrix) }}
|
|
|
|
fail-fast: true
|
|
|
|
max-parallel: 15
|
2021-02-22 18:30:40 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2021-01-05 17:34:42 +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:
|
2021-03-12 13:57:27 +00:00
|
|
|
version: v3.5.3
|
2021-02-17 22:43:56 +00:00
|
|
|
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: 3.7
|
|
|
|
|
|
|
|
- name: Set up chart-testing
|
|
|
|
uses: helm/chart-testing-action@v2.0.1
|
|
|
|
|
2021-03-12 12:59:14 +00:00
|
|
|
- name: Create k3d cluster
|
|
|
|
uses: nolar/setup-k3d-k3s@v1
|
|
|
|
with:
|
|
|
|
version: v1.19
|
2021-02-17 22:43:56 +00:00
|
|
|
|
2021-04-07 20:24:08 +00:00
|
|
|
- name: Remove node taints
|
|
|
|
run: |
|
|
|
|
kubectl taint --all=true nodes node.cloudprovider.kubernetes.io/uninitialized- || true
|
|
|
|
|
2021-02-17 22:43:56 +00:00
|
|
|
- name: Run chart-testing (install)
|
2021-03-18 12:11:24 +00:00
|
|
|
run: ct install --config .github/ct-install.yaml --charts ${{ matrix.chart }}
|
|
|
|
|
|
|
|
# Summarize matrix https://github.community/t/status-check-for-a-matrix-jobs/127354/7
|
|
|
|
install_success:
|
2021-05-01 11:27:23 +00:00
|
|
|
needs:
|
2021-04-07 05:32:29 +00:00
|
|
|
- changes-install
|
2021-03-18 12:11:24 +00:00
|
|
|
- install
|
|
|
|
if: ${{ always() }}
|
|
|
|
name: Install successful
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
|
|
- name: Check install matrix status
|
2021-06-12 07:07:32 +00:00
|
|
|
if: ${{ needs.changes-install.outputs.detected == 'true' && needs.install.result != 'success' }}
|
2021-03-18 12:11:24 +00:00
|
|
|
run: exit 1
|