diff --git a/.github/workflows/tests.yml b/.github/workflows/tests-e2e.yml similarity index 79% rename from .github/workflows/tests.yml rename to .github/workflows/tests-e2e.yml index cf1578eb5..9bf8e7478 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests-e2e.yml @@ -1,4 +1,4 @@ -name: Tests +name: Tests - E2E on: push: @@ -7,7 +7,7 @@ on: branches: [main] jobs: - test: + e2e: runs-on: ubuntu-latest steps: @@ -37,16 +37,15 @@ jobs: - name: Install Playwright browsers run: npx playwright install chromium - - name: Run tests - run: yarn test:ci - - - name: Build - run: yarn build + - name: Run e2e tests + env: + VITE_USE_LOCAL_RELAY: "true" + run: yarn playwright test --reporter=list - name: Upload test results uses: actions/upload-artifact@v4 - if: always() + if: ${{ always() && hashFiles('playwright-report/**') != '' }} with: - name: playwright-report + name: playwright-report-e2e path: playwright-report/ retention-days: 30 diff --git a/.github/workflows/tests-ndk.yml b/.github/workflows/tests-ndk.yml new file mode 100644 index 000000000..6db99baf2 --- /dev/null +++ b/.github/workflows/tests-ndk.yml @@ -0,0 +1,51 @@ +name: Tests - NDK + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + ndk: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + cache: "yarn" + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Cache wellorder dataset + uses: actions/cache@v4 + with: + path: dev-relay/nostr-wellorder-early-500k-v1.jsonl.bz2 + key: wellorder-dataset-v1 + + - name: Start local relay with Docker + run: (cd dev-relay && docker compose up -d --wait --wait-timeout 60) + + - name: Seed relay with test data + run: (cd dev-relay && bash quick-seed.sh 80000) + + - name: Install Playwright browsers + run: npx playwright install chromium + + - name: Run NDK tests + env: + VITE_USE_LOCAL_RELAY: "true" + run: yarn playwright test tests/webrtc-blossom-ndk.spec.ts --reporter=list + + - name: Upload test results + uses: actions/upload-artifact@v4 + if: ${{ always() && hashFiles('playwright-report/**') != '' }} + with: + name: playwright-report-ndk + path: playwright-report/ + retention-days: 30 diff --git a/.github/workflows/tests-unit.yml b/.github/workflows/tests-unit.yml new file mode 100644 index 000000000..f06660dfb --- /dev/null +++ b/.github/workflows/tests-unit.yml @@ -0,0 +1,29 @@ +name: Tests - Unit + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + unit: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + cache: "yarn" + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Run unit tests + run: yarn test:unit + + - name: Build + run: yarn build