Compare commits

...

6 Commits
v47 ... v58

Author SHA1 Message Date
39273908ac removed checkout to potentially fix an error with test_data.log 2025-11-12 18:58:36 +01:00
Hatvani Tamás
7be3c928b7 Display test_data.log in workflow script
Added command to display contents of test_data.log
2025-11-12 18:54:06 +01:00
Hatvani Tamás
f8c14cc268 Enhance logging for data upload process
Added print statements to log data being uploaded to each tab.
2025-11-12 18:50:01 +01:00
Hatvani Tamás
566d72c2d6 Merge pull request #7 from htamas1210/Workflow
Workflow
2025-11-12 18:45:08 +01:00
ad26d22281 indentation error in python script 2025-11-12 18:44:00 +01:00
352b4e57d7 rewrote the python script
the script now checks for project name on every line read from the log
file and appends it to a list named by the project, if the branch is
master then it appends all lines into one list, then it checks if there
is any data in the list and uploads them to the correct tab that matches
the project name or master
2025-11-12 18:42:17 +01:00
5 changed files with 59 additions and 19 deletions

View File

@@ -9,8 +9,6 @@ jobs:
runs-on: self-hosted runs-on: self-hosted
steps: steps:
- uses: actions/checkout@v4
- name: Run Engine tests - name: Run Engine tests
run: | run: |
bash .github/workflows/test.sh engine/ bash .github/workflows/test.sh engine/

View File

@@ -9,8 +9,6 @@ jobs:
runs-on: self-hosted runs-on: self-hosted
steps: steps:
- uses: actions/checkout@v4
- name: Run Server tests - name: Run Server tests
run: | run: |
bash .github/workflows/test.sh server/ bash .github/workflows/test.sh server/

View File

@@ -38,3 +38,5 @@ cat "$LOG_FILE" >> "$FINAL_LOG"
# --- SUMMARY --- # --- SUMMARY ---
echo ">>> Test output extracted to $PROJECT_PATH/$LOG_FILE" echo ">>> Test output extracted to $PROJECT_PATH/$LOG_FILE"
echo ">>> Appended to $FINAL_LOG" echo ">>> Appended to $FINAL_LOG"
cat $(git rev-parse --show-toplevel)/test_data.log

View File

@@ -9,8 +9,6 @@ jobs:
runs-on: self-hosted runs-on: self-hosted
steps: steps:
- uses: actions/checkout@v4
- name: Run UI tests - name: Run UI tests
run: | run: |
bash .github/workflows/test.sh ui/ bash .github/workflows/test.sh ui/

View File

@@ -20,33 +20,77 @@ jobs:
echo "$GOOGLE_SERVICE_ACCOUNT_JSON" > service_account.json echo "$GOOGLE_SERVICE_ACCOUNT_JSON" > service_account.json
python <<'PYCODE' python <<'PYCODE'
import gspread, json, time, subprocess import gspread, json, subprocess
# credentials
creds = json.load(open("service_account.json")) creds = json.load(open("service_account.json"))
gc = gspread.service_account_from_dict(creds) gc = gspread.service_account_from_dict(creds)
sh = gc.open_by_key("${{ secrets.SPREADSHEET_ID }}") sh = gc.open_by_key("${{ secrets.SPREADSHEET_ID }}")
v = subprocess.run(['git','rev-parse','--show-toplevel'], capture_output=True).stdout.decode().strip() v = subprocess.run(['git','rev-parse','--show-toplevel'], capture_output=True).stdout.decode().strip()
print(f"{v}/test_data.log") print(f"{v}/test_data.log")
def writeRowsToSpreadsheet(data_list, worksheet):
existing_rows = len(worksheet.get_all_values())
start_row = existing_rows + 3
rows_to_append = [row.split() for row in data_list]
print("rows to append")
print(f"{rows_to_append}")
for i, row in enumerate(rows_to_append):
worksheet.insert_row(row, start_row + i)
with open(f"{v}/test_data.log", "r") as f: with open(f"{v}/test_data.log", "r") as f:
lines = [line.strip() for line in f if line.strip()] lines = [line.strip() for line in f if line.strip()]
isMaster = False
project = lines[0].lower() project = lines[0].lower()
worksheet = sh.worksheet(project) if project == "master":
isMaster = True
# project name engine_data = []
data = lines[1:] server_data = []
ui_data = []
master_data = []
#blank rows for entry in lines:
existing_rows = len(worksheet.get_all_values()) if not isMaster and entry == "engine":
start_row = existing_rows + 3 project = "engine"
elif not isMaster and entry == "server":
project = "server"
elif not isMaster and entry == "ui":
project = "ui"
# Split data into columns (by spaces) if project == "engine" and entry != "engine":
rows_to_append = [row.split() for row in data] engine_data.append(entry)
elif project == "server" and entry != "server":
server_data.append(entry)
elif project == "ui" and entry != "ui":
ui_data.append(entry)
elif project == "master" and entry != "master":
master_data.append(entry)
for i, row in enumerate(rows_to_append): print("PRINTING FILTERED DATA\n\n")
worksheet.insert_row(row, start_row + i) print(f"engine\n{engine_data}")
print(f"server\n{server_data}")
print(f"ui\n{ui_data}")
print(f"master\n{master_data}")
print("\n\n\n")
if isMaster and len(master_data) != 0:
print("uploading to master tab")
worksheet = sh.worksheet("master")
writeRowsToSpreadsheet(master_data, worksheet)
exit(0)
if len(engine_data) != 0:
print("uploading to engine tab")
writeRowsToSpreadsheet(engine_data, sh.worksheet("engine"))
if len(server_data) != 0:
print("uploading to server tab")
writeRowsToSpreadsheet(server_data, sh.worksheet("server"))
if len(ui_data) != 0:
print("uploading to ui tab")
writeRowsToSpreadsheet(ui_data, sh.worksheet("ui"))
print(f"Uploaded {len(rows_to_append)} rows to '{project}' tab.")
PYCODE PYCODE