diff --git a/.github/scripts/run-logged.sh b/.github/scripts/run-logged.sh new file mode 100755 index 0000000000..615d777e84 --- /dev/null +++ b/.github/scripts/run-logged.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# Run a command with its output in a regular file, then print that file. +# +# Vite Task forwards task output to its own stdout. When that stdout is a +# pipe, the Node processes it spawns for tasks set O_NONBLOCK on the shared +# file description for as long as they run (Node does this to every pipe it +# touches; vp clears it at startup but cannot stop its children re-setting +# it). A large burst of forwarded output while such a child is alive then +# fills the pipe and the write fails with +# "Failed to forward task process output: Resource temporarily unavailable +# (os error 11)" +# which Vite Task records as a failed task even though the task finished. +# Node only makes pipes non-blocking, and writes to a regular file never +# return EAGAIN, so route the output through a file and replay it afterwards. +# +# Usage: run-logged.sh [args...] +set -u + +name=$1 +shift +log="${RUNNER_TEMP:-/tmp}/${name}.log" + +"$@" >"$log" 2>&1 +status=$? + +cat "$log" +exit "$status" diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 2c42ae5bea..49d682c696 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -89,15 +89,15 @@ jobs: - name: Clean if: ${{ steps.release.outputs.releases_created == 'true' }} - run: pnpm clean + run: .github/scripts/run-logged.sh clean pnpm clean - name: Build if: ${{ steps.release.outputs.releases_created == 'true' }} - run: pnpm build:packages + run: .github/scripts/run-logged.sh build-packages pnpm build:packages - name: Build CDN bundles if: ${{ steps.release.outputs.releases_created == 'true' }} - run: pnpm build:cdn + run: .github/scripts/run-logged.sh build-cdn pnpm build:cdn # Fail before publishing rather than ship bundles that reach out to a public # CDN at runtime, which would break self-hosted and archive installs. @@ -115,11 +115,11 @@ jobs: # The site task and CLI dependency graph let Vite Task reuse the package builds here. - name: Build site (required by html/react prepack and CLI) if: ${{ steps.release.outputs.releases_created == 'true' }} - run: pnpm build:site + run: .github/scripts/run-logged.sh build-site pnpm build:site - name: Build CLI if: ${{ steps.release.outputs.releases_created == 'true' }} - run: pnpm build:cli + run: .github/scripts/run-logged.sh build-cli pnpm build:cli - name: Publish if: ${{ steps.release.outputs.releases_created == 'true' }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5db570e94c..7b8778cf58 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -181,7 +181,7 @@ jobs: filters+=(--filter "$package") done < <(jq -r '.[]' <<<"$PACKAGES") - pnpm exec vp run --fail-if-no-match "${filters[@]}" test:ci + .github/scripts/run-logged.sh test-packages pnpm exec vp run --fail-if-no-match "${filters[@]}" test:ci test-spf: needs: package_test_selection @@ -217,7 +217,7 @@ jobs: vite-task-${{ runner.os }}-${{ runner.arch }}-packages- - name: Test SPF - run: pnpm exec vp run @videojs/spf#test:ci + run: .github/scripts/run-logged.sh test-spf pnpm exec vp run @videojs/spf#test:ci workspace: needs: install