Skip to content

Add labels for cronjob and queue #85

Add labels for cronjob and queue

Add labels for cronjob and queue #85

Workflow file for this run

name: Tests
on:
pull_request:
types: [opened, synchronize, reopened]
env:
helm: v3.16.2
python-version: 3.x
jobs:
linter:
name: Lint chart files
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: ${{ env.helm }}
- uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
- name: Set up chart-testing
uses: helm/chart-testing-action@v2
- name: Run chart-testing (lint)
run: ct lint --config ct.yaml --target-branch ${{ github.event.repository.default_branch }}
helm-tests:
runs-on: ubuntu-latest
name: Helm tests (${{ matrix.test_cases.name }}) (K8s ${{ matrix.kubectl }})
strategy:
fail-fast: false
matrix:
kubectl: [v1.16.0, v1.29.3]
test_cases:
- name: Default - no custom values
- name: PostgreSQL enabled
helm_args: '--set=internalDatabase.enabled=false --set=postgresql.enabled=true'
- name: Mariadb enabled
helm_args: '--set=internalDatabase.enabled=false --set=mariadb.enabled=true'
- name: Nodeport service enabled
helm_args: '--set=service.type=NodePort --set=service.nodePort=30001'
- name: nginx enabled
helm_args: '--set=nginx.enabled=true --set=image.tag=main-fpm'
- name: Horizontal Pod Autoscaling Enabled
helm_args: '--set=autoscaling.enabled=true --set=autoscaling.miniReplicas=2 --set=autoscaling.maxReplicas=3 --set=autoscaling.targetCPU=75 --set=autoscaling.targetMemory=75'
- name: Redis and queue enabled
file: redis.yaml
- name: Meilisearch and queue enabled
file: meilisearch.yaml
# - name: External database
# external_database: true
# file: external_database.yaml
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: ${{ env.helm }}
- uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
- name: Set up chart-testing
uses: helm/chart-testing-action@v2
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config ct.yaml --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Create kind cluster
uses: helm/kind-action@v1
if: steps.list-changed.outputs.changed == 'true'
with:
kubectl_version: ${{ matrix.kubectl }}
- name: Copy test case file
if: matrix.test_cases.file != ''
run: cp .github/tests/${{ matrix.test_cases.file }} charts/monica/ci/test-values.yaml
- name: Create mysql database
if: matrix.test_cases.external_database
run: |
sudo systemctl start mysql.service
mysql --protocol=tcp -u root -proot -e "CREATE DATABASE IF NOT EXISTS monica CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
hostname -I
IFS=' '
read -ra hostname <<< $(hostname -I)
DB_HOST=${hostname[1]}
sed -i "s/%DB_HOST%/$DB_HOST/" charts/monica/ci/test-values.yaml
- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --config ct.yaml --helm-extra-args '--timeout 600s' --target-branch ${{ github.event.repository.default_branch }} --helm-extra-set-args "${{ matrix.test_cases.helm_args }}"