Skip to content

Commit

Permalink
Add CI for Helm Release/Test
Browse files Browse the repository at this point in the history
  • Loading branch information
endersonmaia committed Jul 11, 2022
1 parent aac4517 commit 60b096c
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Lint and Test Charts

on: pull_request

jobs:
lint-test:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Configure test-values
env:
MNEMONIC: ${{ secrets.MNEMONIC }}
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
TEST_VALUES_PATH: ./charts/rollups-validator-node/ci/test-values.yaml
run: cat $TEST_VALUES_PATH.tpl | envsubst > $TEST_VALUES_PATH

- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.8.1

- uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.2.1
with:
version: v3.6.0

- 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 "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: ct lint --target-branch ${{ github.event.repository.default_branch }}

- name: Create kind cluster
uses: helm/kind-action@v1.3.0
if: steps.list-changed.outputs.changed == 'true'

- name: Install postgres service to kind cluster
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install postgresql bitnami/postgresql \
--namespace default \
--wait \
--set auth.postgresPassword=postgres
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Create regcred Kubernetes Secret
run: |
kubectl create secret generic --namespace=default regcred \
--from-file=.dockerconfigjson=$HOME/.docker/config.json \
--type=kubernetes.io/dockerconfigjson
- name: Run chart-testing (install)
run: |
ct install \
--debug \
--namespace default \
--target-branch ${{ github.event.repository.default_branch }}
25 changes: 25 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release Charts

on:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.4.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

0 comments on commit 60b096c

Please sign in to comment.