diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index b2e13b6..e2b4124 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -25,16 +25,19 @@ very quickly. Please check the results. We would like these checks to pass befor even continue reviewing your changes. --> -#### What this PR does / why we need it: +#### What this PR does / why we need it #### Which issue this PR fixes + *(optional, in `fixes #(, fixes #, ...)` format, will close that issue when PR gets merged)* - - fixes # -#### Special notes for your reviewer: +- fixes # + +#### Special notes for your reviewer #### Checklist + [Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.] + - [ ] [DCO](https://github.com/helm/charts/blob/master/CONTRIBUTING.md#sign-your-work) signed -- [ ] Chart Version bumped - [ ] Variables are documented in the README.md diff --git a/.github/workflows/basic_test.yml b/.github/workflows/basic_test.yml deleted file mode 100644 index 74c041a..0000000 --- a/.github/workflows/basic_test.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Test - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - example: - name: Minikube installation - Basic test - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Minikube - uses: manusa/actions-setup-minikube@v2.7.2 - with: - minikube version: 'v1.28.0' - kubernetes version: 'v1.25.4' - github token: ${{ secrets.GITHUB_TOKEN }} - #- run: minikube addons list - #- name: Interact with the cluster - # run: kubectl get nodes - - name: Checkout code - uses: actions/checkout@v3 - - name: Install PostgreSQL - run: helm install postgresql . - - name: Check deployment status - run: | - kubectl rollout status --watch statefulset/postgresql --timeout=5m - - name: Wait for PostgreSQL database to start - run: | - for n in [ 0 1 2 3 4 5 6 7 8 9 ] - do - if kubectl logs pod/postgresql-0 | grep 'database system is ready to accept connections' - then - exit 0 - fi - sleep 30 - done - echo PostgreSQL did not start within 300 seconds! - exit 1 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..12bcf69 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,30 @@ +name: Lint & Test Chart + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + chart-testing: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + - name: Set up chart-testing + uses: helm/chart-testing-action@0d28d3144d3a25ea2cc349d6e59901c4ff469b3b # v2.7.0 + - name: Run lint check + id: lint + run: ct lint --target-branch ${{ github.event.repository.default_branch }} + - name: Create kind cluster + if: steps.lint.outcome == 'success' + uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0 + - name: Run chart-testing (install) + if: steps.lint.outcome == 'success' + run: | + ct install --target-branch ${{ github.event.repository.default_branch }} --helm-extra-args --timeout 180s diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..a94ff18 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,60 @@ +name: publish-postgresql-helm-chart + +on: + push: + branches: ['master'] + paths: + - 'templates/**' + - 'Chart.yaml' + +jobs: + build-and-push-postgresql-helm-chart-to-ghcr: + name: Build and push PostgreSQL Helm chart to GHCR + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + - name: Install Helm + uses: azure/setup-helm@v4 + - name: Package and upload chart + shell: bash + env: + REGISTRY: "ghcr.io" + REPOSITORY: "${{ github.repository }}" + TOKEN: "${{ secrets.GITHUB_TOKEN }}" + USER: "${{ github.repository_owner }}" + run: | + rm -rf dist + mkdir dist + helm package . -d dist/ + echo "${TOKEN}" | helm registry login "${REGISTRY}/${REPOSITORY,,}" -u "${USER}" --password-stdin + helm push dist/*.tgz "oci://${REGISTRY}/${REPOSITORY,,}/charts" + + build-and-push-postgresql-helm-chart-to-dockerhub: + name: Build and push PostgreSQL Helm chart to Docker Hub + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + - name: Install Helm + uses: azure/setup-helm@v4 + - name: Package chart + shell: bash + run: | + rm -rf dist + mkdir dist + helm package . -d dist/ + - name: Login and push to Docker Hub + shell: bash + env: + REGISTRY: "docker.io" + USERNAME: "${{ secrets.DOCKER_HUB_USERNAME }}" + PASSWORD: "${{ secrets.DOCKER_HUB_TOKEN }}" + REPOSITORY: "applause/postgresql" + run: | + echo "${PASSWORD}" | helm registry login "${REGISTRY}" -u "${USERNAME}" --password-stdin + helm push dist/*.tgz "oci://${REGISTRY}/${REPOSITORY}"