Skip to content

Commit

Permalink
Merge pull request #281 from IMDA-BTG/test-for-release-v0.10.2
Browse files Browse the repository at this point in the history
Test & Merge for Release v0.10.2

The requested reviews are Approved. Proceeded to merge PR to Main.
  • Loading branch information
imda-benedictlee authored Apr 17, 2024
2 parents d48d624 + f8c2591 commit ce32b74
Show file tree
Hide file tree
Showing 121 changed files with 6,373 additions and 5,493 deletions.
111 changes: 63 additions & 48 deletions .github/workflows/integration-tests-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,39 @@ jobs:
integration-tests-docker:

runs-on: ubuntu-latest
timeout-minutes: 40
timeout-minutes: 100

steps:

- name: Checkout code
- name: Checkout Code (Workflow_Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch_to_test }}
sparse-checkout: |
setup-aiverify

- name: Build aiverify docker image
- 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
bash docker-build.sh --build-arg=BRANCH_TAG=${{ inputs.branch_to_test }} --build-arg=ALLOWED_ORIGINS="http://localhost:3000,http://localhost:4000,http://127.0.0.1:3000,http://127.0.0.1:4000,http://127.0.0.1:27017"
echo ${{ inputs.branch_to_test }}
bash docker-build.sh --build-arg=BRANCH_TAG=${{ github.event.pull_request.head.ref }}
- name: Run aiverify containers
working-directory: ${{ github.workspace }}/setup-aiverify
Expand All @@ -72,63 +89,61 @@ jobs:
docker-compose up -d
fi

# - name: Checkout API Mock Server
# uses: actions/checkout@v3
# with:
# repository: IMDA-BTG/api-model-server
# token: ${{ secrets.CHECKOUT_TOKEN }}
# ref: main
# path: qa-test/api-model-server

# - name: Checkout smoke tests
# uses: actions/checkout@v3
# with:
# repository: IMDA-BTG/smoke-testing
# token: ${{ secrets.CHECKOUT_TOKEN }}
# ref: main
# path: qa-test/smoke-testing
- 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
token: ${{ secrets.CHECKOUT_TOKEN }}
ref: main
path: qa-test/frontend-testing
submodules: recursive

# - name: Checkout backend tests
# uses: actions/checkout@v3
# with:
# repository: IMDA-BTG/backend-testing
# token: ${{ secrets.CHECKOUT_TOKEN }}
# ref: main
# path: qa-test/backend-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=$ENVIRONMENT_URL npx playwright test
- 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
npx playwright test
ENVIRONMENT_URL=https://host.docker.internal npx playwright test
# - name: Run backend tests
# if: ${{ ! cancelled() }}
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ jobs:
admin = db.getSiblingDB('admin')
admin.createUser({
user: 'mongodb',
pwd: 'mongodb',
pwd: 't1oj5L_xQI8dTrVuZ',
roles: [{ role: 'root', db: 'admin' }],
});
aiverify = db.getSiblingDB('aiverify')
aiverify.createUser({
user: 'aiverify',
pwd: 'aiverify',
pwd: 't1oj5L_xQI8dTrVuZ',
roles: [{ role: 'readWrite', db: 'aiverify' }],
});
Expand Down Expand Up @@ -169,7 +169,7 @@ jobs:
DB_HOST=127.0.0.1
DB_PORT=27017
DB_USERNAME=aiverify
DB_PASSWORD=aiverify
DB_PASSWORD=t1oj5L_xQI8dTrVuZ
ALLOWED_ORIGINS=http://127.0.0.1:3000,http://127.0.0.1:3001,http://127.0.0.1:4000" > .env
node app.mjs &> apigw.log &
Expand All @@ -181,7 +181,6 @@ jobs:
uses: actions/checkout@v3
with:
repository: IMDA-BTG/api-model-server
token: ${{ secrets.CHECKOUT_TOKEN }}
ref: main
path: qa-test/api-model-server

Expand All @@ -198,15 +197,13 @@ jobs:
uses: actions/checkout@v3
with:
repository: IMDA-BTG/frontend-testing
token: ${{ secrets.CHECKOUT_TOKEN }}
ref: main
path: qa-test/frontend-testing

- name: Checkout backend tests
uses: actions/checkout@v3
with:
repository: IMDA-BTG/backend-testing
token: ${{ secrets.CHECKOUT_TOKEN }}
ref: main
path: qa-test/backend-testing
submodules: recursive
Expand Down Expand Up @@ -234,7 +231,7 @@ jobs:
run: |
cd qa-test/frontend-testing
npm install
npx playwright test
ENVIRONMENT_URL=https://127.0.0.1 npx playwright test
- name: Run backend tests
if: ${{ ! cancelled() }}
Expand Down
98 changes: 98 additions & 0 deletions .github/workflows/sca-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# SCA Scan

name: Software Composition Analysis

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:
software-composition-analysis:

runs-on: ubuntu-latest
timeout-minutes: 10

steps:

- 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: Install & Scan APIGW
run: |
cd ai-verify-apigw
npm install
bash <(curl -s -L https://detect.synopsys.com/detect9.sh) --blackduck.url=https://blackduck.aipo-imda.net/ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} --detect.detector.search.depth=10 --detect.project.name=ai-verify-apigw --detect.project.version.name=$(date +"%d-%m-%Y") --detect.source.path=. --detect.code.location.name="ai-verify-apigw_$(date +"%d-%m-%Y")" --detect.excluded.directories=/tests --blackduck.trust.cert=true
cd ../
- name: Install & Scan PORTAL
run: |
cd ai-verify-portal
npm install
bash <(curl -s -L https://detect.synopsys.com/detect9.sh) --blackduck.url=https://blackduck.aipo-imda.net/ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} --detect.detector.search.depth=10 --detect.project.name=ai-verify-portal --detect.project.version.name=$(date +"%d-%m-%Y") --detect.source.path=. --detect.code.location.name="ai-verify-portal_$(date +"%d-%m-%Y")" --detect.excluded.directories=/tests --blackduck.trust.cert=true
cd ../
- name: Install & Scan SHARED LIBRARY
run: |
cd ai-verify-shared-library
npm install
bash <(curl -s -L https://detect.synopsys.com/detect9.sh) --blackduck.url=https://blackduck.aipo-imda.net/ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} --detect.detector.search.depth=10 --detect.project.name=ai-verify-shared-library --detect.project.version.name=$(date +"%d-%m-%Y") --detect.source.path=. --detect.code.location.name="ai-verify-shared-library_$(date +"%d-%m-%Y")" --detect.excluded.directories=/tests --blackduck.trust.cert=true
cd ../
- name: Install & Scan TEST ENGINE APP
run: |
cd test-engine-app
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
bash <(curl -s -L https://detect.synopsys.com/detect9.sh) --blackduck.url=https://blackduck.aipo-imda.net/ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} --detect.detector.search.depth=10 --detect.project.name=test-engine-app --detect.project.version.name=$(date +"%d-%m-%Y") --detect.source.path=. --detect.code.location.name="test-engine-app_$(date +"%d-%m-%Y")" --detect.excluded.directories=/tests --blackduck.trust.cert=true
cd ../
- name: Install & Scan TEST ENGINE CORE
run: |
cd test-engine-core
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
bash <(curl -s -L https://detect.synopsys.com/detect9.sh) --blackduck.url=https://blackduck.aipo-imda.net/ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} --detect.detector.search.depth=10 --detect.project.name=test-engine-core --detect.project.version.name=$(date +"%d-%m-%Y") --detect.source.path=. --detect.code.location.name="test-engine-core_$(date +"%d-%m-%Y")" --detect.excluded.directories=/tests --blackduck.trust.cert=true
cd ../
- name: Install & Scan TEST ENGINE CORE MODULES
run: |
cd test-engine-core-modules
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
bash <(curl -s -L https://detect.synopsys.com/detect9.sh) --blackduck.url=https://blackduck.aipo-imda.net/ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} --detect.detector.search.depth=10 --detect.project.name=test-engine-core-modules --detect.project.version.name=$(date +"%d-%m-%Y") --detect.source.path=. --detect.code.location.name="test-engine-core-modules_$(date +"%d-%m-%Y")" --detect.excluded.directories=/tests --blackduck.trust.cert=true
cd ../
- name: Install & Scan STOCK PLUGINS
run: |
cd stock-plugins
python3 -m venv venv
source venv/bin/activate
find ./ -type f -name 'requirements.txt' -exec pip install -r "{}" \;
bash <(curl -s -L https://detect.synopsys.com/detect9.sh) --blackduck.url=https://blackduck.aipo-imda.net/ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} --detect.detector.search.depth=10 --detect.project.name=test-engine-core --detect.project.version.name=$(date +"%d-%m-%Y") --detect.source.path=. --detect.code.location.name="stock-plugins_$(date +"%d-%m-%Y")" --detect.excluded.directories=/tests --blackduck.trust.cert=true
cd ../
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

[![Integration Tests](https://github.com/IMDA-BTG/aiverify/actions/workflows/integration-tests.yml/badge.svg)](https://github.com/IMDA-BTG/aiverify/actions/workflows/integration-tests.yml)
[![Integration Tests](https://github.com/IMDA-BTG/aiverify/actions/workflows/integration-tests.yml/badge.svg)](https://github.com/IMDA-BTG/aiverify/actions/workflows/integration-tests.yml) [![Integration Tests for aiverify-user (Docker)](https://github.com/IMDA-BTG/aiverify/actions/workflows/integration-tests-docker.yml/badge.svg)](https://github.com/IMDA-BTG/aiverify/actions/workflows/integration-tests-docker.yml)

## ✨New API Connector Feature!

Expand Down Expand Up @@ -67,7 +67,7 @@ Thank you for your interest in AI Verify, and we look forward to your contributi

```
AI Verify
Copyright 2023 AI Verify Foundation
Copyright 2024 AI Verify Foundation
This product includes software developed under the AI Verify Foundation.
Expand Down
8 changes: 4 additions & 4 deletions ai-verify-apigw/__tests__/graphql/dataset.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe("Test Dataset GraphQL queries and mutations", () => {
const response2 = await server.executeOperation({
query,
variables: {
datasetID: mongoose.Types.ObjectId(),
datasetID: new mongoose.Types.ObjectId(),
dataset: {
description: 'Mock Description2',
name: 'New File Name2.png',
Expand All @@ -141,7 +141,7 @@ describe("Test Dataset GraphQL queries and mutations", () => {
expect(response2.body.singleResult.errors).toBeDefined();

// check not updated into db
const doc = await DatasetModel.findOne({ _id: mongoose.Types.ObjectId(id) });
const doc = await DatasetModel.findOne({ _id: new mongoose.Types.ObjectId(id) });
expect(doc.name).toEqual(data[dataLen-1].name);
expect(doc.status).toEqual(data[dataLen-1].status);

Expand Down Expand Up @@ -177,7 +177,7 @@ describe("Test Dataset GraphQL queries and mutations", () => {
expect(response.body.singleResult.errors).toBeUndefined();

// check updated into db
const doc = await DatasetModel.findOne({ _id: mongoose.Types.ObjectId(id) });
const doc = await DatasetModel.findOne({ _id: new mongoose.Types.ObjectId(id) });
expect(doc.name).toEqual('New File Name.png');
expect(doc.status).toEqual('Cancelled');
expect(doc.description).toEqual('Mock Description');
Expand Down Expand Up @@ -284,7 +284,7 @@ describe("Test Dataset GraphQL queries and mutations", () => {
response = await server.executeOperation({
query,
variables: {
id: mongoose.Types.ObjectId()
id: new mongoose.Types.ObjectId()
}
})
// check response
Expand Down
Loading

0 comments on commit ce32b74

Please sign in to comment.