This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2022-07-27 17:17:38 +02:00
parent bb122b930c
commit c649d44c21
No known key found for this signature in database
GPG key ID: BC5E2BD907F9A8EC
3 changed files with 71 additions and 54 deletions

View file

@ -10,6 +10,9 @@ on:
required: true required: true
type: string type: string
env:
HELM_VERSION: 3.9.2
jobs: jobs:
lint: lint:
name: Lint charts name: Lint charts
@ -26,10 +29,7 @@ jobs:
with: with:
setup-tools: | setup-tools: |
helmv3 helmv3
helm: "3.8.0" helm: "${{ env.HELM_VERSION }}"
- name: Install Helm
uses: Azure/setup-helm@v3.3
- name: Set up chart-testing - name: Set up chart-testing
uses: helm/chart-testing-action@v2.2.1 uses: helm/chart-testing-action@v2.2.1

View file

@ -15,6 +15,9 @@ on:
paths: paths:
- "charts/**" - "charts/**"
env:
HELM_VERSION: 3.9.2
jobs: jobs:
release-charts: release-charts:
name: Release charts name: Release charts
@ -31,7 +34,7 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
token: ${{ steps.get-app-token.outputs.token }} token: ${{ steps.get-app-token.outputs.token }}
path: 'src' path: "src"
fetch-depth: 0 fetch-depth: 0
- name: Collect changes - name: Collect changes
@ -61,14 +64,16 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
token: ${{ steps.get-app-token.outputs.token }} token: ${{ steps.get-app-token.outputs.token }}
path: 'dest' path: "dest"
ref: 'gh-pages' ref: "gh-pages"
fetch-depth: 0 fetch-depth: 0
- name: Install Helm - name: Install Kubernetes tools
uses: Azure/setup-helm@v3.3 uses: yokawasa/action-setup-kube-tools@v0.8.2
with: with:
token: ${{ steps.get-app-token.outputs.token }} setup-tools: |
helmv3
helm: "${{ env.HELM_VERSION }}"
- name: Package Helm Charts - name: Package Helm Charts
shell: bash shell: bash

View file

@ -10,44 +10,13 @@ on:
required: true required: true
type: string type: string
env:
HELM_VERSION: 3.9.2
jobs: jobs:
# unit-test: generate-test-matrix:
# name: Run unit tests
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
# ref: ${{ inputs.checkoutCommit }}
# - name: Install Kubernetes tools
# uses: yokawasa/action-setup-kube-tools@v0.8.2
# with:
# setup-tools: |
# helmv3
# helm: "3.8.0"
# - name: Install Ruby
# uses: ruby/setup-ruby@v1
# with:
# ruby-version: 2.7
# - name: Install dependencies
# env:
# RUBYJQ_USE_SYSTEM_LIBRARIES: 1
# run: |
# sudo apt-get update
# sudo apt-get install libjq-dev
# bundle install
# - name: Run tests
# run: |
# bundle exec m -r ./test/
generate-install-matrix:
name: Generate matrix for install name: Generate matrix for install
runs-on: ubuntu-latest runs-on: ubuntu-22.04
outputs: outputs:
matrix: | matrix: |
{ {
@ -79,13 +48,13 @@ jobs:
install-charts: install-charts:
needs: needs:
- generate-install-matrix - generate-test-matrix
if: needs.generate-install-matrix.outputs.detected == 'true' if: needs.generate-test-matrix.outputs.detected == 'true'
name: Install charts name: Install charts
strategy: strategy:
matrix: ${{ fromJson(needs.generate-install-matrix.outputs.matrix) }} matrix: ${{ fromJson(needs.generate-test-matrix.outputs.matrix) }}
fail-fast: false fail-fast: false
runs-on: ubuntu-latest runs-on: ubuntu-22.04
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -99,7 +68,7 @@ jobs:
setup-tools: | setup-tools: |
helmv3 helmv3
kubectl kubectl
helm: "3.6.3" helm: "${{ env.HELM_VERSION }}"
kubectl: "${{ matrix.k8s_version }}" kubectl: "${{ matrix.k8s_version }}"
- uses: actions/setup-python@v4 - uses: actions/setup-python@v4
@ -124,13 +93,56 @@ jobs:
# Summarize matrix https://github.community/t/status-check-for-a-matrix-jobs/127354/7 # Summarize matrix https://github.community/t/status-check-for-a-matrix-jobs/127354/7
install_success: install_success:
needs: needs:
- generate-install-matrix - generate-test-matrix
- install-charts - install-charts
if: | if: |
always() always()
name: Install successful name: Install successful
runs-on: ubuntu-latest runs-on: ubuntu-22.04
steps: steps:
- name: Check install matrix status - name: Check install matrix status
if: ${{ (needs.generate-install-matrix.outputs.detected == 'true') && (needs.install-charts.result != 'success') }} if: ${{ (needs.generate-test-matrix.outputs.detected == 'true') && (needs.install-charts.result != 'success') }}
run: exit 1
unittest:
name: Run unit tests
runs-on: ubuntu-20.04
needs:
- generate-test-matrix
if: needs.generate-test-matrix.outputs.detected == 'true'
strategy:
matrix: ${{ fromJson(needs.generate-test-matrix.outputs.matrix) }}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ inputs.checkoutCommit }}
- name: Install Kubernetes tools
uses: yokawasa/action-setup-kube-tools@v0.8.2
with:
setup-tools: |
helmv3
helm: "${{ env.HELM_VERSION }}"
- name: Run tests
run: |
helm plugin install https://github.com/vbehar/helm3-unittest --version v1.0.16
cd ${{ matrix.chart }}
helm unittest -f "tests/**/*_test.yaml" .
# Summarize matrix https://github.community/t/status-check-for-a-matrix-jobs/127354/7
unittest_success:
needs:
- generate-test-matrix
- unittest
if: |
always()
name: Unittest successful
runs-on: ubuntu-22.04
steps:
- name: Check unittest matrix status
if: ${{ (needs.generate-test-matrix.outputs.detected == 'true') && (needs.unittest.result != 'success') }}
run: exit 1 run: exit 1