Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/scripts/run-logged.sh
Original file line number Diff line number Diff line change
@@ -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 <log-name> <command> [args...]
set -u

name=$1
shift
log="${RUNNER_TEMP:-/tmp}/${name}.log"

"$@" >"$log" 2>&1
status=$?

cat "$log"
exit "$status"
10 changes: 5 additions & 5 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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' }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading