Compare commits

...

17 Commits

Author SHA1 Message Date
1b4194ee7d Cleanup job depend on release, added missing .cargo folder to fix cc error on workflow build 2025-11-09 12:44:33 +01:00
Hatvani Tamás
4763cbed95 Update dispatcher.yml to include permissions
Add permissions for write access to contents
2025-11-09 12:36:33 +01:00
Hatvani Tamás
9253283953 Workflow: re enabled test-data-upload with temp commands 2025-11-09 12:34:45 +01:00
596828e827 Added release workflow, started work on the upload to spreadsheet 2025-11-09 12:29:46 +01:00
Hatvani Tamás
c6c2e27d34 Add cleanup job to dispatcher workflow
Add a cleanup job to the workflow for final cleanup.
2025-11-07 13:19:40 +01:00
bc2eca7eac added new test.sh script
The test.sh script will run the cargo test and save a formatted output
from each project and then append them to a final log file which will be
the data to be uploaded to the spreadsheet
2025-11-07 12:54:11 +01:00
86ceab10ad Workflow: removed rust setup from the tests, as it is installed on device 2025-11-05 15:27:47 +01:00
785e40f538 Workflow: removed branch from tests call 2025-11-05 15:24:35 +01:00
39da1be9de Workflow: added new triggers for running test workflows 2025-11-05 15:08:33 +01:00
Hatvani Tamás
7ef9855016 Update workflow paths and conditions in dispatcher.yml 2025-11-05 15:00:42 +01:00
Hatvani Tamás
b5902c0bb7 Merge pull request #2 from htamas1210/Workflow
Workflow: dispatching workflow with 'uses'
2025-11-05 14:58:42 +01:00
76a1c18b56 Workflow: dispatching workflow with 'uses' 2025-11-05 14:58:08 +01:00
Hatvani Tamás
27394df920 Merge pull request #1 from htamas1210/Workflow
Workflow: Trying workflow on master branch
2025-11-05 14:49:08 +01:00
3df33093ed Workflow: Added the workflow files, changed ls to pwd in tests 2025-11-05 14:47:50 +01:00
300b3cde34 Workflow: Triggering the workflow a different way with gh script 2025-11-05 13:46:29 +01:00
a19e0bf922 Workflow: added missing repository checkout
Repository checkout was missing from the dispatch workflow
2025-11-05 13:30:58 +01:00
7625eecbd9 Workflow: Dispatch and Test runner workflow test #1
Testing the dispatcher and engine_test workflow for any bugs, the
changes on these files always need to be uploaded to github to test if
it is working correctly
2025-11-05 13:26:23 +01:00
11 changed files with 352 additions and 0 deletions

98
.github/workflows/dispatcher.yml vendored Normal file
View File

@@ -0,0 +1,98 @@
name: Dispatcher
on:
push:
branches:
- '**'
permissions:
contents: write
jobs:
dispatch:
runs-on: self-hosted
outputs:
engine: ${{ steps.check.outputs.engine }}
server: ${{ steps.check.outputs.server }}
ui: ${{ steps.check.outputs.ui }}
steps:
- name: Determine which tests to run
id: check
run: |
BRANCH="${{ github.ref_name }}"
echo "Branch: $BRANCH"
ENGINE=false
SERVER=false
UI=false
if [[ "$BRANCH" == *"Engine"* ]]; then
ENGINE=true
fi
if [[ "$BRANCH" == *"Server"* ]]; then
SERVER=true
fi
if [[ "$BRANCH" == *"UI"* ]]; then
UI=true
fi
# Run all on master
if [[ "$BRANCH" == "master" ]]; then
ENGINE=true
SERVER=true
UI=true
fi
echo "engine=$ENGINE" >> $GITHUB_OUTPUT
echo "server=$SERVER" >> $GITHUB_OUTPUT
echo "ui=$UI" >> $GITHUB_OUTPUT
engine:
needs: dispatch
if: needs.dispatch.outputs.engine == 'true'
uses: ./.github/workflows/engine_test.yml
secrets: inherit
server:
needs: dispatch
if: needs.dispatch.outputs.server == 'true'
uses: ./.github/workflows/server_test.yml
secrets: inherit
ui:
needs: dispatch
if: needs.dispatch.outputs.ui == 'true'
uses: ./.github/workflows/ui_test.yml
secrets: inherit
test-data-upload:
needs: [engine, server, ui]
runs-on: self-hosted
if: always()
#uses: ./.github/workflows/upload_data.yml
steps:
- name: Temp turn off
run: |
echo "Uploading data to table"
release:
needs: test-data-upload
if: github.ref == 'refs/heads/master'
uses: ./.github/workflows/release.yml
secrets: inherit
cleanup:
runs-on: self-hosted
needs: [engine, server, ui, test-data-upload, release]
if: always()
steps:
- name: Final cleanup
run: |
echo "Final cleanup on self-hosted runner..."
cd "$GITHUB_WORKSPACE"
git clean -fdx
git reset --hard

17
.github/workflows/engine_test.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: Engine Tests
on:
pull_request:
workflow_dispatch:
workflow_call:
jobs:
engine-tests:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Run Engine tests
run: |
bash .github/workflows/test.sh engine/

97
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,97 @@
name: Release build
on:
pull_request:
workflow_dispatch:
workflow_call:
permissions:
contents: write
jobs:
release:
name: Build and release (master only)
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build Engine for Linux
run: |
cd $(git rev-parse --show-toplevel)
pwd
mkdir release/linux -p
cd engine/
rustup target add x86_64-unknown-linux-gnu
cargo build --release --target x86_64-unknown-linux-gnu
pwd
cp target/x86_64-unknown-linux-gnu/release/engine $(git rev-parse --show-toplevel)/release/linux/engine
- name: Build Server for Linux
run: |
cd $(git rev-parse --show-toplevel)
pwd
mkdir release/linux -p
cd server/
rustup target add x86_64-unknown-linux-gnu
cargo build --release --target x86_64-unknown-linux-gnu
pwd
cp target/x86_64-unknown-linux-gnu/release/server $(git rev-parse --show-toplevel)/release/linux/server
- name: Build UI for Linux
run: |
cd $(git rev-parse --show-toplevel)
pwd
mkdir release/linux -p
cd ui/
rustup target add x86_64-unknown-linux-gnu
cargo build --release --target x86_64-unknown-linux-gnu
pwd
cp target/x86_64-unknown-linux-gnu/release/ui $(git rev-parse --show-toplevel)/release/linux/ui
- name: Build Engine for Windows
run: |
cd $(git rev-parse --show-toplevel)
pwd
mkdir release/windows -p
cd engine/
rustup target add x86_64-pc-windows-gnu
cargo build --release --target x86_64-pc-windows-gnu
pwd
cp target/x86_64-pc-windows-gnu/release/engine.exe $(git rev-parse --show-toplevel)/release/windows/engine.exe
- name: Build Server for Windows
run: |
cd $(git rev-parse --show-toplevel)
pwd
mkdir release/windows -p
cd server/
rustup target add x86_64-pc-windows-gnu
cargo build --release --target x86_64-pc-windows-gnu
pwd
cp target/x86_64-pc-windows-gnu/release/server.exe $(git rev-parse --show-toplevel)/release/windows/server.exe
- name: Build UI for Windows
run: |
cd $(git rev-parse --show-toplevel)
pwd
mkdir release/windows -p
cd ui/
rustup target add x86_64-pc-windows-gnu
cargo build --release --target x86_64-pc-windows-gnu
pwd
cp target/x86_64-pc-windows-gnu/release/ui.exe $(git rev-parse --show-toplevel)/release/windows/ui.exe
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: "v${{ github.run_number }}"
name: "Release v${{ github.run_number }}"
files: |
release/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

17
.github/workflows/server_test.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: Server Tests
on:
pull_request:
workflow_dispatch:
workflow_call:
jobs:
server-tests:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Run Server tests
run: |
bash .github/workflows/test.sh server/

37
.github/workflows/test.sh vendored Executable file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -e
# --- ARGUMENT CHECK ---
if [ -z "$1" ]; then
echo "Usage: $0 <project_path>"
exit 1
fi
# --- SETUP VARIABLES ---
PROJECT_PATH="$1"
PROJECT_NAME=$(basename "$PROJECT_PATH")
ROOT_DIR=$(git rev-parse --show-toplevel)
LOG_FILE="${PROJECT_NAME}_test.log"
FINAL_LOG="${ROOT_DIR}/test_data.log"
# --- MOVE TO PROJECT DIRECTORY ---
echo ">>> Running tests for project: $PROJECT_NAME"
cd "$PROJECT_PATH" || { echo "Error: Could not cd into $PROJECT_PATH"; exit 1; }
# --- RUN TESTS ---
cargo test --verbose | tee full_test_output.log
# --- EXTRACT TEST SECTION ---
# Create the log file with the project name as the first line
echo "$PROJECT_NAME" > "$LOG_FILE"
# Then append only the lines between "running X test(s)" and the first empty line
awk '/^running [0-9]+ test[s]?$/,/^$/' full_test_output.log >> "$LOG_FILE"
# --- APPEND TO GLOBAL LOG (in repo root) ---
cat "$LOG_FILE" >> "$FINAL_LOG"
# --- SUMMARY ---
echo ">>> Test output extracted to $PROJECT_PATH/$LOG_FILE"
echo ">>> Appended to $FINAL_LOG"

17
.github/workflows/ui_test.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: UI Tests
on:
pull_request:
workflow_dispatch:
workflow_call:
jobs:
ui-tests:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Run UI tests
run: |
bash .github/workflows/test.sh ui/

57
.github/workflows/upload_data.yml vendored Normal file
View File

@@ -0,0 +1,57 @@
name: Upload Test Results to Google Sheets
on:
workflow_dispatch:
jobs:
upload:
runs-on: self-hosted
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Python (for Google Sheets API)
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
pip install gspread google-auth
- name: Upload test_data.log to Google Sheets
env:
GOOGLE_SERVICE_ACCOUNT_JSON: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_JSON }}
SPREADSHEET_ID: ${{ secrets.SPREADSHEET_ID }}
run: |
echo "$GOOGLE_SERVICE_ACCOUNT_JSON" > service_account.json
python <<'PYCODE'
import gspread, json, time
# credentials
creds = json.load(open("service_account.json"))
gc = gspread.service_account_from_dict(creds)
sh = gc.open_by_key("${{ secrets.SPREADSHEET_ID }}")
with open("test_data.log", "r") as f:
lines = [line.strip() for line in f if line.strip()]
project = lines[0].lower()
worksheet = sh.worksheet(project)
# project name
data = lines[1:]
#blank rows
existing_rows = len(worksheet.get_all_values())
start_row = existing_rows + 3
# Split data into columns (by spaces)
rows_to_append = [row.split() for row in data]
for i, row in enumerate(rows_to_append):
worksheet.insert_row(row, start_row + i)
print(f"Uploaded {len(rows_to_append)} rows to '{project}' tab.")
PYCODE

View File

@@ -0,0 +1,4 @@
[target.x86_64-unknown-linux-gnu]
linker = "x86_64-linux-gnu-gcc"
[target.x86_64-pc-windows-gnu]
linker = "x86_64-w64-mingw32-gcc"

View File

@@ -0,0 +1,4 @@
[target.x86_64-unknown-linux-gnu]
linker = "x86_64-linux-gnu-gcc"
[target.x86_64-pc-windows-gnu]
linker = "x86_64-w64-mingw32-gcc"

4
ui/.cargo/config.toml Normal file
View File

@@ -0,0 +1,4 @@
[target.x86_64-unknown-linux-gnu]
linker = "x86_64-linux-gnu-gcc"
[target.x86_64-pc-windows-gnu]
linker = "x86_64-w64-mingw32-gcc"