OverviewFilesCommitsIssuesDocsReleasesPeers

P2P-Hiverelay / .github / workflows / test.yml

93 lines · yaml ref:
name: Test

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v6
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      - run: npm run lint

  unit-tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v6
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      - run: npm run test:unit

  blind-sdk-tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v6
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      - run: >-
          ./node_modules/.bin/brittle-node --timeout 120000
          packages/blind-client/test/policy.test.js
          packages/blind-client/test/cells.test.js
      - run: ./node_modules/.bin/brittle-node --timeout 120000 test/simulation/blind-capacity-lab.test.js
      - run: npm run verify:blind-client:browser-artifact:release

  integration-tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v6
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      - run: npm run test:integration
        # Integration tests spin up real Hyperswarm testnets + Hypercore
        # replication. The previous 5-minute cap killed the suite mid-run
        # (CI green up to test #65 then SIGKILL). 15 is generous headroom
        # for the slowest-runner edge case.
        timeout-minutes: 15

  bare-tests:
    # Executes the test suite under the REAL Bare runtime (not Node), so the
    # `bare` condition of the imports map resolves to bare-events / bare-fs /
    # bare-http1 / bare-path instead of Node built-ins. This is the runtime
    # verification gate the storage-stack upgrade (corestore 7 / hypercore 11)
    # depends on — nothing else in CI actually loads the Bare module graph.
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v6
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      # Put the pinned `bare` devDependency's runtime launcher on PATH so the
      # brittle-bare runner (shebang `#!/usr/bin/env bare`) can find it. Using
      # the pinned dep keeps the runtime version reproducible — no global install.
      - run: echo "$GITHUB_WORKSPACE/node_modules/bare/bin" >> "$GITHUB_PATH"
      - run: npm run test:bare

  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v6
        with:
          node-version: 22
          cache: npm
      - run: npm audit --omit=dev