Skip to content

Commit b414464

Browse files
compatibility test for arm and x64, fix code of trigger compatibility test after release build
1 parent dbf55ac commit b414464

File tree

3 files changed

+143
-75
lines changed

3 files changed

+143
-75
lines changed

.github/workflows/compatibility_test.yml

Lines changed: 106 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,10 @@ on:
1212
required: false
1313
default: ''
1414
jobs:
15-
upload_data:
16-
uses: timeplus-io/proton/.github/workflows/run_command.yml@develop
17-
with:
18-
ec2-instance-type: ${{ vars.X64_INSTANCE_TYPE }}
19-
ec2-image-id: ${{ vars.X64_TEST_AMI }}
20-
ec2-volume-size: '30'
21-
submodules: false
22-
timeout: 30
15+
prepare_upload_data:
16+
if: ${{ github.event.inputs.source == '' || github.event.inputs.source == github.event.inputs.target }}
17+
runs-on: ubuntu-latest
18+
outputs:
2319
command: |
2420
export PROTON_VERSION=${{ github.event.inputs.target }}
2521
@@ -49,38 +45,25 @@ jobs:
4945
5046
cd $GITHUB_WORKSPACE
5147
tar -zcvf $PROTON_VERSION.tar.gz data
52-
aws s3 cp --no-progress $PROTON_VERSION.tar.gz s3://tp-internal/proton/compatibility/oss/
53-
secrets:
54-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
55-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
56-
AWS_REGION: ${{ secrets.AWS_REGION }}
57-
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
58-
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
59-
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
60-
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
61-
TIMEPLUS_ADDRESS: ${{ secrets.TIMEPLUS_ADDRESS }}
62-
TIMEPLUS_API_KEY: ${{ secrets.TIMEPLUS_API_KEY }}
63-
TIMEPLUS_WORKSPACE: ${{ secrets.TIMEPLUS_WORKSPACE }}
64-
65-
compatibility_test:
66-
if: ${{ github.event.inputs.source!='' }}
67-
uses: timeplus-io/proton/.github/workflows/run_command.yml@develop
68-
with:
69-
ec2-instance-type: ${{ vars.X64_INSTANCE_TYPE }}
70-
ec2-image-id: ${{ vars.X64_TEST_AMI }}
71-
ec2-volume-size: '30'
72-
submodules: false
73-
timeout: 30
48+
aws s3 cp --no-progress $PROTON_VERSION.tar.gz s3://tp-internal/proton/compatibility/oss/$ARCH/
49+
steps:
50+
- name: display command
51+
run: |
52+
echo 'command: ${{ steps.set_command.outputs.command }}'
53+
prepare_compatibility_test:
54+
if: ${{ github.event.inputs.source != '' && github.event.inputs.source != github.event.inputs.target }}
55+
runs-on: ubuntu-latest
56+
outputs:
7457
command: |
7558
export TARGET_VERSION=${{ github.event.inputs.target }}
7659
export SOURCE_VERSION=${{ github.event.inputs.source }}
7760
export PROTON_VERSION=$TARGET_VERSION
78-
61+
7962
# prepare data
8063
cd $GITHUB_WORKSPACE
81-
aws s3 cp --no-progress s3://tp-internal/proton/compatibility/oss/$SOURCE_VERSION.tar.gz .
64+
aws s3 cp --no-progress s3://tp-internal/proton/compatibility/oss/$ARCH/$SOURCE_VERSION.tar.gz .
8265
tar -zxvf $SOURCE_VERSION.tar.gz
83-
66+
8467
cd $GITHUB_WORKSPACE/tests/stream
8568
8669
# make virtualenv
@@ -90,20 +73,82 @@ jobs:
9073
apt install python3-venv -y
9174
python -m venv env
9275
source env/bin/activate
93-
76+
9477
pip install --upgrade pip
95-
78+
9679
# FIXME: remove this line after pyyaml community fixed install bug
9780
pip install pyyaml==5.3.1
98-
81+
9982
# FIXME(yokofly): docker 7.0.0 introduce a breaking change
10083
# https://github.com/docker/docker-py/issues/3194
10184
pip install docker==6.1.3
102-
85+
10386
pip install -r helpers/requirements.txt
104-
87+
10588
bash test_compatibility/basic_tests.sh
10689
bash test_compatibility/extra_tests.sh
90+
steps:
91+
- name: display command
92+
run: |
93+
echo 'command: ${{ steps.set_command.outputs.command }}'
94+
upload_data_x64:
95+
needs: [prepare_upload_data]
96+
uses: timeplus-io/proton/.github/workflows/run_command.yml@develop
97+
with:
98+
ec2-instance-type: ${{ vars.X64_INSTANCE_TYPE }}
99+
ec2-image-id: ${{ vars.X64_TEST_AMI }}
100+
ec2-volume-size: '30'
101+
submodules: false
102+
timeout: 30
103+
arch: ${{ vars.X64_ARCH }}
104+
command: |
105+
${{ needs.prepare_upload_data.outputs.command }}
106+
secrets:
107+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
108+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
109+
AWS_REGION: ${{ secrets.AWS_REGION }}
110+
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
111+
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
112+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
113+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
114+
TIMEPLUS_ADDRESS: ${{ secrets.TIMEPLUS_ADDRESS }}
115+
TIMEPLUS_API_KEY: ${{ secrets.TIMEPLUS_API_KEY }}
116+
TIMEPLUS_WORKSPACE: ${{ secrets.TIMEPLUS_WORKSPACE }}
117+
upload_data_arm:
118+
needs: [prepare_upload_data]
119+
uses: timeplus-io/proton/.github/workflows/run_command.yml@develop
120+
with:
121+
ec2-instance-type: ${{ vars.ARM_INSTANCE_TYPE }}
122+
ec2-image-id: ${{ vars.ARM_TEST_AMI }}
123+
ec2-volume-size: '30'
124+
submodules: false
125+
timeout: 30
126+
arch: ${{ vars.ARM_ARCH }}
127+
command: |
128+
${{ needs.prepare_upload_data.outputs.command }}
129+
secrets:
130+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
131+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
132+
AWS_REGION: ${{ secrets.AWS_REGION }}
133+
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
134+
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
135+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
136+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
137+
TIMEPLUS_ADDRESS: ${{ secrets.TIMEPLUS_ADDRESS }}
138+
TIMEPLUS_API_KEY: ${{ secrets.TIMEPLUS_API_KEY }}
139+
TIMEPLUS_WORKSPACE: ${{ secrets.TIMEPLUS_WORKSPACE }}
140+
compatibility_test_x64:
141+
needs: [prepare_compatibility_test]
142+
uses: timeplus-io/proton/.github/workflows/run_command.yml@develop
143+
with:
144+
ec2-instance-type: ${{ vars.X64_INSTANCE_TYPE }}
145+
ec2-image-id: ${{ vars.X64_TEST_AMI }}
146+
ec2-volume-size: '30'
147+
submodules: false
148+
timeout: 30
149+
arch: ${{ vars.X64_ARCH }}
150+
command: |
151+
${{ needs.prepare_compatibility_test.outputs.command }}
107152
secrets:
108153
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
109154
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@@ -115,3 +160,26 @@ jobs:
115160
TIMEPLUS_ADDRESS: ${{ secrets.TIMEPLUS_ADDRESS }}
116161
TIMEPLUS_API_KEY: ${{ secrets.TIMEPLUS_API_KEY }}
117162
TIMEPLUS_WORKSPACE: ${{ secrets.TIMEPLUS_WORKSPACE }}
163+
compatibility_test_arm:
164+
needs: [prepare_compatibility_test]
165+
uses: timeplus-io/proton/.github/workflows/run_command.yml@develop
166+
with:
167+
ec2-instance-type: ${{ vars.ARM_INSTANCE_TYPE }}
168+
ec2-image-id: ${{ vars.ARM_TEST_AMI }}
169+
ec2-volume-size: '30'
170+
submodules: false
171+
timeout: 30
172+
arch: ${{ vars.ARM_ARCH }}
173+
command: |
174+
${{ needs.prepare_compatibility_test.outputs.command }}
175+
secrets:
176+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
177+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
178+
AWS_REGION: ${{ secrets.AWS_REGION }}
179+
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
180+
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
181+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
182+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
183+
TIMEPLUS_ADDRESS: ${{ secrets.TIMEPLUS_ADDRESS }}
184+
TIMEPLUS_API_KEY: ${{ secrets.TIMEPLUS_API_KEY }}
185+
TIMEPLUS_WORKSPACE: ${{ secrets.TIMEPLUS_WORKSPACE }}

.github/workflows/release_build.yml

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,22 @@ jobs:
169169
-H "X-GitHub-Api-Version: 2022-11-28" \
170170
https://api.github.com/repos/timeplus-io/proton/actions/workflows/manual_trigger_test.yml/dispatches \
171171
-d "{\"ref\":\"develop\",\"inputs\":{\"arch\": \"arm\", \"tag\":\"$PROTON_TAG-rc\"}}\""
172+
173+
# trigger compatibility test
174+
export PROTON_VERSION=$PROTON_TAG
175+
cd $GITHUB_WORKSPACE/tests/proton_ci
176+
177+
# make virtualenv
178+
ln -s /usr/bin/python3 /usr/bin/python
179+
apt-get update
180+
systemctl stop unattended-upgrades
181+
apt install python3-venv -y
182+
python -m venv env
183+
source env/bin/activate
184+
pip install --upgrade pip
185+
186+
pip install -r requirements.txt
187+
python run_compatibility_tests.py
172188
secrets:
173189
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
174190
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@@ -177,26 +193,6 @@ jobs:
177193
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
178194
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
179195
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
180-
Trigger_Compatibility_Tests:
181-
needs: [CommitTag]
182-
runs-on: ubuntu-latest
183-
steps:
184-
- name: checkout repo
185-
uses: actions/checkout@v4
186-
- name: setup python
187-
uses: actions/setup-python@v4
188-
with:
189-
python-version: '3.8'
190-
- name: run command
191-
run: |
192-
./release --version patch
193-
export PROTON_VERSION=`grep "SET(VERSION_STRING" $GITHUB_WORKSPACE/cmake/autogenerated_versions.txt | sed 's/^.*VERSION_STRING \(.*\)$/\1/' | sed 's/[) ].*//'`
194-
echo "PROTON_VERSION=$PROTON_VERSION"
195-
cd $GITHUB_WORKSPACE/tests/proton_ci
196-
pip install -r requirements.txt
197-
python run_compatibility_tests.py
198-
env:
199-
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
200196
Build_Darwin_X86_64:
201197
uses: timeplus-io/proton/.github/workflows/run_command.yml@develop
202198
with:

tests/proton_ci/run_compatibility_tests.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import logging
23
import time
34
from typing import List, Any
45

@@ -26,8 +27,9 @@ def valid_version_tag(tag_list: List[str]) -> Any:
2627
url="https://api.github.com/orgs/timeplus-io/packages/container/proton/versions?per_page=100",
2728
headers=HEADERS
2829
).json()
30+
2931
valid_version_list = []
30-
current_version = ""
32+
current_version = "latest"
3133
for version_info in proton_image_version_list:
3234
created_at = time.mktime(time.strptime(version_info['created_at'], "%Y-%m-%dT%H:%M:%SZ"))
3335
tags = version_info['metadata']['container']['tags']
@@ -36,22 +38,24 @@ def valid_version_tag(tag_list: List[str]) -> Any:
3638
continue
3739
if tag_name == PROTON_VERSION or tag_name == PROTON_VERSION + "-rc":
3840
current_version = tag_name
39-
continue
4041
valid_version_list.append((created_at, tag_name))
42+
4143
valid_version_list.sort(key=lambda version_tuple: -int(version_tuple[0]))
42-
valid_version_list = valid_version_list[:min(len(valid_version_list), MAX_TEST_VERSION_NUM)]
43-
if current_version == "":
44-
print("Cannot find current proton version.")
44+
valid_version_list = valid_version_list[:min(len(valid_version_list), MAX_TEST_VERSION_NUM + 1)]
45+
4546
for _, version in valid_version_list:
46-
response = requests.post(
47-
"https://api.github.com/repos/timeplus-io/proton/actions/workflows/compatibility_test.yml/dispatches",
48-
headers=HEADERS,
49-
data=json.dumps({
50-
"ref": "develop",
51-
"inputs": {
52-
"source": version,
53-
"target": current_version
54-
}
55-
})
56-
)
57-
print(f'target="{current_version}", source="{version}", status_code="{response.status_code}"')
47+
try:
48+
response = requests.post(
49+
"https://api.github.com/repos/timeplus-io/proton/actions/workflows/compatibility_test.yml/dispatches",
50+
headers=HEADERS,
51+
data=json.dumps({
52+
"ref": "develop",
53+
"inputs": {
54+
"source": version,
55+
"target": current_version
56+
}
57+
})
58+
)
59+
assert response.status_code == 204
60+
except Exception as e:
61+
logging.error(e)

0 commit comments

Comments
 (0)