diff --git a/.github/Dockerfile b/.github/Dockerfile index d8447ef6f..ce0e18970 100644 --- a/.github/Dockerfile +++ b/.github/Dockerfile @@ -2,7 +2,7 @@ FROM ubuntu:22.04 ENV DEBIAN_FRONTEND=noninteractive -# System deps for Tauri + mold linker + clang (for mold) +# System deps for Tauri + mold linker + clang + E2E testing (xvfb, dbus, webkit2gtk-driver) RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ cmake \ @@ -17,7 +17,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ patchelf \ mold \ clang \ + libclang-dev \ libssl-dev \ + xvfb \ + at-spi2-core \ + dbus-x11 \ + webkit2gtk-driver \ && rm -rf /var/lib/apt/lists/* # Rust 1.93.0 with minimal profile + fmt/clippy @@ -45,5 +50,12 @@ RUN curl -fsSL https://github.com/mozilla/sccache/releases/download/v0.10.0/scca | tar xz -C /usr/local/bin --strip-components=1 sccache-v0.10.0-x86_64-unknown-linux-musl/sccache \ && chmod +x /usr/local/bin/sccache +# tauri-driver (WebDriver server for Tauri E2E tests) +RUN cargo install tauri-driver --version 2.0.5 + +# E2E entrypoint (starts Xvfb + dbus for headless webkit2gtk testing) +COPY e2e/docker-entrypoint.sh /docker-entrypoint.sh +RUN chmod +x /docker-entrypoint.sh + # Verify installs -RUN rustc --version && cargo --version && node --version && yarn --version && mold --version && sccache --version +RUN rustc --version && cargo --version && node --version && yarn --version && mold --version && sccache --version && tauri-driver --version diff --git a/.github/workflows/docker-ci-image.yml b/.github/workflows/docker-ci-image.yml index 30a140b30..a79a09554 100644 --- a/.github/workflows/docker-ci-image.yml +++ b/.github/workflows/docker-ci-image.yml @@ -6,6 +6,7 @@ on: paths: - ".github/Dockerfile" - ".github/workflows/docker-ci-image.yml" + - "e2e/docker-entrypoint.sh" workflow_dispatch: permissions: @@ -30,9 +31,10 @@ jobs: - name: Build and push uses: docker/build-push-action@v6 with: - context: .github + context: . file: .github/Dockerfile push: true + provenance: false tags: | ghcr.io/tinyhumansai/openhuman_ci:latest ghcr.io/tinyhumansai/openhuman_ci:rust-1.93.0 diff --git a/e2e/Dockerfile b/e2e/Dockerfile index 43202fc45..91fe4f4ab 100644 --- a/e2e/Dockerfile +++ b/e2e/Dockerfile @@ -1,15 +1,15 @@ ## -# Linux E2E environment for OpenHuman desktop app. +# DEPRECATED: E2E tests now use the shared CI image from GHCR. # -# Mirrors the ubuntu-22.04 CI runner so macOS developers can run the -# same Linux-based E2E stack locally via Docker. +# The CI image (.github/Dockerfile) includes all E2E dependencies +# (xvfb, dbus, tauri-driver, webkit2gtk-driver). # # Usage: # docker compose -f e2e/docker-compose.yml run --rm e2e # -# Or manually: -# docker build -t openhuman-e2e -f e2e/Dockerfile . -# docker run --rm -v "$(pwd):/app" openhuman-e2e yarn workspace openhuman-app test:e2e:all +# To build the CI image locally (if you can't pull from GHCR): +# docker build -t openhuman-ci -f .github/Dockerfile . +# IMAGE=openhuman-ci docker compose -f e2e/docker-compose.yml run --rm e2e # FROM ubuntu:22.04 @@ -42,8 +42,5 @@ RUN cargo install tauri-driver --version 2.0.5 WORKDIR /app -COPY e2e/docker-entrypoint.sh /docker-entrypoint.sh -RUN chmod +x /docker-entrypoint.sh - ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["yarn", "workspace", "openhuman-app", "test:e2e:all"] diff --git a/e2e/docker-compose.yml b/e2e/docker-compose.yml index ee2a50c71..7f09a9a2f 100644 --- a/e2e/docker-compose.yml +++ b/e2e/docker-compose.yml @@ -14,19 +14,21 @@ # yarn workspace openhuman-app test:e2e:build # # Notes: +# - Uses the same CI image from GHCR (built by .github/workflows/docker-ci-image.yml) # - The repo is bind-mounted at /app so builds persist between runs # - Rust target/ and node_modules/ are cached via named volumes # - Xvfb provides a virtual display for webkit2gtk rendering # services: e2e: - build: - context: .. - dockerfile: e2e/Dockerfile + image: ghcr.io/tinyhumansai/openhuman_ci:latest + entrypoint: ["/docker-entrypoint.sh"] + command: ["yarn", "workspace", "openhuman-app", "test:e2e:all"] + working_dir: /app volumes: - ..:/app - - e2e-cargo-registry:/root/.cargo/registry - - e2e-cargo-git:/root/.cargo/git + - e2e-cargo-registry:/usr/local/cargo/registry + - e2e-cargo-git:/usr/local/cargo/git environment: - DISPLAY=:99 - CI=true