94 lines
3.6 KiB
YAML
94 lines
3.6 KiB
YAML
# Copyright (C) 2024 Intel Corporation
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
name: E2E test with GMC
|
|
|
|
on:
|
|
pull_request_target:
|
|
branches: [main]
|
|
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
|
|
paths:
|
|
- "**/kubernetes/**"
|
|
- "**/tests/test_gmc**"
|
|
- "!**.md"
|
|
- "!**.txt"
|
|
- "!**/kubernetes/manifests/**"
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
job1:
|
|
uses: ./.github/workflows/reuse-get-test-matrix.yml
|
|
with:
|
|
diff_excluded_files: '.github|deprecated|docker|assets|*.md|*.txt'
|
|
xeon_server_label: 'xeon'
|
|
gaudi_server_label: 'gaudi'
|
|
|
|
gmc-test:
|
|
needs: [job1]
|
|
strategy:
|
|
matrix: ${{ fromJSON(needs.job1.outputs.run_matrix) }}
|
|
runs-on: "k8s-${{ matrix.hardware }}"
|
|
continue-on-error: true
|
|
steps:
|
|
- name: E2e test gmc
|
|
run: |
|
|
echo "Matrix - gmc: ${{ matrix.example }}"
|
|
|
|
- name: Clean Up Working Directory
|
|
run: sudo rm -rf ${{github.workspace}}/*
|
|
|
|
- name: Checkout out Repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: "refs/pull/${{ github.event.number }}/merge"
|
|
|
|
- name: Set variables
|
|
run: |
|
|
if [ ${{ matrix.hardware }} == "gaudi" ]; then IMAGE_REPO=${{ vars.IMAGE_REPO_GAUDI }}; else IMAGE_REPO=${{ vars.IMAGE_REPO_XEON }}; fi
|
|
echo "IMAGE_REPO=$OPEA_IMAGE_REPO" >> $GITHUB_ENV
|
|
lower_example=$(echo "${{ matrix.example }}" | tr '[:upper:]' '[:lower:]')
|
|
echo "APP_NAMESPACE=$lower_example-$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
|
|
echo "ROLLOUT_TIMEOUT_SECONDS=1800s" >> $GITHUB_ENV
|
|
echo "KUBECTL_TIMEOUT_SECONDS=60s" >> $GITHUB_ENV
|
|
echo "continue_test=true" >> $GITHUB_ENV
|
|
echo "should_cleanup=false" >> $GITHUB_ENV
|
|
echo "APP_NAMESPACE=$APP_NAMESPACE"
|
|
|
|
- name: Run tests
|
|
id: run-test
|
|
env:
|
|
HUGGINGFACEHUB_API_TOKEN: ${{ secrets.HUGGINGFACEHUB_API_TOKEN }}
|
|
GOOGLE_CSE_ID: ${{ secrets.GOOGLE_CSE_ID }}
|
|
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
|
|
run: |
|
|
if [[ ! -f ${{ github.workspace }}/${{ matrix.example }}/tests/test_gmc_on_${{ matrix.hardware }}.sh ]]; then
|
|
echo "No test script found, exist test!"
|
|
exit 0
|
|
else
|
|
echo "should_cleanup=true" >> $GITHUB_ENV
|
|
${{ github.workspace }}/${{ matrix.example }}/tests/test_gmc_on_${{ matrix.hardware }}.sh install_${{ matrix.example }}
|
|
echo "Testing ${{ matrix.example }}, waiting for pod ready..."
|
|
if kubectl rollout status deployment --namespace "$APP_NAMESPACE" --timeout "$ROLLOUT_TIMEOUT_SECONDS"; then
|
|
echo "Testing gmc ${{ matrix.example }}, running validation test..."
|
|
${{ github.workspace }}/${{ matrix.example }}/tests/test_gmc_on_${{ matrix.hardware }}.sh validate_${{ matrix.example }}
|
|
else
|
|
echo "Timeout waiting for pods in namespace $APP_NAMESPACE to be ready!"
|
|
exit 1
|
|
fi
|
|
sleep 60
|
|
fi
|
|
|
|
- name: Kubectl uninstall
|
|
if: always()
|
|
run: |
|
|
if $should_cleanup; then
|
|
if ! kubectl delete ns $APP_NAMESPACE --timeout=$KUBECTL_TIMEOUT_SECONDS; then
|
|
kubectl delete pods --namespace $APP_NAMESPACE --force --grace-period=0 --all
|
|
kubectl delete ns $APP_NAMESPACE --force --grace-period=0 --timeout=$KUBECTL_TIMEOUT_SECONDS
|
|
fi
|
|
fi
|