From 384a969548e49e324e3da079b6125aad46f1c450 Mon Sep 17 00:00:00 2001 From: Peter Motzko Date: Tue, 15 Aug 2023 11:35:51 +0200 Subject: [PATCH] feat(ci): separate linting and testing and build temporary image to deploy on cluster --- .github/workflows/chart-lint.yml | 130 +++++++++++++++++-------------- 1 file changed, 70 insertions(+), 60 deletions(-) diff --git a/.github/workflows/chart-lint.yml b/.github/workflows/chart-lint.yml index 0b4245e8c..2467f9cc9 100644 --- a/.github/workflows/chart-lint.yml +++ b/.github/workflows/chart-lint.yml @@ -30,65 +30,75 @@ on: required: false pull_request: paths: - - 'charts/**' + - 'charts/managed-identity-wallet/**' jobs: - chart-lint: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Set up Helm - uses: azure/setup-helm@v3 - with: - version: v3.11.3 - - - name: Update Helm dependencies - run: | - cd charts/managed-identity-wallet - helm dependency update - - - name: Install Helm unittest plugin - run: | - helm plugin install https://github.com/helm-unittest/helm-unittest.git - - # Setup python as a prerequisite for chart linting - - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - - name: Set up chart-testing - uses: helm/chart-testing-action@v2.3.1 - - - name: Install Task - uses: arduino/setup-task@v1 - - - name: Run chart-testing (list-changed) - id: list-changed - run: | - changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) - if [[ -n "$changed" ]]; then - echo "changed=true" >> $GITHUB_OUTPUT - fi - - # run chart linting - - name: Run chart-testing (lint) - run: ct lint --config charts/chart-testing-config.yaml --charts ./charts/managed-identity-wallet - - # run chart unittest - - name: Run Helm unittests - run: task helm:unittest - - # Preparing a kind cluster to install and test charts on - - name: Create kind cluster - uses: helm/kind-action@v1.7.0 - if: steps.list-changed.outputs.changed == 'true' || ${{ inputs.force }} - - # install the chart to the kind cluster and run helm test - # define charts to test with the --charts parameter - - name: Run chart-testing (install) - run: ct install --charts charts/managed-identity-wallet --config charts/chart-testing-config.yaml - if: steps.list-changed.outputs.changed == 'true' || ${{ inputs.force }} + chart-lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@v3 + with: + version: v3.12.3 + + - name: Update Helm dependencies + run: | + cd charts/managed-identity-wallet + helm dependency build + + # Setup python as a prerequisite for chart linting + - uses: actions/setup-python@v4 + with: + python-version: 3.10 + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.4.0 + + - name: Run linting + run: ct lint --config charts/chart-testing-config.yaml --charts ./charts/managed-identity-wallet + + chart-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@v3 + with: + version: v3.12.3 + + - name: Update Helm dependencies + run: | + cd charts/managed-identity-wallet + helm dependency build + + - name: Install Helm unittest plugin + run: | + helm plugin install https://github.com/helm-unittest/helm-unittest.git + + - name: Run Helm unittests + run: task helm:unittest + + - name: Kubernetes KinD Cluster + uses: container-tools/kind-action@v2 + with: + node_image: 'kindest/node:v1.27.3' + version: v0.20.0 + + - name: Build image + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: kind-registry:5000/miw:testing + + - name: Install the chart on KinD cluster + run: helm install --set image.tag=testing --set=image.repository=kind-registry:5000/miw" testing charts/managed-identity-wallet