mirror of
https://github.com/element-hq/ess-helm.git
synced 2026-11-21 17:41:44 -08:00
101 lines
2.9 KiB
YAML
101 lines
2.9 KiB
YAML
# Copyright 2024 New Vector Ltd
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
|
|
name: Run Pytest tests
|
|
|
|
on:
|
|
pull_request_target:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: read
|
|
|
|
env:
|
|
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
GHCR_USERNAME: ${{ github.actor }}
|
|
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
jobs:
|
|
pytest:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
test-component:
|
|
- element-web
|
|
- matrix-authentication-service
|
|
- synapse
|
|
- well-known-delegation
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
- uses: matrix-org/setup-python-poetry@gaelg/poetry-venv
|
|
with:
|
|
poetry-version: "1.8.5"
|
|
python-version: "3.x"
|
|
|
|
- name: Load poetry path
|
|
run: |
|
|
echo "$(poetry env info -p)/bin" >> "${GITHUB_PATH}"
|
|
|
|
- name: Login to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Login to Dockerhub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: docker.io
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- uses: engineerd/[email protected]
|
|
with:
|
|
version: "v0.25.0"
|
|
name: "ess-helm"
|
|
skipClusterCreation: "true"
|
|
skipClusterLogsExport: "true"
|
|
|
|
|
|
- uses: azure/[email protected]
|
|
|
|
- name: Test with pytest
|
|
run: |
|
|
. tests/integration/env/${{ matrix.test-component }}.rc
|
|
PYTEST_KEEP_CLUSTER=1 poetry run pytest -vv tests/integration
|
|
|
|
- name: Export logs
|
|
if: ${{ failure() }}
|
|
shell: bash
|
|
run: |
|
|
kind export logs --name ess-helm ./ess-helm-logs
|
|
kind export kubeconfig --name ess-helm
|
|
ns=$(kubectl --context kind-ess-helm get ns -l app.kubernetes.io/managed-by=pytest -o jsonpath='{.items[].metadata.name}')
|
|
resources=("pods" "deployments" "statefulsets" "services" "configmaps" "secrets" "ingresses" "persistentvolumes" "persistentvolumeclaims" "endpoints")
|
|
for i in "${resources[@]}"; do
|
|
kubectl --context kind-ess-helm get $i -n $ns > ./ess-helm-logs/$i.txt
|
|
echo "----" >> ./ess-helm-logs/$i.txt
|
|
kubectl --context kind-ess-helm get $i -o yaml -n $ns >> ./ess-helm-logs/$i.txt
|
|
done
|
|
kubectl --context kind-ess-helm get events --sort-by=.metadata.creationTimestamp -n $ns > ./ess-helm-logs/events.txt
|
|
kind delete cluster --name ess-helm
|
|
|
|
- name: Upload logs
|
|
if: ${{ failure() }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ess-helm-logs-${{ matrix.test-component }}
|
|
path: ess-helm-logs
|
|
retention-days: 1
|