-
Notifications
You must be signed in to change notification settings - Fork 33
164 lines (136 loc) · 5.32 KB
/
integration-tests-docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# 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: aiverify-foundation/api-model-server
ref: main
path: qa-test/api-model-server
- name: Checkout smoke tests
uses: actions/checkout@v3
with:
repository: aiverify-foundation/smoke-testing
ref: main
path: qa-test/smoke-testing
submodules: recursive
- name: Checkout frontend tests
uses: actions/checkout@v3
with:
repository: aiverify-foundation/frontend-testing
ref: main
path: qa-test/frontend-testing
submodules: recursive
- name: Checkout backend tests
uses: actions/checkout@v3
with:
repository: aiverify-foundation/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