From 9cc2089a546464d2e3f4f996f56e9c399cc926e9 Mon Sep 17 00:00:00 2001 From: Marco Franssen Date: Wed, 30 Nov 2022 12:55:51 +0100 Subject: [PATCH] Add linting job Signed-off-by: Marco Franssen --- .github/workflows/test.yml | 52 +++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8526f433..35bb0886 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,9 +3,59 @@ name: Test Charts on: pull_request: paths: + - ".github/workflows/test.yml" - "charts/**" jobs: + build-matrix: + name: Find charts + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # pin@v3 + with: + fetch-depth: 0 + + - name: Find charts + id: build-matrix + run: | + charts=$(find charts -type f -name 'Chart.yaml' | sed -r 's|/[^/]+$||' | sort | uniq | jq -c --slurp --raw-input 'split("\n") | map(select(. != ""))') + echo "charts=$charts" >> $GITHUB_OUTPUT + + outputs: + charts: ${{ steps.build-matrix.outputs.charts }} + + lint: + runs-on: ubuntu-latest + needs: [build-matrix] + + strategy: + fail-fast: false + matrix: + chart: ${{ fromJson(needs.build-matrix.outputs.charts) }} + + steps: + - name: Checkout + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # pin@v3 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # pin@v3.5 + with: + version: v3.10.3 + + - name: Setup Sigstore Helm repo + run: | + helm repo add sigstore https://sigstore.github.io/helm-charts + helm repo update + + - name: Check lock file updated + run: | + helm dependency update . && helm dependency build . + git diff --exit-code + working-directory: ${{ matrix.chart }} + test: runs-on: ubuntu-latest steps: @@ -17,7 +67,7 @@ jobs: - name: Set up Helm uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # pin@v3.5 with: - version: v3.10.0 + version: v3.10.3 - uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 # pin@v4 with: