refactor(ci): support python 3.8 to 3.12, fix pyupgrade, fix flake8, replace deprecated commands #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python test in k8s cluster | |
on: pull_request | |
jobs: | |
no-ha-cluster: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: Set up Helm | |
uses: azure/[email protected] | |
with: | |
version: v3.12.3 | |
- name: Set up Python '3.11' | |
uses: actions/[email protected] | |
with: | |
python-version: '3.11' | |
- name: Create k8s Kind Cluster | |
uses: helm/[email protected] | |
- name: Install Charts (in normal mode) | |
run: | | |
helm repo add bitnami https://charts.bitnami.com/bitnami | |
helm repo update | |
helm install my-postgresql bitnami/postgresql | |
helm install my-rabbitmq bitnami/rabbitmq | |
helm install my-redis bitnami/redis --set architecture=standalone | |
# wait all service is raidy | |
kubectl --namespace default wait pod/my-postgresql-0 --for=condition=Ready --timeout=2m | |
kubectl --namespace default wait pod/my-rabbitmq-0 --for=condition=Ready --timeout=2m | |
kubectl --namespace default wait pod/my-redis-master-0 --for=condition=Ready --timeout=2m | |
# postgresql | |
# my-postgresql.default.svc.cluster.local | |
export POSTGRES_PASSWORD=$(kubectl get secret --namespace default my-postgresql -o jsonpath="{.data.postgres-password}" | base64 -d) | |
kubectl port-forward --namespace default svc/my-postgresql 5432:5432 & | |
# rabbitmq | |
# my-rabbitmq.default.svc.cluster.local | |
echo "Username : user" | |
echo "Password : $(kubectl get secret --namespace default my-rabbitmq -o jsonpath="{.data.rabbitmq-password}" | base64 -d)" | |
echo "ErLang Cookie : $(kubectl get secret --namespace default my-rabbitmq -o jsonpath="{.data.rabbitmq-erlang-cookie}" | base64 -d)" | |
# redis | |
# my-redis-master.default.svc.cluster.local | |
export REDIS_PASSWORD=$(kubectl get secret --namespace default my-redis -o jsonpath="{.data.redis-password}" | base64 -d) | |
kubectl port-forward --namespace default svc/my-redis-master 6379:6379 & | |
# REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h my-redis-master | |
# test | |
ha-cluster: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: Set up Helm | |
uses: azure/[email protected] | |
with: | |
version: v3.12.3 | |
- name: Set up Python '3.11' | |
uses: actions/[email protected] | |
with: | |
python-version: '3.11' | |
- name: Create k8s Kind Cluster | |
uses: helm/[email protected] | |
- name: Install Charts (in ha mode) | |
run: | | |
helm repo add bitnami https://charts.bitnami.com/bitnami | |
helm repo update | |
helm install my-postgresql bitnami/postgresql | |
helm install my-rabbitmq bitnami/rabbitmq | |
helm install my-redis bitnami/redis --set sentinel.enabled=true | |
# wait all service is raidy | |
kubectl --namespace default wait pod/my-redis-node-0 --for=condition=Ready --timeout=2m | |
kubectl --namespace default wait pod/my-redis-node-1 --for=condition=Ready --timeout=2m | |
kubectl --namespace default wait pod/my-redis-node-2 --for=condition=Ready --timeout=2m | |
# bidule | |
export REDIS_PASSWORD=$(kubectl get secret --namespace default my-redis -o jsonpath="{.data.redis-password}" | base64 -d) | |
kubectl port-forward --namespace default svc/my-redis 6379:6379 26379:26379 & |