Skip to content

Integration Tests for aiverify-user (Docker) #163

Integration Tests for aiverify-user (Docker)

Integration Tests for aiverify-user (Docker) #163

# Integration Tests
# Build aiverify docker image and run QA test suites
name: Integration Tests for aiverify-user (Docker)
on:
# Runs when a pull request review is being submitted
pull_request_review:
types: [submitted]
branches:
- 'main'
- 'v0.*'
# Run this workflow manually from Actions tab
workflow_dispatch:
inputs:
branch_to_test:
description: 'Branch or tag to run test'
required: true
default: 'main'
type: string
# Allow one concurrent deployment
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
integration-tests-docker:
runs-on: ubuntu-latest
timeout-minutes: 100
steps:
- name: Checkout Code (Workflow_Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch_to_test }}
- name: Checkout Code (Pull_Request_Review)
if: github.event_name == 'pull_request_review'
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
submodules: recursive
- name: Build AI Verify Docker Image (Workflow_Dispatch)
if: github.event_name == 'workflow_dispatch'
working-directory: ${{ github.workspace }}/setup-aiverify
run: |
cd aiverify-user
echo ${{ inputs.branch_to_test }}
bash docker-build.sh --build-arg=BRANCH_TAG=${{ inputs.branch_to_test }}
- name: Build AI Verify Docker Image (Pull_Request_Review)
if: github.event_name == 'pull_request_review'
working-directory: ${{ github.workspace }}/setup-aiverify
run: |
cd aiverify-user
echo ${{ inputs.branch_to_test }}
bash docker-build.sh --build-arg=BRANCH_TAG=${{ github.event.pull_request.head.ref }} --build-arg=REPO=${{ github.event.pull_request.head.repo.full_name }}
- name: Run aiverify containers
working-directory: ${{ github.workspace }}/setup-aiverify
run: |
cd aiverify-user
mkdir -m 777 -p ../../uploads/data
mkdir -m 777 -p ../../uploads/model
# Modify docker-compose.yml to support integration-tests (frontend, backend)
sed -i -e 's/redis:6.2-alpine/redis:6.2-alpine\n ports:\n - "6379:6379"/g' docker-compose.yml
sed -i -e 's/mongo:6.0.4/mongo:6.0.4\n ports:\n - "27017:27017"/g' docker-compose.yml
sed -i -e 's/- uploads-data-volume:/- \.\.\/\.\.\/uploads\/data:/g' docker-compose.yml
sed -i -e 's/- uploads-model-volume:/- \.\.\/\.\.\/uploads\/model:/g' docker-compose.yml
sed -i -e 's/ uploads-data-volume://g' docker-compose.yml
sed -i -e 's/ uploads-model-volume://g' docker-compose.yml
cat docker-compose.yml
mkdir -m 777 -p ~/data/db
mkdir -m 777 -p ~/logs/db
if ! docker-compose up -d ; then
docker-compose up -d
fi
- name: Checkout API Mock Server
uses: actions/checkout@v3
with:
repository: IMDA-BTG/api-model-server
ref: main
path: qa-test/api-model-server
- name: Checkout smoke tests
uses: actions/checkout@v3
with:
repository: IMDA-BTG/smoke-testing
ref: main
path: qa-test/smoke-testing
submodules: recursive
- name: Checkout frontend tests
uses: actions/checkout@v3
with:
repository: IMDA-BTG/frontend-testing
ref: main
path: qa-test/frontend-testing
submodules: recursive
- name: Checkout backend tests
uses: actions/checkout@v3
with:
repository: IMDA-BTG/backend-testing
ref: main
path: qa-test/backend-testing
submodules: recursive
- name: Run API Mock Server
if: ${{ ! cancelled() }}
run: |
cd qa-test/api-model-server
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
bash regression_run_https.sh && fg &
bash classification_run_https.sh &
- name: Run smoke tests
if: ${{ ! cancelled() }}
run: |
cd qa-test/smoke-testing
npm install
npx playwright install
ENVIRONMENT_URL=https://host.docker.internal npx playwright test
- name: Run frontend tests
if: ${{ ! cancelled() }}
run: |
cd qa-test/frontend-testing
npm install
ENVIRONMENT_URL=https://host.docker.internal npx playwright test
# - name: Run backend tests
# if: ${{ ! cancelled() }}
# run: |
# cd qa-test/backend-testing
# npm install
# BASEDIR=${{ github.workspace }} npx playwright test
- name: Show logs
if: ${{ ! cancelled() }}
working-directory: ${{ github.workspace }}/setup-aiverify
run: |
cd aiverify-user
echo "================= Start of test-engine log ================="
docker-compose logs -t test-engine
echo "================= Start of portal/apigw log ================="
docker-compose logs -t portal