name: Test on: push: branches: [main] 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: unit-tests: name: Frontend 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: Rust Tests + Quality runs-on: ubuntu-22.04 container: image: ghcr.io/tinyhumansai/openhuman_ci:rust-1.93.0 steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 1 - name: Cache Rust build artifacts uses: Swatinem/rust-cache@v2 with: workspaces: | . -> target app/src-tauri -> target cache-on-failure: true - name: Check formatting (cargo fmt) run: cargo fmt --all -- --check - name: Run clippy (core crate) run: cargo clippy -p openhuman - name: Test core crate (openhuman) run: cargo test -p openhuman - name: Build sidecar core binary run: cargo build --profile ci --target x86_64-unknown-linux-gnu --bin openhuman-core - name: Stage sidecar for Tauri shell tests run: | mkdir -p app/src-tauri/binaries cp target/x86_64-unknown-linux-gnu/ci/openhuman-core app/src-tauri/binaries/openhuman-core-x86_64-unknown-linux-gnu chmod +x app/src-tauri/binaries/openhuman-core-x86_64-unknown-linux-gnu - name: Test Tauri shell (OpenHuman) run: cargo test --manifest-path app/src-tauri/Cargo.toml