Files
openhuman/.github/workflows/test.yml
T
Steven EnamakelandGitHub 5ecc7cbc75 refactor: consolidate CLI binaries and streamline CI workflows (#44)
* chore: update dependencies and remove unused packages

- Removed several unused dependencies from package.json, including `@tauri-apps/plugin-shell`, `@types/react-router-dom`, `immer`, `qrcode.react`, and `@testing-library/user-event`.
- Updated the Vite configuration to exclude `telegram` from the optimizeDeps include list.
- Cleaned up yarn.lock by removing references to deleted packages.
- Deleted outdated GitHub Actions workflows for macOS ARM64 build, package and publish, and update changelog.

* refactor: consolidate CLI binaries and update configurations

- Renamed the main binary from `openhuman-core` to `openhuman` for consistency across the project.
- Removed the `openhuman-cli` and `openhuman-core` binaries, consolidating functionality into the new `openhuman` binary.
- Updated build configurations in GitHub Actions and Tauri to reflect the new binary name and paths.
- Adjusted the Tailwind and Vite configurations to point to the correct HTML and source directories.
- Introduced a new method in the Rust core server for handling JSON-RPC calls, enhancing the API structure.

* chore: update subproject commit reference in skills

* chore: update Rust test workflow and improve CLI command formatting

- Modified the GitHub Actions workflow to include a new job for running Rust tests in the workspace.
- Updated the `test:rust` command in `package.json` to run tests for the entire workspace.
- Refactored CLI command definitions in `openhuman.rs` for improved readability by consolidating struct fields into single lines.

* chore: enhance E2E testing scripts and workflows

- Updated `.prettierignore` to exclude the `rust-core` directory.
- Added new E2E testing commands in `package.json` for running all flows and improved formatting commands to include `cargo fmt`.
- Enhanced GitHub Actions workflows to streamline E2E testing, including new scripts for running individual specs and all flows sequentially.
- Refactored existing E2E scripts to utilize a common function for running tests, improving maintainability and readability.
- Introduced a new script for resolving Node.js and Appium dependencies, ensuring compatibility for E2E tests.
- Cleaned up and simplified existing E2E scripts by removing redundant code and consolidating functionality.

* chore: update GitHub Actions workflows for Tauri build process

- Modified build and release workflows to reference the correct target directory for Rust binaries, ensuring compatibility with the Cargo workspace structure.
- Adjusted caching configuration in the test workflow for consistency and improved readability.
- Standardized environment variable formatting in the test workflow to enhance clarity.

* fix: standardize string formatting in GitHub Actions workflows

- Updated the test workflow to use single quotes for cache configuration and environment variables, enhancing consistency across the file.
2026-03-27 13:58:29 -07:00

141 lines
3.6 KiB
YAML

name: Test
on:
push:
pull_request:
permissions:
contents: read
pull-requests: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Run Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Setup Node.js 24.x
uses: actions/setup-node@v4
with:
node-version: 24.x
cache: 'yarn'
- name: Cache node modules
id: yarn-cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-test-
${{ runner.os }}-build-
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- name: Run tests with coverage
run: yarn test:coverage
env:
NODE_ENV: test
- name: Upload coverage reports
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage
retention-days: 7
rust-tests:
name: Run Rust Tests
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
- name: Install Tauri build dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
# Match build.yml: lockfile body only (skip workspace version header noise)
- name: Cargo.lock fingerprint (deps only)
id: cargo-lock-fingerprint
shell: bash
run: |
echo "hash=$(tail -n +8 Cargo.lock | openssl dgst -sha256 | awk '{print $2}')" >> "$GITHUB_OUTPUT"
- name: Cache Cargo registry and git sources
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-rust-test-cargo-${{ steps.cargo-lock-fingerprint.outputs.hash }}
restore-keys: |
${{ runner.os }}-rust-test-cargo-
- name: Test rust-core (openhuman-core)
run: cargo test -p openhuman-core
- name: Test src-tauri (OpenHuman)
run: cargo test -p OpenHuman
e2e-macos:
name: E2E (macOS / Appium)
runs-on: macos-latest
timeout-minutes: 90
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: recursive
- name: Setup Node.js 24.x
uses: actions/setup-node@v4
with:
node-version: 24.x
cache: 'yarn'
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Install skills dependencies
run: cd skills && yarn install --frozen-lockfile
- name: Ensure .env exists for E2E build
run: touch .env
- name: Install Appium and mac2 driver
run: |
npm install -g appium
appium driver install mac2
- name: Build E2E app bundle
run: yarn test:e2e:build
env:
E2E_SKIP_CARGO_CLEAN: '1'
- name: Run all E2E flows
run: yarn test:e2e:all:flows