Skip to content

Commit e424573

Browse files
authored
Merge pull request #9292 from OpenMined/tauquir/scenario-tests
Scenario load tests with simulator
2 parents 668af28 + be685a1 commit e424573

33 files changed

Lines changed: 1748 additions & 1407 deletions

.github/workflows/pr-tests-stack.yml

Lines changed: 283 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ jobs:
875875
if: steps.changes.outputs.stack == 'true'
876876
run: |
877877
python -m pip install --upgrade pip
878-
pip install uv==0.2.17 tox==4.16.0 tox-uv==1.9.0
878+
pip install uv==0.4.1 tox==4.18.0 tox-uv==1.11.2
879879
uv --version
880880
- name: Get uv cache dir
881881
if: steps.changes.outputs.stack == 'true'
@@ -956,3 +956,285 @@ jobs:
956956
export PATH=`pwd`:$PATH
957957
k3d cluster delete bigquery-high || true
958958
k3d cluster delete bigquery-low || true
959+
960+
pr-tests-simulation-scenario-k8s:
961+
strategy:
962+
max-parallel: 99
963+
matrix:
964+
os: [ubuntu-latest]
965+
python-version: ["3.12"]
966+
fail-fast: false
967+
968+
runs-on: ${{matrix.os}}
969+
970+
steps:
971+
- name: Permission to home directory
972+
run: |
973+
sudo chown -R $USER:$USER $HOME
974+
- uses: actions/checkout@v4
975+
- name: Check for file changes
976+
uses: dorny/paths-filter@v3
977+
id: changes
978+
with:
979+
base: ${{ github.ref }}
980+
token: ${{ github.token }}
981+
filters: .github/file-filters.yml
982+
983+
- name: Set up Python ${{ matrix.python-version }}
984+
uses: actions/setup-python@v5
985+
if: steps.changes.outputs.stack == 'true'
986+
with:
987+
python-version: ${{ matrix.python-version }}
988+
989+
- name: Add K3d Registry
990+
run: |
991+
sudo python ./scripts/patch_hosts.py --add-k3d-registry
992+
993+
- name: Free Disk Space (Ubuntu)
994+
uses: jlumbroso/free-disk-space@main
995+
with:
996+
tool-cache: true
997+
large-packages: false
998+
999+
# free 10GB of space
1000+
- name: Remove unnecessary files
1001+
if: matrix.os == 'ubuntu-latest'
1002+
run: |
1003+
sudo rm -rf /usr/share/dotnet
1004+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
1005+
docker image prune --all --force
1006+
docker builder prune --all --force
1007+
docker system prune --all --force
1008+
1009+
- name: Install pip dependencies
1010+
if: steps.changes.outputs.stack == 'true'
1011+
run: |
1012+
python -m pip install --upgrade pip
1013+
pip install uv==0.4.1 tox==4.18.0 tox-uv==1.11.2
1014+
uv --version
1015+
1016+
- name: Get uv cache dir
1017+
if: steps.changes.outputs.stack == 'true'
1018+
id: pip-cache
1019+
shell: bash
1020+
run: |
1021+
echo "dir=$(uv cache dir)" >> $GITHUB_OUTPUT
1022+
1023+
- name: Load github cache
1024+
uses: actions/cache@v4
1025+
if: steps.changes.outputs.stack == 'true'
1026+
with:
1027+
path: ${{ steps.pip-cache.outputs.dir }}
1028+
key: ${{ runner.os }}-uv-py${{ matrix.python-version }}
1029+
restore-keys: |
1030+
${{ runner.os }}-uv-py${{ matrix.python-version }}
1031+
1032+
- name: Install kubectl
1033+
if: steps.changes.outputs.stack == 'true'
1034+
run: |
1035+
# cleanup apt version
1036+
sudo apt remove kubectl || true
1037+
# install kubectl 1.27
1038+
curl -LO https://dl.k8s.io/release/v1.27.2/bin/linux/amd64/kubectl
1039+
chmod +x kubectl
1040+
sudo install kubectl /usr/local/bin;
1041+
1042+
- name: Install helm
1043+
if: steps.changes.outputs.stack == 'true'
1044+
run: |
1045+
# install helm
1046+
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
1047+
chmod 700 get_helm.sh
1048+
./get_helm.sh
1049+
1050+
- name: Install just
1051+
if: steps.changes.outputs.stack == 'true'
1052+
run: |
1053+
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin
1054+
1055+
- name: Run scenario tests
1056+
if: steps.changes.outputs.syft == 'true' || steps.changes.outputs.notebooks_scenario == 'true'
1057+
env:
1058+
TOX_PYTHON: python${{ matrix.python-version }}
1059+
shell: bash
1060+
run: |
1061+
K3D_VERSION=v5.6.3
1062+
DEVSPACE_VERSION=v6.3.12
1063+
# install k3d
1064+
wget https://github.com/k3d-io/k3d/releases/download/${K3D_VERSION}/k3d-linux-amd64
1065+
mv k3d-linux-amd64 k3d
1066+
chmod +x k3d
1067+
export PATH=`pwd`:$PATH
1068+
k3d version
1069+
curl -sSL https://github.com/loft-sh/devspace/releases/download/${DEVSPACE_VERSION}/devspace-linux-amd64 -o ./devspace
1070+
chmod +x devspace
1071+
devspace version
1072+
tox -e stack.test.scenario.k8s
1073+
1074+
- name: Collect logs
1075+
if: steps.changes.outputs.stack == 'true' && failure()
1076+
shell: bash
1077+
run: |
1078+
mkdir -p ./output-logs
1079+
if [ -d "tests/scenariosv2/.logs" ]; then
1080+
cp -R tests/scenariosv2/.logs/* ./output-logs/
1081+
else
1082+
echo "Log directory not found"
1083+
fi
1084+
1085+
- name: Upload logs to GitHub
1086+
uses: actions/upload-artifact@master
1087+
if: steps.changes.outputs.stack == 'true' && failure()
1088+
with:
1089+
name: simulation-scenario-k8s-logs-${{ matrix.os }}-${{ steps.date.outputs.date }}
1090+
path: ./output-logs/
1091+
1092+
- name: Cleanup k3d
1093+
if: steps.changes.outputs.stack == 'true' && failure()
1094+
shell: bash
1095+
run: |
1096+
export PATH=`pwd`:$PATH
1097+
k3d cluster delete syft-low || true
1098+
k3d registry delete k3d-registry.localhost || true
1099+
1100+
pr-tests-simulation-scenario-k8s-sync:
1101+
strategy:
1102+
max-parallel: 99
1103+
matrix:
1104+
os: [ubuntu-latest]
1105+
python-version: ["3.12"]
1106+
fail-fast: false
1107+
1108+
runs-on: ${{matrix.os}}
1109+
1110+
steps:
1111+
- name: Permission to home directory
1112+
run: |
1113+
sudo chown -R $USER:$USER $HOME
1114+
- uses: actions/checkout@v4
1115+
- name: Check for file changes
1116+
uses: dorny/paths-filter@v3
1117+
id: changes
1118+
with:
1119+
base: ${{ github.ref }}
1120+
token: ${{ github.token }}
1121+
filters: .github/file-filters.yml
1122+
1123+
- name: Set up Python ${{ matrix.python-version }}
1124+
uses: actions/setup-python@v5
1125+
if: steps.changes.outputs.stack == 'true'
1126+
with:
1127+
python-version: ${{ matrix.python-version }}
1128+
1129+
- name: Add K3d Registry
1130+
run: |
1131+
sudo python ./scripts/patch_hosts.py --add-k3d-registry
1132+
1133+
- name: Free Disk Space (Ubuntu)
1134+
uses: jlumbroso/free-disk-space@main
1135+
with:
1136+
tool-cache: true
1137+
large-packages: false
1138+
1139+
# free 10GB of space
1140+
- name: Remove unnecessary files
1141+
if: matrix.os == 'ubuntu-latest'
1142+
run: |
1143+
sudo rm -rf /usr/share/dotnet
1144+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
1145+
docker image prune --all --force
1146+
docker builder prune --all --force
1147+
docker system prune --all --force
1148+
1149+
- name: Install pip dependencies
1150+
if: steps.changes.outputs.stack == 'true'
1151+
run: |
1152+
python -m pip install --upgrade pip
1153+
pip install uv==0.4.1 tox==4.18.0 tox-uv==1.11.2
1154+
uv --version
1155+
1156+
- name: Get uv cache dir
1157+
if: steps.changes.outputs.stack == 'true'
1158+
id: pip-cache
1159+
shell: bash
1160+
run: |
1161+
echo "dir=$(uv cache dir)" >> $GITHUB_OUTPUT
1162+
1163+
- name: Load github cache
1164+
uses: actions/cache@v4
1165+
if: steps.changes.outputs.stack == 'true'
1166+
with:
1167+
path: ${{ steps.pip-cache.outputs.dir }}
1168+
key: ${{ runner.os }}-uv-py${{ matrix.python-version }}
1169+
restore-keys: |
1170+
${{ runner.os }}-uv-py${{ matrix.python-version }}
1171+
1172+
- name: Install kubectl
1173+
if: steps.changes.outputs.stack == 'true'
1174+
run: |
1175+
# cleanup apt version
1176+
sudo apt remove kubectl || true
1177+
# install kubectl 1.27
1178+
curl -LO https://dl.k8s.io/release/v1.27.2/bin/linux/amd64/kubectl
1179+
chmod +x kubectl
1180+
sudo install kubectl /usr/local/bin;
1181+
1182+
- name: Install helm
1183+
if: steps.changes.outputs.stack == 'true'
1184+
run: |
1185+
# install helm
1186+
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
1187+
chmod 700 get_helm.sh
1188+
./get_helm.sh
1189+
1190+
- name: Install just
1191+
if: steps.changes.outputs.stack == 'true'
1192+
run: |
1193+
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin
1194+
1195+
- name: Run scenario tests
1196+
if: steps.changes.outputs.syft == 'true' || steps.changes.outputs.notebooks_scenario == 'true'
1197+
env:
1198+
BUMP_VERSION: "${{ matrix.bump-version }}"
1199+
TOX_PYTHON: python${{ matrix.python-version }}
1200+
shell: bash
1201+
run: |
1202+
K3D_VERSION=v5.6.3
1203+
DEVSPACE_VERSION=v6.3.12
1204+
# install k3d
1205+
wget https://github.com/k3d-io/k3d/releases/download/${K3D_VERSION}/k3d-linux-amd64
1206+
mv k3d-linux-amd64 k3d
1207+
chmod +x k3d
1208+
export PATH=`pwd`:$PATH
1209+
k3d version
1210+
curl -sSL https://github.com/loft-sh/devspace/releases/download/${DEVSPACE_VERSION}/devspace-linux-amd64 -o ./devspace
1211+
chmod +x devspace
1212+
devspace version
1213+
tox -e stack.test.scenario.k8s.sync
1214+
1215+
- name: Collect logs
1216+
if: steps.changes.outputs.stack == 'true' && failure()
1217+
shell: bash
1218+
run: |
1219+
mkdir -p ./output-logs
1220+
if [ -d "tests/scenariosv2/.logs" ]; then
1221+
cp -R tests/scenariosv2/.logs/* ./output-logs/
1222+
else
1223+
echo "Log directory not found"
1224+
fi
1225+
1226+
- name: Upload logs to GitHub
1227+
uses: actions/upload-artifact@master
1228+
if: steps.changes.outputs.stack == 'true' && failure()
1229+
with:
1230+
name: simulation-scenario-k8s-sync-logs-${{ matrix.os }}-${{ steps.date.outputs.date }}
1231+
path: ./output-logs/
1232+
1233+
- name: Cleanup k3d
1234+
if: steps.changes.outputs.stack == 'true' && failure()
1235+
shell: bash
1236+
run: |
1237+
export PATH=`pwd`:$PATH
1238+
k3d cluster delete syft-low || true
1239+
k3d cluster delete syft-high || true
1240+
k3d registry delete k3d-registry.localhost || true

0 commit comments

Comments
 (0)