diff --git a/.github/ci-probe/handles.cjs b/.github/ci-probe/handles.cjs new file mode 100644 index 00000000..0feb8e92 --- /dev/null +++ b/.github/ci-probe/handles.cjs @@ -0,0 +1,19 @@ +const t0 = Date.now(); +const describe = h => { + const n = h && h.constructor ? h.constructor.name : typeof h; + const o = { type: n }; + if (h.spawnargs) Object.assign(o, { pid: h.pid, args: h.spawnargs.join(' ').slice(0, 300), exit: h.exitCode }); + if (typeof h.remoteAddress !== 'undefined' || typeof h.localPort !== 'undefined') + Object.assign(o, { remote: `${h.remoteAddress}:${h.remotePort}`, local: h.localPort, fd: h._handle && h._handle.fd, destroyed: h.destroyed }); + if (typeof h.address === 'function' && !h.remoteAddress) { try { o.listen = JSON.stringify(h.address()); } catch {} } + if (h._onTimeout) Object.assign(o, { ms: h._idleTimeout, fn: String(h._onTimeout).slice(0, 300) }); + return o; +}; +const iv = setInterval(() => { + const s = (Date.now() - t0) / 1000; + if (s < 30) return; + console.error(`[handles pid=${process.pid} +${s}s]`, JSON.stringify(process.getActiveResourcesInfo())); + for (const h of process._getActiveHandles()) if (h !== iv) console.error(' ', JSON.stringify(describe(h))); + for (const r of process._getActiveRequests()) console.error(' req', r && r.constructor && r.constructor.name); +}, 15000); +iv.unref(); diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d0c0aefd..dc320b8e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,164 +2,38 @@ name: Tests on: pull_request: - push: - branches: [main] permissions: contents: read -concurrency: - group: tests-${{ github.ref }} - cancel-in-progress: true - jobs: - # The image of the Host tests job (.github/ci/Dockerfile), tagged with a - # hash of its Dockerfile. It is built and pushed only when no image has that - # tag; otherwise this job only looks it up. A pull request from a fork - # cannot push, so one that changes the Dockerfile fails here. - ci-image: - name: CI image - runs-on: ubuntu-24.04 - permissions: - contents: read - packages: write - outputs: - image: ${{ steps.image.outputs.image }} - env: - DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - steps: - - uses: actions/checkout@v4 - with: - sparse-checkout: .github/ci - - name: Name the image - id: image - shell: bash - run: | - image="ghcr.io/${GITHUB_REPOSITORY,,}-ci:$(sha256sum .github/ci/Dockerfile | cut -c1-16)" - echo "image=$image" >> "$GITHUB_OUTPUT" - echo "IMAGE=$image" >> "$GITHUB_ENV" - - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Look for the image - id: found - run: | - if docker manifest inspect "$IMAGE" > /dev/null 2>&1; then - echo "found=true" >> "$GITHUB_OUTPUT" - echo "$IMAGE exists" - fi - # Docker Hub limits the pulls without a login per address, and the - # hosted runners share their addresses. - - if: steps.found.outputs.found != 'true' && env.DOCKERHUB_USERNAME != '' - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push the image - if: steps.found.outputs.found != 'true' - run: | - docker build -t "$IMAGE" .github/ci - docker push "$IMAGE" - - host: - name: Host tests - needs: ci-image + probe: + name: combined_load hang probe runs-on: ubuntu-24.04 + timeout-minutes: 15 permissions: contents: read packages: read container: - image: ${{ needs.ci-image.outputs.image }} + image: ghcr.io/jetkvm/mini-ci:9393893429bfe333 credentials: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v4 - # The managed components as the component manager downloads them, with - # the project's patches applied, which the configure step finds applied. - # CMakeLists.txt registers the patches. - - uses: actions/cache@v4 - with: - path: managed_components - key: managed-components-${{ hashFiles('dependencies.lock', 'CMakeLists.txt', 'cmake/apply_managed_component_patch.cmake', 'patches/*.patch', '**/idf_component.yml') }} - - name: Configure the firmware and run the host tests - # The configure step downloads the managed components, applies the - # project's patches and writes the sdkconfig that the firmware tests - # read; a fresh build directory can stop once with "Run the build - # again" (CMakeLists.txt). The tool tests need none of it, so they - # run meanwhile. + - name: Run combined_load 8 times, 4 at a time shell: bash run: | - . "$IDF_PATH/export.sh" > /dev/null - tools/run_all_tests.sh tools > tools-tests.log 2>&1 & - tools_tests=$! - # components/web_app refuses to configure without a built UI. The - # host tests do not read it, so a placeholder page is enough here; - # the frontend job builds the real one. - mkdir -p frontend/jetkvm-ui/dist-p4 - echo '