mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-12-25 23:17:03 +00:00
Signed-off-by: Dmitry Dunaev <dmitry@opsfleet.com> Signed-off-by: Dmitry Dunaev <dmitry@opsfleet.com>
186 lines
6.0 KiB
YAML
186 lines
6.0 KiB
YAML
name: advanced testing
|
|
|
|
env:
|
|
AWS_EKS_NAME: tip-wlan-main
|
|
AWS_DEFAULT_OUTPUT: json
|
|
AWS_DEFAULT_REGION: us-east-2
|
|
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CLIENT_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CLIENT_KEY }}
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tests_release:
|
|
required: false
|
|
default: ""
|
|
description: "Tests release branch to use (i.e. 'release/v2.8.0' or 'master'). If left empty, latest release branch is used"
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
vars:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
tests_release: ${{ steps.vars.outputs.tests_release }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: set variables
|
|
id: vars
|
|
run: |
|
|
LATEST_TESTS_RELEASE=$(git branch -r | grep 'release/v' | sed 's!\s*origin/!!' | tail -1)
|
|
if [[ -z "${{ github.event.inputs.tests_release }}" ]]; then
|
|
echo "Tests release was not passed, using branch $LATEST_TESTS_RELEASE"
|
|
echo "tests_release=$LATEST_TESTS_RELEASE" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "Tests release was passed - ${{ github.event.inputs.tests_release }}"
|
|
echo "tests_release=${{ github.event.inputs.tests_release }}" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
needs: ["vars"]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ needs.vars.outputs.tests_release }}
|
|
- name: build and push Docker image
|
|
uses: ./.github/actions/build-and-push-docker
|
|
with:
|
|
registry: tip-tip-wlan-cloud-docker-repo.jfrog.io
|
|
registry_user: ${{ secrets.DOCKER_USER_NAME }}
|
|
registry_password: ${{ secrets.DOCKER_USER_PASSWORD }}
|
|
|
|
test:
|
|
runs-on: [ self-hosted, small ]
|
|
needs: [ build ]
|
|
timeout-minutes: 1440
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
testbed:
|
|
- advanced-01
|
|
- advanced-02
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: install aws CLI tool
|
|
run: |
|
|
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
|
|
unzip awscliv2.zip
|
|
sudo ./aws/install
|
|
|
|
- name: install kubectl
|
|
run: |
|
|
# TODO WIFI-7839 revert to using stable when issue is resolved on AWS CLI side
|
|
curl -LO "https://dl.k8s.io/release/v1.23.6/bin/linux/amd64/kubectl"
|
|
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
|
|
|
|
- name: get EKS access credentials
|
|
run: aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }}
|
|
|
|
- name: prepare namespace
|
|
id: namespace
|
|
run: |
|
|
NAMESPACE="testing-${{ github.run_number }}-${{ matrix.testbed }}"
|
|
echo "name=${NAMESPACE}" >> $GITHUB_OUTPUT
|
|
|
|
- name: run tests
|
|
uses: ./.github/actions/run-tests
|
|
with:
|
|
namespace: ${{ steps.namespace.outputs.name }}
|
|
testbed: ${{ matrix.testbed }}
|
|
marker_expression: advance
|
|
configuration: "${{ secrets.LAB_CONFIGURATION_JSON }}"
|
|
testing_docker_image: tip-tip-wlan-cloud-docker-repo.jfrog.io/cloud-sdk-nightly:${{ github.run_id }}
|
|
allure_results_artifact_name: allure-results-${{ matrix.testbed }}
|
|
|
|
# necessary because if conditionals in composite actions are currently not respected
|
|
- name: get tests logs
|
|
if: always()
|
|
continue-on-error: true
|
|
run: |
|
|
podname=$(kubectl get pods -n ${{ steps.namespace.outputs.name }} --no-headers -o custom-columns=":metadata.name" -l job-name=testing | sed "s/pod\///")
|
|
kubectl logs --timestamps -n ${{ steps.namespace.outputs.name }} $podname || true
|
|
|
|
- name: delete namespace
|
|
if: always()
|
|
continue-on-error: true
|
|
run: kubectl delete ns --ignore-not-found=true --wait ${{ steps.namespace.outputs.name }}
|
|
|
|
report:
|
|
needs: [ test ]
|
|
if: always()
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
testbed:
|
|
- advanced-01
|
|
- advanced-02
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: allure-results-${{ matrix.testbed }}
|
|
path: allure-results
|
|
|
|
- name: download history of previous run
|
|
continue-on-error: true
|
|
env:
|
|
AWS_EKS_NAME: tip-wlan-main
|
|
AWS_DEFAULT_OUTPUT: json
|
|
AWS_DEFAULT_REGION: us-east-2
|
|
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CLIENT_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CLIENT_KEY }}
|
|
run: |
|
|
LAST_RUN_ID=$(aws s3api head-object --bucket openwifi-allure-reports --key advanced/${{ matrix.testbed }}/latest/index.html | jq -r .Metadata.latest)
|
|
aws s3 cp --recursive s3://openwifi-allure-reports/advanced/${{ matrix.testbed }}/$LAST_RUN_ID/history history
|
|
|
|
- name: generate Allure report
|
|
uses: ./.github/actions/generate-allure-report
|
|
with:
|
|
results_path: ./allure-results
|
|
history_path: ./history
|
|
additional_metadata: |
|
|
Testbed=${{ matrix.testbed }}
|
|
|
|
- name: upload Allure report as artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: allure-report-${{ matrix.testbed }}
|
|
path: allure-report
|
|
|
|
# doing this to be able to aggregate multiple reports together later on
|
|
- name: copy results into report
|
|
run: cp -r allure-results allure-report/results
|
|
|
|
- name: upload to S3
|
|
if: github.ref == 'refs/heads/master'
|
|
uses: ./.github/actions/allure-report-to-s3
|
|
with:
|
|
test_type: advanced
|
|
testbed: ${{ matrix.testbed }}
|
|
report_path: allure-report
|
|
s3_access_key_id: ${{ secrets.ALLURE_S3_ACCESS_KEY_ID }}
|
|
s3_access_key_secret: ${{ secrets.ALLURE_S3_ACCESS_KEY_SECRET }}
|
|
|
|
cleanup:
|
|
needs: [ test ]
|
|
runs-on: ubuntu-latest
|
|
if: always()
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: cleanup Docker image
|
|
uses: ./.github/actions/cleanup-docker
|
|
with:
|
|
registry_user: ${{ secrets.DOCKER_USER_NAME }}
|
|
registry_password: ${{ secrets.DOCKER_USER_PASSWORD }}
|