v2 Integration Tests #140
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Integration Tests | |
# Build aiverify and run QA test suites | |
name: v2 Integration Tests | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
on: | |
# Run this workflow everyday at 11:05pm Singapore Time (15:05am UTC) | |
schedule: | |
- cron: "05 15 * * *" | |
# 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: automated-testing | |
cancel-in-progress: false | |
jobs: | |
Integration-Test: | |
# Run only on Workflow Dispatch and Schedule | |
runs-on: self-hosted-aiverify | |
timeout-minutes: 120 | |
permissions: | |
id-token: write | |
contents: read | |
packages: write | |
steps: | |
# Setup Python | |
- name: Setup Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
# Change Existing File Permissions For Later Removal During Checkout of AI Verify | |
- name: Change Existing File Permissions From Previous Runs | |
run: | | |
sudo chmod -R 777 . | |
# Checkout AI Verify | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
repository: aiverify-foundation/aiverify | |
# Checkout Integration Test Code | |
- name: Checkout Integration Test Code | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
repository: aiverify-foundation/aivt-integration-testing | |
path: integration-testing | |
# Log in to GitHub Container Registry (ghcr.io), needed by Github Actions to access ghcr.io | |
- name: Login to GHCR | |
run: | | |
echo "${{ env.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin | |
# Clean slate to force rebuild all images | |
- name: Delete all local Docker images | |
run: | | |
docker ps -q | xargs -r docker stop | |
docker images -q | xargs -r docker rmi -f | |
docker system prune -a -f | |
docker volume prune --all -f | |
docker builder prune -a -f | |
# Launch containers in Docker Compose | |
- name: Run images in Docker Compose | |
run: | | |
cd deployment/docker-compose-dev | |
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose --profile automated-tests-venv --profile portal up -d | |
echo "Initialising AI Verify Plugins" | |
sleep 5m | |
# Prepare Integration Test Data | |
- name: Prepare Integration Test Data | |
run: | | |
sudo apt-get install zip -y | |
echo "Preparing Integration Test Data" | |
rm -rf stock-plugins/user_defined_files/data | |
rm -rf stock-plugins/user_defined_files/model | |
rm -rf stock-plugins/user_defined_files/pipeline | |
cp -r integration-testing/test-data/data stock-plugins/user_defined_files/data | |
cp -r integration-testing/test-data/model stock-plugins/user_defined_files/model | |
cp -r integration-testing/test-data/pipeline stock-plugins/user_defined_files/pipeline | |
cp -r integration-testing/test-data/template stock-plugins/user_defined_files/template | |
cp -r integration-testing/test-data/checklist stock-plugins/user_defined_files/checklist | |
cp -r integration-testing/test-data/test_results stock-plugins/user_defined_files/test_results | |
cp -r third-party-plugins stock-plugins/user_defined_files/third-party-plugins | |
cp -r integration-testing/test-data/plugins/corrupted.zip stock-plugins/user_defined_files/third-party-plugins/cccs_plugins | |
cd stock-plugins/user_defined_files/third-party-plugins/cccs_plugins/ | |
zip -r cccs_explainability_2.0.zip cccs_explainability_2.0 | |
zip -r cccs_fairness_classification_2.0.zip cccs_fairness_classification_2.0 | |
zip -r cccs_process_checklist.zip cccs_process_checklist | |
zip -r cccs_report_template.zip cccs_report_template | |
cd ../../veritas_data | |
mkdir cs_model test_files | |
cp cs_model.pkl cs_model | |
cp mktg_uplift_acq_dict.pickle test_files | |
cd ../ | |
echo "Review Test Data Directory" | |
ls -la | |
echo "Integration Test Data Prepared" | |
# Run UI Integration Test | |
- name: Run UI Integration Test | |
run: | | |
cd integration-testing | |
npm install | |
npx playwright install --with-deps | |
URL=http://127.0.0.1 PORT_NUMBER=3000 ROOT_PATH=$GITHUB_WORKSPACE/stock-plugins/user_defined_files npx playwright test tests/portal | |
# Upload Playwright Traces | |
- name: Upload Playwright Traces | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: playwright-trace-v2.0-integration-testing-${{ github.run_id }} | |
path: | | |
${{ github.workspace }}/integration-testing/test-results/ | |
# Run API Integration Test | |
- name: Run API Integration Test | |
if: always() | |
run: | | |
cd integration-testing | |
npm install | |
npx playwright install --with-deps | |
URL=http://127.0.0.1 PORT_NUMBER=4000 ROOT_PATH=$GITHUB_WORKSPACE/stock-plugins/user_defined_files npx playwright test tests/apigw | |
# Run Standalone Plugin Integration Test | |
# - name: Run Standalone Plugin Integration Test | |
# if: always() | |
# run: | | |
# cd integration-testing/tests/standalone-plugins | |
# python -m venv .venv | |
# source .venv/bin/activate | |
# pip install pytest requests | |
# pytest -vv | |
# shell: bash |