diff --git a/.github/workflows/lint-and-e2e.yaml b/.github/workflows/lint-and-e2e.yaml new file mode 100644 index 00000000..e392d9e7 --- /dev/null +++ b/.github/workflows/lint-and-e2e.yaml @@ -0,0 +1,115 @@ +name: Lint & E2E Tests (Experimental) + +on: + pull_request: + types: + - opened + - synchronize + push: + branches: + - master + schedule: + - cron: "0 1 * * *" + workflow_dispatch: + +jobs: + helm-lint: + runs-on: ubuntu-22.04 + timeout-minutes: 10 + steps: + - name: Checkout source + uses: actions/checkout@v3 + + - name: Update stackstorm-ha chart dependencies + run: | + set -x + helm dependency update + + - name: Helm lint + run: | + helm lint + + - name: Cache community + id: cache-community + uses: actions/cache@v3 + with: + path: community + key: ${{ runner.os }}-community-${{ hashFiles('conf/**', 'templates/**', 'Chart.yaml', 'values.yaml') }} + + - name: Helm template + if: steps.cache-community.outputs.cache-hit != 'true' + shell: bash + run: | + helm template --output-dir community . + + k8s-lint: + runs-on: ubuntu-22.04 + timeout-minutes: 10 + needs: [helm-lint] + steps: + - name: Checkout source + uses: actions/checkout@v3 + + - name: Cache community + id: cache-community + uses: actions/cache@v3 + with: + path: community + key: ${{ runner.os }}-community-${{ hashFiles('conf/**', 'templates/**', 'Chart.yaml', 'values.yaml') }} + + - name: Kubernetes kubeval lint + uses: instrumenta/kubeval-action@master + with: + files: community + + helm-e2e: + needs: [k8s-lint] + runs-on: ubuntu-22.04 + # NOTE: Just a thought in case the timeouts fail; might not be + # necessary, but might not hurt either, would vary based on the + # size of the testing matrix, too. + timeout-minutes: 30 + strategy: + fail-fast: false + max-parallel: 1 + matrix: + # TODO: Document which versions we support and cover them. + k3s-channel: + - "v1.25.4+k3s1" + steps: + - name: Checkout source + uses: actions/checkout@v3 + + - name: Set up K3s + id: k3s + uses: jupyterhub/action-k3s-helm@v3 + with: + k3s-channel: ${{ matrix.k3s-channel }} + + - name: Update stackstorm-ha chart dependencies + run: | + set -x + helm dependency update + + - name: Helm install + run: | + helm install --timeout 10m0s --debug --wait \ + --name-template stackstorm-ha . + + - name: Helm test + run: | + helm test stackstorm-ha + + - name: Helm upgrade with RBAC enabled + run: | + helm upgrade --set st2.rbac.enabled=true \ + --timeout 5m0s --debug --wait stackstorm-ha . + + - name: Helm test + run: | + helm test stackstorm-ha + + - name: Show all Kubernetes resources + if: ${{ always() }} + run: | + kubectl get all diff --git a/CHANGELOG.md b/CHANGELOG.md index 17d8238c..bbedbf2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## In Development +* Add an experimental GitHu/K3s Lint and End-to-End testing workflow. (#243) (by @mamercad) * Set `st2client` resources by `values.yaml`. (#337) (by @mamercad) * Switch to the official `bats` Docker image for e2e tests. (#338) * Temporary workaround for #311 to use previous bitnami index from: https://github.com/bitnami/charts/issues/10539 (#312 #318) (by @0xhaven) diff --git a/README.md b/README.md index 683be802..1e09f618 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # `stackstorm-ha` Helm Chart [![Build Status](https://circleci.com/gh/StackStorm/stackstorm-k8s/tree/master.svg?style=shield)](https://circleci.com/gh/StackStorm/stackstorm-k8s) +[![Build Status (Experimental)](https://github.com/StackStorm/stackstorm-k8s/actions/workflows/lint-and-e2e.yaml/badge.svg)](https://github.com/StackStorm/stackstorm-k8s/actions/workflows/lint-and-e2e.yaml) [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/stackstorm-ha)](https://artifacthub.io/packages/helm/stackstorm/stackstorm-ha) K8s Helm Chart for running StackStorm cluster in HA mode.