# Run Unit test without Harnesses name: unit-ci on: workflow_dispatch: push: branches: - main - beta paths: - 'src/**' - 'test/**' - 'package.json' - 'package-lock.json' - 'tsconfig.json' - 'vite.config.ts' - 'vitest.config*.ts' - 'esbuild.config.mjs' - 'eslint.config.mjs' - 'eslint.config.common.mjs' - 'eslint.community.config.mjs' - 'update-workspaces.mjs' - 'version-bump.mjs' - 'utils/release-*.mjs' - 'utils/release-*.unit.spec.ts' - '.github/workflows/prepare-release.yml' - '.github/workflows/finalise-release.yml' - '.github/workflows/release.yml' - '.github/workflows/unit-ci.yml' pull_request: paths: - 'src/**' - 'test/**' - 'package.json' - 'package-lock.json' - 'tsconfig.json' - 'vite.config.ts' - 'vitest.config*.ts' - 'esbuild.config.mjs' - 'eslint.config.mjs' - 'eslint.config.common.mjs' - 'eslint.community.config.mjs' - 'update-workspaces.mjs' - 'version-bump.mjs' - 'utils/release-*.mjs' - 'utils/release-*.unit.spec.ts' - '.github/workflows/prepare-release.yml' - '.github/workflows/finalise-release.yml' - '.github/workflows/release.yml' - '.github/workflows/unit-ci.yml' permissions: contents: read jobs: unit-test: name: Unit Tests runs-on: ubuntu-latest timeout-minutes: 30 steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '24.x' cache: 'npm' - name: Install dependencies run: npm ci - name: Run source checks run: npm run check - name: Run unit tests suite with coverage run: npm run test:unit:coverage - name: Upload coverage report if: always() uses: actions/upload-artifact@v4 with: name: unit-coverage-report path: coverage/** integration-test: name: Integration Tests runs-on: ubuntu-latest timeout-minutes: 30 steps: - name: Checkout uses: actions/checkout@v4 - name: Detect LiveSync-owned integration tests id: integration_tests shell: bash run: | git ls-files -- ':(glob)**/*.integration.spec.ts' ':(glob)**/*.integration.test.ts' > "$RUNNER_TEMP/livesync-integration-tests.txt" if [[ -s "$RUNNER_TEMP/livesync-integration-tests.txt" ]]; then echo 'present=true' >> "$GITHUB_OUTPUT" else echo 'present=false' >> "$GITHUB_OUTPUT" fi - name: Record delegated integration coverage if: ${{ steps.integration_tests.outputs.present != 'true' }} run: echo 'No LiveSync-owned integration tests are present. Commonlib integration tests run in the Commonlib package CI.' >> "$GITHUB_STEP_SUMMARY" - name: Setup Node.js if: ${{ steps.integration_tests.outputs.present == 'true' }} uses: actions/setup-node@v4 with: node-version: '24.x' cache: 'npm' - name: Install dependencies if: ${{ steps.integration_tests.outputs.present == 'true' }} run: npm ci - name: Create environment configuration files if: ${{ steps.integration_tests.outputs.present == 'true' }} run: | cat < .env BUILD_MODE=dev PATHS_TEST_INSTALL= EOF cat < .test.env hostname=http://127.0.0.1:5989/ dbname=livesync-test-db2 username=admin password=testpassword minioEndpoint=http://127.0.0.1:9000 accessKey=minioadmin secretKey=minioadmin bucketName=livesync-test-bucket EOF - name: Start CouchDB container if: ${{ steps.integration_tests.outputs.present == 'true' }} run: npm run test:docker-couchdb:start - name: Start MinIO container if: ${{ steps.integration_tests.outputs.present == 'true' }} run: npm run test:docker-s3:start - name: Run integration tests if: ${{ steps.integration_tests.outputs.present == 'true' }} run: npm run test:integration - name: Stop containers if: ${{ always() && steps.integration_tests.outputs.present == 'true' }} run: | npm run test:docker-couchdb:stop || true npm run test:docker-s3:stop || true