On new public releases, tag image with release version too #2914
Workflow file for this run
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: E2E Tests | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
e2e-k8s-cluster: | |
# | |
# E2E tests run against a Kubernetes cluster. | |
# These tests setup microk8s and run NucliaDB with PostgreSQL. | |
# Chart configuration: e2e/conf/chart.values.yaml | |
# | |
name: E2E Kubernetes Cluster Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Ubuntu | |
# see if this is affecting microk8s | |
run: | | |
sudo ufw disable | |
sudo iptables -P FORWARD ACCEPT | |
- uses: balchua/[email protected] | |
with: | |
channel: '1.27/stable' | |
devMode: 'true' | |
addons: '["dns", "rbac", "hostpath-storage", "registry", "helm", "storage"]' | |
- name: "Set up Helm" | |
uses: azure/setup-helm@v3 | |
- name: Install PostgreSQL with Helm | |
run: | | |
helm repo add bitnami https://charts.bitnami.com/bitnami | |
helm install my-postgresql bitnami/postgresql --version 12.9.0 | |
- name: Wait for PostgreSQL to be ready | |
run: | | |
kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=postgresql,app.kubernetes.io/instance=my-postgresql | |
- name: PG Password | |
id: envs | |
run: |- | |
PGPASSWORD=`kubectl get secret --namespace default my-postgresql -o jsonpath="{.data.postgres-password}" | base64 -d` | |
echo "PGPASSWORD=$PGPASSWORD" >> $GITHUB_OUTPUT | |
- name: Build and push image | |
run: | | |
docker build -t localhost:32000/nucliadb:test . | |
docker push localhost:32000/nucliadb:test | |
- name: Install NucliaDB with Helm | |
run: | | |
kubectl create namespace nucliadb | |
helm install nucliadb charts/nucliadb \ | |
--timeout 5m \ | |
--namespace nucliadb \ | |
--values e2e/conf/chart.values.yaml \ | |
--set "env.DRIVER_PG_URL=postgresql://postgres:${{ steps.envs.outputs.PGPASSWORD }}@my-postgresql.default.svc.cluster.local:5432/postgres" \ | |
--set "env.NUA_API_KEY=${{ secrets.NUA_API_KEY }}" | |
sleep 10 | |
kubectl -n nucliadb wait --timeout=2m --for=condition=Ready pod -l statefulset.kubernetes.io/pod-name=nucliadb-0 || ( | |
kubectl get all --all-namespaces | |
microk8s inspect && | |
kubectl logs -n nucliadb pod/nucliadb-0 && | |
kubectl logs -n nucliadb pod/nucliadb-1 && | |
exit 1) | |
kubectl -n nucliadb wait --timeout=1m --for=condition=Ready pod -l statefulset.kubernetes.io/pod-name=nucliadb-1 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
cache: "pip" | |
- name: Install test deps | |
run: pip install -r e2e/requirements.txt | |
- name: Run tests | |
run: | | |
kubectl port-forward -n nucliadb service/nucliadb 8080:8080 & | |
sleep 10 | |
pytest -s --tb=native e2e/test_e2e.py || | |
(kubectl get all --all-namespaces && | |
microk8s inspect && | |
kubectl logs -n nucliadb pod/nucliadb-0 && | |
kubectl logs -n nucliadb pod/nucliadb-1 && | |
exit 1) | |
e2e-vm-cluster: | |
runs-on: ubuntu-latest | |
name: E2E VM Cluster Tests | |
strategy: | |
matrix: | |
ostypes: ["debian:bookworm-slim", "fedora:38"] | |
container: | |
image: ${{ matrix.ostypes }} | |
volumes: | |
- /opt/ | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres | |
# Provide the password for postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
ports: | |
- 5432:5432 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install NucliaDB | |
# tests that installation script works | |
run: | | |
./scripts/install-vm.sh | |
- name: Install local nucliadb | |
# Now, let's install the current version of nucliadb to | |
# run the tests against. | |
# Unfortunately, we're not testing against the released version | |
# of NucliaDB; however, it seems more important to test against | |
# the current branch. | |
run: | | |
bash -c 'source /opt/nucliadb/bin/activate && make -C nucliadb install-dev' | |
- name: Run Cluster and tests | |
env: | |
DRIVER: PG | |
FILE_BACKEND: PG | |
DRIVER_PG_URL: postgresql://postgres:postgres@postgres:5432/postgres | |
NUCLIA_PUBLIC_URL: https://{zone}.stashify.cloud | |
cluster_discovery_mode: manual | |
cluster_discovery_manual_addresses: '["localhost:10009","localhost:10010"]' | |
DEBUG: "1" | |
NUA_API_KEY: ${{ secrets.NUA_API_KEY }} | |
NUCLIADB_DISABLE_ANALYTICS: "True" | |
run: bash e2e/run-e2e-tests.sh |