name: cli-deno-tests on: push: branches: - main - beta paths: - '.github/workflows/cli-deno-tests.yml' - 'src/apps/cli/**' - '!src/apps/cli/**/*.md' - 'src/LiveSyncBaseCore.ts' - 'src/common/**' - 'src/serviceFeatures/**' - 'src/serviceModules/**' - 'src/integrations/**' - 'src/modules/AbstractModule.ts' - 'src/modules/main/**' - 'src/modules/coreFeatures/**' - 'manifest.json' - 'tsconfig.json' - 'package.json' - 'package-lock.json' pull_request: paths: - '.github/workflows/cli-deno-tests.yml' - 'src/apps/cli/**' - '!src/apps/cli/**/*.md' - 'src/LiveSyncBaseCore.ts' - 'src/common/**' - 'src/serviceFeatures/**' - 'src/serviceModules/**' - 'src/integrations/**' - 'src/modules/AbstractModule.ts' - 'src/modules/main/**' - 'src/modules/coreFeatures/**' - 'manifest.json' - 'tsconfig.json' - 'package.json' - 'package-lock.json' workflow_dispatch: inputs: test_task: description: 'Deno test task to run' type: choice options: - test:ci - test:local - test:e2e-matrix default: test:ci enable_debug: description: 'Enable verbose and debug logging' type: boolean default: false use_coturn: description: 'Enable local coturn container for P2P tests' type: boolean default: false permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: prepare: runs-on: ubuntu-latest timeout-minutes: 15 env: NODE_OPTIONS: --max-old-space-size=3072 outputs: task_matrix: ${{ steps.select.outputs.task_matrix }} steps: - name: Checkout uses: actions/checkout@v5 - name: Select task matrix id: select shell: bash env: SELECTED_TASK: ${{ github.event_name == 'workflow_dispatch' && inputs.test_task || 'test:ci' }} run: | set -euo pipefail echo "[INFO] Selected task set: $SELECTED_TASK" case "$SELECTED_TASK" in test:ci) TASK_MATRIX=$(jq -c . src/apps/cli/testdeno/ci-tasks.json) ;; test:local) TASK_MATRIX='["test:setup-put-cat","test:mirror","test:daemon"]' ;; 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"]' ;; *) echo "[ERROR] Unknown task set: $SELECTED_TASK" >&2 exit 1 ;; esac echo "task_matrix=$TASK_MATRIX" >> "$GITHUB_OUTPUT" - name: Setup Node.js uses: actions/setup-node@v5 with: node-version: '24.x' cache: 'npm' - name: Install dependencies run: npm ci - name: Build CLI working-directory: src/apps/cli run: npm run build - name: Upload CLI bundle uses: actions/upload-artifact@v6 with: name: cli-bundle path: src/apps/cli/dist/ if-no-files-found: error retention-days: 1 test: needs: prepare runs-on: ubuntu-latest timeout-minutes: 60 env: DENO_DIR: ~/.cache/deno strategy: fail-fast: false matrix: task: ${{ fromJson(needs.prepare.outputs.task_matrix) }} steps: - name: Checkout uses: actions/checkout@v5 - name: Setup Node.js uses: actions/setup-node@v5 with: node-version: '24.x' cache: 'npm' cache-dependency-path: package-lock.json - name: Setup Deno uses: denoland/setup-deno@v2 with: deno-version: v2.x - name: Cache Deno dependencies uses: actions/cache@v5 with: path: ~/.cache/deno key: ${{ runner.os }}-deno-${{ hashFiles('src/apps/cli/testdeno/deno.lock', 'src/apps/cli/testdeno/deno.json') }} restore-keys: | ${{ runner.os }}-deno- - name: Install dependencies run: npm ci - name: Download CLI bundle uses: actions/download-artifact@v8 with: name: cli-bundle path: src/apps/cli/dist/ - name: Create .test.env working-directory: src/apps/cli run: | cat < .test.env hostname=http://127.0.0.1:5989/ dbname=livesync-test-db-ci username=admin password=testpassword minioEndpoint=http://127.0.0.1:9000 accessKey=minioadmin secretKey=minioadmin bucketName=livesync-test-bucket-ci EOF - name: Run Deno tests working-directory: src/apps/cli/testdeno 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' }} LIVESYNC_USE_COTURN: ${{ inputs.use_coturn == true && '1' || '0' }} run: | TASK="${{ matrix.task }}" echo "[INFO] Running Deno task: $TASK" deno task "$TASK" - name: Stop leftover containers if: always() run: | docker stop couchdb-test minio-test relay-test coturn-test >/dev/null 2>&1 || true docker rm couchdb-test minio-test relay-test coturn-test >/dev/null 2>&1 || true