report overview generation (#375)

* automate overview page deployment
* document overview page in README
This commit is contained in:
Max
2022-02-01 13:15:34 +01:00
committed by GitHub
parent 00434f835d
commit e8d7b725b4
5 changed files with 132 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
import json
import os
import pathlib
import string
import sys
base = pathlib.Path(os.path.dirname(os.path.abspath(__file__)))
def main():
with open(base / 'index.html', 'r') as f:
overview_template = string.Template(f.read())
with open(base / 'overviews.json', 'r') as f:
overview_config = json.load(f)[sys.argv[1]]
print(overview_template.safe_substitute(**overview_config))
if __name__ == '__main__':
main()

View File

@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-[#29818c] text-white font-mono">
<header class="relative flex items-center justify-between overflow-hidden">
<div class="basis-1/3">
<img class="max-w-xs max-h-20" src="https://raw.githubusercontent.com/Telecominfraproject/wlan-cloud-ucentralgw-ui/main/src/assets/OpenWiFi_LogoLockup_WhiteColour.svg" alt="">
</div>
<p id="title" class="text-2xl text-center basis-1/3"></p>
<div class="basis-1/3"></div>
</header>
<div id="reports" class="grid grid-cols-1 xl:grid-cols-2 gap-x-6 gap-y-3 auto-rows-auto h-fit"></div>
<script>
const title = $OVERVIEW_TITLE
const testbeds = $OVERVIEW_TESTBEDS
const titleContainer = document.getElementById('title')
titleContainer.innerText = title
const reportContainer = document.getElementById('reports')
testbeds.forEach(testbed => {
const iframe = document.createElement('iframe')
iframe.setAttribute('src', `../${testbed}/latest`)
iframe.setAttribute('loading', 'lazy')
iframe.classList.add('w-full', 'min-h-[480px]')
const caption = document.createElement('a')
caption.href = `../${testbed}`
caption.innerText = testbed
const captionDiv = document.createElement('div')
captionDiv.classList.add('text-sm', 'text-center', 'underline')
captionDiv.appendChild(caption)
const column = document.createElement('div')
column.classList.add('flex', 'flex-col')
column.appendChild(captionDiv)
column.appendChild(iframe)
reportContainer.appendChild(column)
});
</script>
</body>
</html>

View File

@@ -0,0 +1,20 @@
{
"sanity": {
"OVERVIEW_TITLE": "'OpenWifi sanity results'",
"OVERVIEW_TESTBEDS": ["hfcl_ion4","tp-link_ec420-g1","edgecore_ecw5410","edgecore_ecw5211","edgecore_eap101","edgecore_eap102","cig_wf194c","cig_wf188n","indio_um-305ac"]
},
"interop": {
"OVERVIEW_TITLE": "'OpenWifi interop results'",
"OVERVIEW_TESTBEDS": ["pixel-4","galaxy-s9","galaxy-s10","galaxy-s20","iphone-xr","iphone-7","iphone-11","iphone-12"]
},
"advanced": {
"OVERVIEW_TITLE": "'OpenWifi advanced results'",
"OVERVIEW_TESTBEDS": ["advanced-01","advanced-02"]
},
"performance": {
"OVERVIEW_TITLE": "'OpenWifi performance results'",
"OVERVIEW_TESTBEDS": ["basic-01","basic-02","basic-03","basic-04","basic-05","basic-06","basic-07","basic-08"]
}
}

36
.github/workflows/update-overviews.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: Update test report overview pages
on:
push:
paths:
- ".allure-overview/**"
jobs:
update_overview:
strategy:
fail-fast: false
matrix:
test_type: ['sanity', 'interop', 'advanced', 'performance']
runs-on: ubuntu-latest
container: python:3.8
steps:
- uses: actions/checkout@v2
- name: generate overview page
run: |
python .allure-overview/generate_overview.py ${{ matrix.test_type }} > index.html
cat index.html
- name: upload overview page
if: github.ref == 'refs/heads/master'
env:
AWS_S3_BUCKET_NAME: openwifi-allure-reports
AWS_ACCOUNT_ID: "289708231103"
AWS_ACCESS_KEY_ID: ${{ secrets.ALLURE_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ALLURE_S3_ACCESS_KEY_SECRET }}
AWS_DEFAULT_REGION: us-east-1
AWS_DEFAULT_OUTPUT: json
run: aws s3 cp --acl public-read --content-type text/html index.html s3://${AWS_S3_BUCKET_NAME}/${{ matrix.test_type }}/overview/index.html

View File

@@ -47,7 +47,11 @@ Using Swagger Autogenerated CloudSDK Library pypi package (implemented with [swa
### Reporting
Currently the plan is to use pytest integrated with [allure](https://docs.qameta.io/allure/#_pytest) to create visual reports for the test outcomes
Currently we use the [pytest allure integration](https://docs.qameta.io/allure/#_pytest) to create visual reports for the test outcomes.
Additionally we generate overview pages, e.g. like [this one](http://openwifi-allure-reports.s3-website-us-east-1.amazonaws.com/sanity/overview/) to consolidate multiple test reports of the same test type.
These overview pages are being deployed by [this workflow](.github/workflows/update-overviews.yml) and their configuration is set in [this file](./.allure-overview/overviews.json).
### Miscellaneous