mirror of
https://github.com/element-hq/ess-helm.git
synced 2026-12-01 22:32:45 -08:00
78 lines
2.5 KiB
YAML
78 lines
2.5 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:
|
|
|
|
jobs:
|
|
pytest:
|
|
# /!!!!!!!!!!!!!\
|
|
# ~~~~WARNING~~~~
|
|
# This runner is highly-privileged and we can't go FOSS Until we redesign
|
|
# how we do CI tests
|
|
runs-on: dind-privileged-m
|
|
container:
|
|
image: ghcr.io/${{ github.repository }}/ci-runner
|
|
credentials:
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
test-component:
|
|
- element-web
|
|
- matrix-authentication-service
|
|
- synapse
|
|
- well-known-delegation
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
- name: Define a cache for the virtual environment based on the dependencies lock file
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ./.venv
|
|
key: venv-${{ hashFiles('poetry.lock') }}
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
poetry install
|
|
|
|
- name: Test with pytest
|
|
run: |
|
|
cp tests/integration/fixtures/files/clusters/audit-policy.yml /dind-job-shared/audit-policy.yml
|
|
. tests/integration/env/${{ matrix.test-component }}.rc
|
|
PYTEST_KEEP_CLUSTER=1 poetry run pytest 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")
|
|
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
|