Added release workflow, started work on the upload to spreadsheet
This commit is contained in:
15
.github/workflows/dispatcher.yml
vendored
15
.github/workflows/dispatcher.yml
vendored
@@ -62,9 +62,22 @@ jobs:
|
||||
uses: ./.github/workflows/ui_test.yml
|
||||
secrets: inherit
|
||||
|
||||
|
||||
#test-data-upload:
|
||||
#needs: [engine, server, ui]
|
||||
#if: always()
|
||||
#uses: ./.github/workflows/upload_data.yml
|
||||
#secrets: inherit
|
||||
|
||||
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]
|
||||
needs: [engine, server, ui, test-data-upload]
|
||||
if: always()
|
||||
steps:
|
||||
- name: Final cleanup
|
||||
|
||||
97
.github/workflows/release.yml
vendored
Normal file
97
.github/workflows/release.yml
vendored
Normal 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 }}
|
||||
|
||||
|
||||
57
.github/workflows/upload_data.yml
vendored
Normal file
57
.github/workflows/upload_data.yml
vendored
Normal 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
|
||||
Reference in New Issue
Block a user