diff --git a/.github/workflows/cli-deno-tests.yml b/.github/workflows/cli-deno-tests.yml index 60e8450..2bf8753 100644 --- a/.github/workflows/cli-deno-tests.yml +++ b/.github/workflows/cli-deno-tests.yml @@ -1,17 +1,39 @@ name: cli-deno-tests on: + push: + branches: + - main + - beta + paths: + - '.github/workflows/cli-deno-tests.yml' + - 'src/apps/cli/**' + - 'src/lib/src/API/processSetting.ts' + - 'package.json' + - 'package-lock.json' + pull_request: + paths: + - '.github/workflows/cli-deno-tests.yml' + - 'src/apps/cli/**' + - 'src/lib/src/API/processSetting.ts' + - 'package.json' + - 'package-lock.json' workflow_dispatch: inputs: test_task: description: 'Deno test task to run' type: choice options: - - test + - test:ci + - test:p2p + - test:all - test:local - test:e2e-matrix - - test:p2p-sync - default: test + default: test:ci + enable_debug: + description: 'Enable verbose and debug logging' + type: boolean + default: false permissions: contents: read @@ -27,11 +49,17 @@ jobs: shell: bash run: | set -euo pipefail - SELECTED_TASK="${{ github.event_name == 'workflow_dispatch' && inputs.test_task || 'test' }}" + SELECTED_TASK="${{ github.event_name == 'workflow_dispatch' && inputs.test_task || 'test:ci' }}" echo "[INFO] Selected task set: $SELECTED_TASK" case "$SELECTED_TASK" in - test) + test:ci) + TASK_MATRIX='["test:setup-put-cat","test:mirror","test:push-pull","test:sync-two-local","test:sync-locked-remote","test:e2e-matrix:couchdb-enc0","test:e2e-matrix:couchdb-enc1","test:e2e-matrix:minio-enc0","test:e2e-matrix:minio-enc1"]' + ;; + test:p2p) + TASK_MATRIX='["test:p2p-host","test:p2p-peers","test:p2p-sync","test:p2p-three-nodes","test:p2p-upload-download"]' + ;; + test:all) TASK_MATRIX='["test:setup-put-cat","test:mirror","test:push-pull","test:sync-two-local","test:sync-locked-remote","test:p2p-host","test:p2p-peers","test:p2p-sync","test:p2p-three-nodes","test:p2p-upload-download","test:e2e-matrix:couchdb-enc0","test:e2e-matrix:couchdb-enc1","test:e2e-matrix:minio-enc0","test:e2e-matrix:minio-enc1"]' ;; test:local) @@ -40,9 +68,6 @@ jobs: test:e2e-matrix) TASK_MATRIX='["test:e2e-matrix:couchdb-enc0","test:e2e-matrix:couchdb-enc1","test:e2e-matrix:minio-enc0","test:e2e-matrix:minio-enc1"]' ;; - test:p2p-sync) - TASK_MATRIX='["test:p2p-sync"]' - ;; *) echo "[ERROR] Unknown task set: $SELECTED_TASK" >&2 exit 1 @@ -113,6 +138,8 @@ jobs: env: LIVESYNC_DOCKER_MODE: native LIVESYNC_CLI_RETRY: 3 + LIVESYNC_CLI_DEBUG: ${{ inputs.enable_debug == true && '1' || '0' }} + LIVESYNC_CLI_VERBOSE: ${{ inputs.enable_debug == true && '1' || '0' }} run: | TASK="${{ matrix.task }}" echo "[INFO] Running Deno task: $TASK" diff --git a/.github/workflows/cli-e2e.yml b/.github/workflows/cli-e2e.yml index 0371a0d..1738860 100644 --- a/.github/workflows/cli-e2e.yml +++ b/.github/workflows/cli-e2e.yml @@ -12,23 +12,6 @@ on: - two-vaults-couchdb - two-vaults-minio default: two-vaults-matrix - push: - branches: - - main - - beta - paths: - - '.github/workflows/cli-e2e.yml' - - 'src/apps/cli/**' - - 'src/lib/src/API/processSetting.ts' - - 'package.json' - - 'package-lock.json' - pull_request: - paths: - - '.github/workflows/cli-e2e.yml' - - 'src/apps/cli/**' - - 'src/lib/src/API/processSetting.ts' - - 'package.json' - - 'package-lock.json' permissions: contents: read diff --git a/src/apps/cli/testdeno/helpers/p2p.ts b/src/apps/cli/testdeno/helpers/p2p.ts index efd8f7f..a7381d7 100644 --- a/src/apps/cli/testdeno/helpers/p2p.ts +++ b/src/apps/cli/testdeno/helpers/p2p.ts @@ -84,6 +84,9 @@ export async function maybeStartLocalRelay(relay: string): Promise { intervalMs: Number(Deno.env.get("LIVESYNC_P2P_RELAY_READY_INTERVAL_MS") ?? "250"), connectTimeoutMs: Number(Deno.env.get("LIVESYNC_P2P_RELAY_CONNECT_TIMEOUT_MS") ?? "1000"), }); + // Docker proxy accepts TCP connections instantly before the container's internal process is fully ready. + // Wait an additional few seconds to ensure strfry is actually accepting WebSockets. + await sleep(3000); return true; } diff --git a/src/apps/cli/testdeno/test_dev_deno.md b/src/apps/cli/testdeno/test_dev_deno.md index acc07ba..9ad15ae 100644 --- a/src/apps/cli/testdeno/test_dev_deno.md +++ b/src/apps/cli/testdeno/test_dev_deno.md @@ -281,7 +281,7 @@ deno task test:sync-two-local ## Continuous Integration -The GitHub Actions workflow `.github/workflows/cli-deno-tests.yml` is used to run these tests automatically on push and pull requests affecting the CLI. +The GitHub Actions workflow `.github/workflows/cli-deno-tests.yml` runs automatically on pushes and pull requests affecting the CLI, executing the non-P2P test suite (`test:ci`). P2P tests (`test:p2p`) are excluded from automatic execution and must be run via manual dispatch (`workflow_dispatch`). You can optionally check the "Enable verbose and debug logging" checkbox during a manual dispatch to produce detailed trace logs for troubleshooting. ---