mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-28 05:12:33 +00:00
* chore: add CI secrets management and local testing script - Added ci-secrets.example.json to provide a template for CI secrets configuration. - Introduced test-ci-local.sh script to facilitate local testing of the package-and-publish workflow using act. - Updated .gitignore to exclude the actual ci-secrets.json file containing sensitive tokens. * chore: enhance local testing and environment loading scripts - Added scripts to load environment variables from .env and JSON files, improving local development setup. - Introduced ci-event.json to simulate GitHub event payloads for local CI testing. - Updated test-ci-local.sh to utilize the new event JSON for better integration with local testing workflows. - Modified .gitignore to include ci-secrets.local.json for local secret management. * chore: enhance environment loading and improve V8 memory management - Updated load-env.sh to conditionally load ci-secrets.local.json and set APPLE_PASSWORD for notarization. - Introduced a delay in auto-starting skills to prevent memory spikes during initialization. - Adjusted V8 runtime memory settings to minimize initial heap allocation, reducing the risk of OOM errors. * chore: update version bump workflow to modify tauri.conf.json - Changed the version update process to reflect changes in tauri.conf.json instead of Cargo.toml. - Adjusted the commit message to indicate the inclusion of tauri.conf.json in the version bump process. * chore: migrate from V8 to QuickJS runtime and update related configurations - Replaced V8 runtime references with QuickJS throughout the codebase, including updates to initialization and error handling. - Modified package.json to change the build command for macOS to source environment variables correctly. - Updated Cargo.toml to remove deno_core dependency and include rquickjs with appropriate features. - Cleaned up unused V8-related code and comments in the runtime modules. - Adjusted skill manifest checks to support QuickJS compatibility. * refactor: implement QuickJS runtime and remove V8 references - Replaced V8 engine with QuickJS in the runtime module, updating related imports and initialization logic. - Introduced new `qjs_engine.rs` and `qjs_skill_instance.rs` files to handle QuickJS-specific functionality. - Removed the deprecated `v8_skill_instance.rs` and associated V8-related code. - Updated JavaScript bootstrap code to align with QuickJS operations and APIs. - Adjusted documentation and comments to reflect the transition to QuickJS. * refactor: update IdbStorage to use parking_lot::Mutex for improved concurrency - Changed the connection management in IdbStorage from RwLock to parking_lot::Mutex for better performance. - Updated related methods to reflect the new locking mechanism, enhancing the efficiency of database operations. - Adjusted the IdbOpenResult struct to include serde::Serialize for potential serialization needs. * refactor: update QuickJS skill instance and timer management - Modified memory limit and stack size settings in QjsSkillInstance to be asynchronous, improving performance. - Cleaned up imports in qjs_ops.rs by removing unused dependencies and enhancing function definitions for clarity. - Refactored timer management functions for better readability and efficiency, including renaming and restructuring comments. * chore: update package.json scripts and clean up build.rs - Added a new script for running the Tauri app with environment variable loading. - Simplified the macOS development command to use a dedicated build script. - Removed unnecessary environment variable logging from build.rs to streamline the build process. - Cleaned up commented-out sections in the GitHub Actions workflow for Android packaging.
153 lines
5.3 KiB
Bash
Executable File
153 lines
5.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Test the package-and-publish workflow locally using `act`.
|
|
#
|
|
# Prerequisites:
|
|
# brew install act jq
|
|
#
|
|
# Setup:
|
|
# cp scripts/ci-secrets.example.json scripts/ci-secrets.json
|
|
# # Edit scripts/ci-secrets.json with your real values
|
|
#
|
|
# Usage:
|
|
# ./scripts/test-ci-local.sh # Run full workflow via act
|
|
# ./scripts/test-ci-local.sh --manual # Run build steps natively on macOS (recommended)
|
|
# ./scripts/test-ci-local.sh --list # List available jobs
|
|
# ./scripts/test-ci-local.sh --dryrun # Dry-run (show what would execute)
|
|
|
|
set -euo pipefail
|
|
cd "$(git rev-parse --show-toplevel)"
|
|
|
|
# ── Configuration ─────────────────────────────────────────────────────────────
|
|
|
|
WORKFLOW=".github/workflows/package-and-publish.yml"
|
|
SECRETS_JSON="scripts/ci-secrets.json"
|
|
EVENT_JSON="scripts/ci-event.json"
|
|
|
|
if [[ ! -f "$SECRETS_JSON" ]]; then
|
|
echo "ERROR: $SECRETS_JSON not found."
|
|
echo ""
|
|
echo "Create it from the example:"
|
|
echo " cp scripts/ci-secrets.example.json scripts/ci-secrets.json"
|
|
echo " # then fill in your values"
|
|
exit 1
|
|
fi
|
|
|
|
# ── Generate event payload with current HEAD ──────────────────────────────────
|
|
|
|
CURRENT_REF=$(git rev-parse HEAD)
|
|
cat > "$EVENT_JSON" <<EOF
|
|
{
|
|
"ref": "refs/heads/develop",
|
|
"before": "0000000000000000000000000000000000000000",
|
|
"after": "$CURRENT_REF",
|
|
"repository": {
|
|
"full_name": "vezuresdotxyz/alphahuman-frontend-runner",
|
|
"default_branch": "main",
|
|
"name": "alphahuman-frontend-runner",
|
|
"owner": { "login": "vezuresdotxyz" }
|
|
},
|
|
"head_commit": {
|
|
"id": "$CURRENT_REF",
|
|
"message": "local test build"
|
|
},
|
|
"sender": { "login": "local-dev" }
|
|
}
|
|
EOF
|
|
|
|
# ── Convert JSON to act-compatible KEY=VALUE files ────────────────────────────
|
|
|
|
SECRETS_FILE=$(mktemp)
|
|
VARS_FILE=$(mktemp)
|
|
trap 'rm -f "$SECRETS_FILE" "$VARS_FILE"' EXIT
|
|
|
|
# Extract "secrets" object → KEY=VALUE
|
|
jq -r '.secrets // {} | to_entries[] | "\(.key)=\(.value)"' "$SECRETS_JSON" > "$SECRETS_FILE"
|
|
|
|
# Extract "vars" object → KEY=VALUE
|
|
jq -r '.vars // {} | to_entries[] | "\(.key)=\(.value)"' "$SECRETS_JSON" > "$VARS_FILE"
|
|
|
|
echo "Loaded $(wc -l < "$SECRETS_FILE" | tr -d ' ') secrets and $(wc -l < "$VARS_FILE" | tr -d ' ') vars from $SECRETS_JSON"
|
|
|
|
# ── Common act arguments ──────────────────────────────────────────────────────
|
|
|
|
ACT_ARGS=(
|
|
-W "$WORKFLOW"
|
|
--secret-file "$SECRETS_FILE"
|
|
--var-file "$VARS_FILE"
|
|
--eventpath "$EVENT_JSON"
|
|
-P ubuntu-latest=catthehacker/ubuntu:act-latest
|
|
-P macos-latest=-self-hosted
|
|
)
|
|
|
|
# ── Handle CLI flags ──────────────────────────────────────────────────────────
|
|
|
|
if [[ "${1:-}" == "--list" ]]; then
|
|
echo "Available jobs in $WORKFLOW:"
|
|
act -W "$WORKFLOW" --list
|
|
exit 0
|
|
fi
|
|
|
|
if [[ "${1:-}" == "--dryrun" ]]; then
|
|
echo "Dry-run of workflow:"
|
|
act push "${ACT_ARGS[@]}" -n
|
|
exit 0
|
|
fi
|
|
|
|
# ── Manual macOS-native build (recommended) ───────────────────────────────────
|
|
|
|
if [[ "${1:-}" == "--manual" ]]; then
|
|
echo "=== Running build steps manually on macOS host ==="
|
|
echo ""
|
|
|
|
# Export VITE_* vars from the JSON so the frontend build picks them up
|
|
eval "$(jq -r '
|
|
(.secrets // {}) + (.vars // {})
|
|
| to_entries[]
|
|
| select(.key | startswith("VITE_"))
|
|
| "export \(.key)=\(.value | @sh)"
|
|
' "$SECRETS_JSON")"
|
|
|
|
# Step 1: Ensure OpenSSL is installed
|
|
echo ">>> Step 1: Ensure OpenSSL is installed"
|
|
brew install openssl@3 2>/dev/null || true
|
|
|
|
# Step 2: Install Node dependencies
|
|
echo ">>> Step 2: Install Node dependencies"
|
|
yarn install --frozen-lockfile
|
|
|
|
# Step 3: Install skills dependencies and build
|
|
echo ">>> Step 3: Build skills"
|
|
(cd skills && yarn install --frozen-lockfile && yarn build)
|
|
|
|
# Step 4: Build frontend
|
|
echo ">>> Step 4: Build frontend"
|
|
NODE_ENV=production yarn build
|
|
|
|
# Step 5: Build Tauri (aarch64)
|
|
echo ">>> Step 5: Build Tauri app (aarch64-apple-darwin)"
|
|
yarn tauri build --target aarch64-apple-darwin
|
|
|
|
echo ""
|
|
echo "=== Build complete ==="
|
|
echo "Check src-tauri/target/aarch64-apple-darwin/release/bundle/ for output"
|
|
exit 0
|
|
fi
|
|
|
|
# ── Default: run full workflow with act ────────────────────────────────────────
|
|
#
|
|
# We run the full workflow (not -j single-job) so act executes the dependency
|
|
# chain: get-version → check-version → create-release (skipped) → package-tauri.
|
|
# Using -j package-tauri alone fails because act can't resolve outputs from
|
|
# skipped `needs` jobs.
|
|
|
|
echo "=== Testing package-and-publish workflow locally ==="
|
|
echo ""
|
|
echo "Workflow: $WORKFLOW"
|
|
echo "Event: push to develop (from $EVENT_JSON)"
|
|
echo ""
|
|
echo "NOTE: act uses Docker containers — macOS-specific steps won't work."
|
|
echo "For a native macOS build, use: $0 --manual"
|
|
echo ""
|
|
|
|
act push "${ACT_ARGS[@]}" --verbose
|