Skip to content

🎥 Make videos programmatically with React

Experiment: Run only affected CI test groups (#10095)

Igor Samokhovets2495adb31d2c
diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml
index 2888081781..677aaab9de 100644
--- a/.github/workflows/push.yml
+++ b/.github/workflows/push.yml
@@ -13,8 +13,113 @@ env:
FORCE_COLOR: 1
TURBO_TELEMETRY_DISABLED: 1
TURBO_NO_UPDATE_NOTIFIER: 1
+ TURBO_SCM_BASE: ${{ github.event.pull_request.base.sha }}
+ TURBO_SCM_HEAD: ${{ github.sha }}
jobs:
+ affected:
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ name: Determine affected tests
+ outputs:
+ lambda: ${{ steps.query.outputs.lambda }}
+ nextjs: ${{ steps.query.outputs.nextjs }}
+ browser: ${{ steps.query.outputs.browser }}
+ webrenderer: ${{ steps.query.outputs.webrenderer }}
+ ssr: ${{ steps.query.outputs.ssr }}
+ templates: ${{ steps.query.outputs.templates }}
+ build: ${{ steps.query.outputs.build }}
+ build_matrix: ${{ steps.query.outputs.build_matrix }}
+ bundle_example: ${{ steps.query.outputs.bundle_example }}
+ steps:
+ - uses: actions/checkout@v6
+ with:
+ fetch-depth: 0
+ filter: blob:none
+ - uses: oven-sh/[email protected]
+ with:
+ bun-version: 1.3.3
+ - name: Query Turborepo task graph
+ id: query
+ run: |
+ set -euo pipefail
+
+ full_matrix='{"include":[{"os":"ubuntu-latest","node_version":16},{"os":"windows-latest","node_version":16},{"os":"macos-latest","node_version":25}]}'
+ linux_matrix='{"include":[{"os":"ubuntu-latest","node_version":16}]}'
+
+ run_all_test_groups() {
+ for output in lambda nextjs browser webrenderer ssr templates build bundle_example; do
+ echo "$output=true" >> "$GITHUB_OUTPUT"
+ done
+ echo "build_matrix=$full_matrix" >> "$GITHUB_OUTPUT"
+ }
+
+ if [[ "$GITHUB_EVENT_NAME" == "push" && "$GITHUB_REF" == "refs/heads/main" ]]; then
+ echo "Push to main. Running all test groups."
+ run_all_test_groups
+ echo "### Full CI after push to main" >> "$GITHUB_STEP_SUMMARY"
+ exit 0
+ fi
+
+ turbo_version=$(jq -r '.dependencies.turbo' package.json)
+ if ! bunx "turbo@$turbo_version" query affected > affected.json; then
+ echo "Could not determine affected tasks. Running all test groups."
+ run_all_test_groups
+ exit 0
+ fi
+
+ task_is_affected() {
+ jq -e --arg task "$1" \
+ 'any(.data.affectedTasks.items[]; .name == $task)' \
+ affected.json > /dev/null
+ }
+
+ set_from_tasks() {
+ output=$1
+ shift
+ affected=false
+ for task in "$@"; do
+ if task_is_affected "$task"; then
+ affected=true
+ fi
+ done
+
+ echo "$output=$affected" >> "$GITHUB_OUTPUT"
+ }
+
+ set_from_tasks lambda testlambda
+ set_from_tasks nextjs testnextjs
+ set_from_tasks browser testwebcodecs teste2e
+ set_from_tasks webrenderer testwebrenderer testbrowserstudio
+ set_from_tasks ssr testssr
+ set_from_tasks templates testtemplates
+ set_from_tasks bundle_example bundle-testbed
+
+ build=false
+ build_matrix=$linux_matrix
+ if jq -e \
+ 'any(.data.affectedTasks.items[]; .name == "make" or .name == "test")' \
+ affected.json > /dev/null; then
+ build=true
+ fi
+
+ if jq -e \
+ 'any(.data.affectedTasks.items[]; (.name == "make" or .name == "test") and .package.name != "docs")' \
+ affected.json > /dev/null; then
+ build_matrix=$full_matrix
+ fi
+
+ echo "build=$build" >> "$GITHUB_OUTPUT"
+ echo "build_matrix=$build_matrix" >> "$GITHUB_OUTPUT"
+
+ {
+ echo '### Affected Turborepo tasks'
+ echo
+ jq -r '.data.affectedTasks.items[] | "- `\(.fullName)` (\(.reason.__typename))"' affected.json
+ } >> "$GITHUB_STEP_SUMMARY"
+
lambda-tests:
+ needs: affected
+ if: ${{ !cancelled() && (needs.affected.result != 'success' || needs.affected.outputs.lambda == 'true') }}
runs-on: ubuntu-latest
timeout-minutes: 40
name: Lambda integration
@@ -42,6 +147,8 @@ jobs:
run: |
cd packages/lambda && bunx remotion browser ensure && bun test src/test/integration --run
nextjs-tests:
+ needs: affected
+ if: ${{ !cancelled() && (needs.affected.result != 'success' || needs.affected.outputs.nextjs == 'true') }}
runs-on: ubuntu-latest
timeout-minutes: 30
name: Next.js SSR build
@@ -57,14 +164,13 @@ jobs:
run: bun ci
- name: Cache Turbo
uses: rharkor/[email protected]
- - name: Test Lambda IT
- run: |
- bun run build
- - name: IT tests
+ - name: Build Next.js SSR app
timeout-minutes: 10
run: |
- cd packages/player-example && bun run build-site
+ bun run testnextjs
browser-tests:
+ needs: affected
+ if: ${{ !cancelled() && (needs.affected.result != 'success' || needs.affected.outputs.browser == 'true') }}
runs-on: macos-latest
timeout-minutes: 30
name: Browser tests
@@ -91,6 +197,8 @@ jobs:
run: |
bun run teste2e
webrenderer-tests:
+ needs: affected
+ if: ${{ !cancelled() && (needs.affected.result != 'success' || needs.affected.outputs.webrenderer == 'true') }}
runs-on: macos-latest
timeout-minutes: 30
name: Web renderer tests
@@ -115,6 +223,8 @@ jobs:
run: |
bun run testbrowserstudio
ssr-tests:
+ needs: affected
+ if: ${{ !cancelled() && (needs.affected.result != 'success' || needs.affected.outputs.ssr == 'true') }}
runs-on: ubuntu-latest
timeout-minutes: 30
name: SSR + Monorepo checks
@@ -151,44 +261,10 @@ jobs:
timeout-minutes: 10
run: |
cd packages/it-tests && bun test src/monorepo --run --timeout 40000
- template-tests-check:
- runs-on: ubuntu-latest
- timeout-minutes: 15
- name: Template tests precheck
- outputs:
- should_run: ${{ steps.check.outputs.should_run }}
- steps:
- - uses: actions/checkout@v6
- with:
- fetch-depth: 0
- - uses: actions/setup-node@v6
- with:
- node-version: 25
- - uses: oven-sh/[email protected]
- with:
- bun-version: 1.3.3
- - name: Check if template tests are affected
- id: check
- run: |
- set +e
- bunx turbo-ignore @remotion/it-tests --task=testtemplates
- status=$?
- set -e
-
- if [ "$status" -eq 0 ]; then
- echo "should_run=false" >> "$GITHUB_OUTPUT"
- echo "No relevant changes for testtemplates; skipping template-tests."
- elif [ "$status" -eq 1 ]; then
- echo "should_run=true" >> "$GITHUB_OUTPUT"
- echo "Relevant changes detected for testtemplates; running template-tests."
- else
- echo "turbo-ignore failed with exit code $status"
- exit "$status"
- fi
template-tests:
name: Template integration on ${{ matrix.os }}
- needs: template-tests-check
- if: needs.template-tests-check.outputs.should_run == 'true'
+ needs: affected
+ if: ${{ !cancelled() && (needs.affected.result != 'success' || needs.affected.outputs.templates == 'true') }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
@@ -225,11 +301,16 @@ jobs:
run: |
bun run testtemplates
lint:
+ needs: affected
+ if: ${{ !cancelled() }}
runs-on: ubuntu-latest
timeout-minutes: 20
name: Linting + Formatting
steps:
- uses: actions/checkout@v6
+ with:
+ fetch-depth: 0
+ filter: blob:none
- uses: actions/setup-node@v6
with:
node-version: 25
@@ -245,25 +326,24 @@ jobs:
- name: Perform stylecheck
timeout-minutes: 10
run: |
- bun run stylecheck
+ bunx turbo run lint formatting ${{ github.event_name == 'pull_request' && '--affected' || '' }} --no-update-notifier
+ bun run checkskills
build:
name: Build Node ${{ matrix.node_version }} on ${{ matrix.os }}
+ needs: affected
+ if: ${{ !cancelled() && (needs.affected.result != 'success' || needs.affected.outputs.build == 'true') }}
runs-on: ${{ matrix.os }}
timeout-minutes: 40
strategy:
fail-fast: false
- matrix:
- include:
- - os: ubuntu-latest
- node_version: 16
- - os: windows-latest
- node_version: 16
- - os: macos-latest
- node_version: 25
+ matrix: ${{ fromJSON(needs.affected.outputs.build_matrix || '{"include":[{"os":"ubuntu-latest","node_version":16},{"os":"windows-latest","node_version":16},{"os":"macos-latest","node_version":25}]}') }}
env:
BUN_INSTALL_CACHE_DIR: ${{ matrix.os == 'windows-latest' && 'D:\.bun\install\cache' || '' }}
steps:
- uses: actions/checkout@v6
+ with:
+ fetch-depth: 0
+ filter: blob:none
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node_version }}
@@ -285,8 +365,8 @@ jobs:
- name: Build & Test
timeout-minutes: 30
run: |
- bun run ci
+ bunx turbo run make test ${{ github.event_name == 'pull_request' && '--affected' || '' }} --concurrency=1 --no-update-notifier
- name: Bundle example
- if: matrix.os == 'ubuntu-latest'
+ if: matrix.os == 'ubuntu-latest' && (needs.affected.result != 'success' || needs.affected.outputs.bundle_example == 'true')
run: |
- cd packages/example && bun run bundle-testbed
+ bunx turbo run bundle-testbed --filter=@remotion/example --no-update-notifier
diff --git a/package.json b/package.json
index 8627d15d5a..40a8934ffc 100644
--- a/package.json
+++ b/package.json
@@ -20,6 +20,7 @@
"testlayoututils": "turbo run testlayoututils --concurrency=1 --no-update-notifier",
"testeffectsvisual": "turbo run testeffectsvisual --concurrency=1 --no-update-notifier",
"testlambda": "turbo run testlambda --concurrency=1 --no-update-notifier",
+ "testnextjs": "turbo run testnextjs --no-update-notifier",
"ci": "turbo run make test --concurrency=1 --no-update-notifier",
"watch": "turbo watch make --concurrency=2 --experimental-write-cache",
"makewhisperweb": "turbo run make --filter='@remotion/whisper-web'",
diff --git a/packages/player-example/package.json b/packages/player-example/package.json
index 9f0a10da09..a6ace34115 100644
--- a/packages/player-example/package.json
+++ b/packages/player-example/package.json
@@ -32,6 +32,7 @@
"formatting": "prettier src --check",
"lint": "eslint src",
"dev": "next dev",
- "build-site": "next build"
+ "build-site": "next build",
+ "testnextjs": "next build"
}
}
diff --git a/turbo.json b/turbo.json
index fece4c81e6..91cee7c686 100644
--- a/turbo.json
+++ b/turbo.json
@@ -16,11 +16,19 @@
"dependsOn": ["^make", "@remotion/example#bundle"]
},
"testtemplates": {
- "dependsOn": ["^make", "@remotion/example#bundle"]
+ "dependsOn": ["^make", "@remotion/example#bundle"],
+ "inputs": [
+ "$TURBO_DEFAULT$",
+ "$TURBO_ROOT$/packages/template-*/**",
+ "$TURBO_ROOT$/tsconfig.json"
+ ]
},
"testlambda": {
"dependsOn": ["^make", "@remotion/example#bundle"]
},
+ "@remotion/player-example#testnextjs": {
+ "dependsOn": ["^make"]
+ },
"testwebcodecs": {
"dependsOn": ["@remotion/webcodecs#make"]
},
@@ -193,7 +201,13 @@
},
"@remotion/brand#bundle": {
"dependsOn": ["^make"],
- "inputs": ["src/**", "public/**", "remotion.config.*", "package.json", "tsconfig.json"],
+ "inputs": [
+ "src/**",
+ "public/**",
+ "remotion.config.*",
+ "package.json",
+ "tsconfig.json"
+ ],
"outputs": ["build"],
"outputLogs": "new-only"
}