mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-12-28 00:15:18 +00:00
nightly interop execution (#60)
* fix marker expression * switch to new interop marker
This commit is contained in:
140
.github/workflows/interop.yml
vendored
140
.github/workflows/interop.yml
vendored
@@ -20,10 +20,15 @@ env:
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
marker_expression:
|
||||
default: 'interop'
|
||||
description: 'Pytest marker expression that will be used to select the tests to execute'
|
||||
additional_markers:
|
||||
default: ''
|
||||
description: 'Pass additional markers that will be and-combined with the interop marker, e.g. "twog or fiveg" -> "interop and twog or fiveg"'
|
||||
required: false
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
schedule:
|
||||
- cron: '15 0 * * *'
|
||||
|
||||
defaults:
|
||||
run:
|
||||
@@ -62,6 +67,8 @@ jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ build ]
|
||||
outputs:
|
||||
additional_markers: ${{ steps.marker.outputs.additional }}
|
||||
steps:
|
||||
- name: get EKS access credentials
|
||||
run: aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }}
|
||||
@@ -75,12 +82,24 @@ jobs:
|
||||
id: job
|
||||
run: echo "::set-output name=name::interop-ci-${{ github.run_number }}"
|
||||
|
||||
# - name: create configuration.py secret
|
||||
# run: |
|
||||
# cat << EOF > configuration.py
|
||||
# ${{ secrets.LAB_CONFIGURATION }}
|
||||
# EOF
|
||||
# kubectl create secret generic configuration --from-file=configuration=./configuration.py
|
||||
- name: create configuration.py secret
|
||||
run: |
|
||||
cat << EOF > configuration.py
|
||||
${{ secrets.LAB_CONFIGURATION }}
|
||||
EOF
|
||||
kubectl create secret generic configuration --from-file=configuration=./configuration.py
|
||||
|
||||
- name: calculate marker expression
|
||||
id: marker
|
||||
run: |
|
||||
MARKER_EXPRESSION="interop"
|
||||
ADDITIONAL_MARKERS="${{ github.event.inputs.additional_markers || '' }}"
|
||||
if [ ! -z "$ADDITIONAL_MARKERS" ]; then
|
||||
MARKER_EXPRESSION="$MARKER_EXPRESSION and ${ADDITIONAL_MARKERS}"
|
||||
fi
|
||||
|
||||
echo "::set-output name=additional::${ADDITIONAL_MARKERS}"
|
||||
echo "::set-output name=expression::${MARKER_EXPRESSION}"
|
||||
|
||||
- name: run interop tests
|
||||
run: |
|
||||
@@ -101,7 +120,7 @@ jobs:
|
||||
- -c
|
||||
- |
|
||||
cd tests
|
||||
pytest -m "${{ github.event.inputs.marker_expression || 'interop' }}" -s -vvv --testbed=interop -o 'jobName=Github-Interop' -o 'jobNumber=${{ github.run_number }}' --skip-testrail --alluredir=/tmp/allure-results
|
||||
pytest -m "${{ steps.marker.outputs.expression }}" -s -vvv --testbed=interop -o 'jobName=Github-Interop' -o 'jobNumber=${{ github.run_number }}' --skip-testrail --alluredir=/tmp/allure-results
|
||||
ret=\$?
|
||||
# sleep some time to be able to download the Allure results
|
||||
sleep 60
|
||||
@@ -120,8 +139,13 @@ jobs:
|
||||
secretName: configuration
|
||||
backoffLimit: 0
|
||||
EOF
|
||||
sleep 60 # wait for the pod to come up
|
||||
# wait for pod to spawn
|
||||
sleep 1
|
||||
|
||||
podname=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" -l job-name="${{ steps.job.outputs.name }}" | sed "s/pod\///")
|
||||
|
||||
kubectl wait "pod/$podname" --for condition=ready
|
||||
|
||||
until [ -s test_everything.xml ]
|
||||
do
|
||||
sleep 10
|
||||
@@ -134,11 +158,13 @@ jobs:
|
||||
echo "waiting for pod to exit"
|
||||
kubectl logs -f $podname >/dev/null 2>&1
|
||||
exit $(kubectl get pod $podname --output="jsonpath={.status.containerStatuses[].state.terminated.exitCode}")
|
||||
|
||||
- name: print logs
|
||||
if: ${{ always() }}
|
||||
run: |
|
||||
podname=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" -l job-name="${{ steps.job.outputs.name }}" | sed "s/pod\///")
|
||||
kubectl logs $podname
|
||||
|
||||
- name: upload Allure results as artifact
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@v2
|
||||
@@ -146,19 +172,89 @@ jobs:
|
||||
name: allure-results
|
||||
path: allure-results
|
||||
|
||||
- name: generate Allure report
|
||||
if: ${{ always() }}
|
||||
run: allure-${{ env.ALLURE_CLI_VERSION }}/bin/allure generate
|
||||
|
||||
- name: upload Allure report as artifact
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: allure-report
|
||||
path: allure-report
|
||||
|
||||
- name: cleanup
|
||||
if: ${{ always() }}
|
||||
run: |
|
||||
kubectl delete job "${{ steps.job.outputs.name }}" --wait=true --ignore-not-found=true
|
||||
kubectl delete secret configuration --wait=true --ignore-not-found=true
|
||||
|
||||
report:
|
||||
needs: [ test ]
|
||||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: install Allure CLI tool
|
||||
run: |
|
||||
wget https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/${{ env.ALLURE_CLI_VERSION }}/allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz
|
||||
tar -xzf allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz
|
||||
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: allure-results
|
||||
path: allure-results
|
||||
|
||||
- name: checkout testing repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: wlan-testing
|
||||
|
||||
- name: get reports branch
|
||||
uses: actions/checkout@v2
|
||||
continue-on-error: true
|
||||
with:
|
||||
ref: gh-pages
|
||||
path: reports
|
||||
|
||||
- name: copy history into results
|
||||
run: |
|
||||
if [ -e "reports/interop/interop/latest" ] ; then
|
||||
cp -r reports/interop/interop/latest/history/ allure-results/history
|
||||
fi
|
||||
|
||||
- name: add report metadata
|
||||
run: |
|
||||
cat << EOF >> allure-results/environment.properties
|
||||
Testbed=interop
|
||||
Tests.CommitId=$(cd wlan-testing && git rev-parse --short HEAD)
|
||||
CiRun.Id=${{ github.run_id }}
|
||||
CiRun.Number=${{ github.run_number }}
|
||||
CiRun.Url=https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
|
||||
EOF
|
||||
|
||||
- name: generate Allure report
|
||||
run: allure-${{ env.ALLURE_CLI_VERSION }}/bin/allure generate
|
||||
|
||||
- name: upload Allure report as artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: allure-report
|
||||
path: allure-report
|
||||
|
||||
- name: copy new report
|
||||
run: |
|
||||
mkdir -p reports/interop/interop
|
||||
cp -Tr allure-report reports/interop/interop/${{ github.run_number }}
|
||||
|
||||
- name: update latest symlink
|
||||
working-directory: reports/interop/interop
|
||||
run: ln -fns ${{ github.run_number }} latest
|
||||
|
||||
- name: generate new index.html
|
||||
run: python wlan-testing/.github/tools/generate_directory_index.py -r reports
|
||||
|
||||
- name: commit reports update
|
||||
working-directory: reports
|
||||
run: |
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
git add .
|
||||
git commit -m "Automated deployment: $(date -u)"
|
||||
|
||||
- name: push
|
||||
if: github.ref == 'refs/heads/master' && needs.test.outputs.additional_markers == ''
|
||||
uses: ad-m/github-push-action@v0.6.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: gh-pages
|
||||
directory: reports
|
||||
|
||||
Reference in New Issue
Block a user