Skip to content

Split long-running integ tests to stay under 10 min#8887

Merged
reedham-aws merged 14 commits intodevelopfrom
feat/optimize-ci-splits
Apr 7, 2026
Merged

Split long-running integ tests to stay under 10 min#8887
reedham-aws merged 14 commits intodevelopfrom
feat/optimize-ci-splits

Conversation

@licjun
Copy link
Copy Markdown
Contributor

@licjun licjun commented Apr 2, 2026

Changes

Optimize PR CI workflow (build.yml) so all jobs complete within 10 minutes. Changes include splitting one slow test group, splitting smoke tests into smaller groups, skipping redundant tests using a new pr_skip marker, and increasing parallelism for Java tests. All skipped tests continue to run in the nightly integration-tests.yml workflow.

Files changed

  • .github/workflows/build.yml
  • tests/smoke/test_all_commands.py
  • tests/integration/buildcmd/test_build_cmd_node.py
  • tests/integration/buildcmd/test_build_cmd_python.py
  • tests/integration/buildcmd/test_build_cmd_arm64.py
  • tests/integration/buildcmd/test_build_cmd_java.py
  • tests/integration/init/test_init_command.py
  • tests/integration/scripts/test_copy_terraform_built_artifacts.py
  • tests/integration/docs/test_docs_command.py
  • pytest.ini

Integration test split

Split integ-buildcmd-python out of integ-buildcmd-main to address the slowest job (17m 42s on Windows):

Before After
integ-buildcmd-main (python+dotnet+provided+rust+node, 17m 42s on Windows) integ-buildcmd-python (python only)
integ-buildcmd-main (dotnet+provided+rust+node)

Smoke test split

Split smoke tests into smaller groups to reduce per-job runtime:

Before After
Smoke & Functional Tests - All (ubuntu, all templates) Smoke Tests - First Half (ubuntu, 50%)
Smoke Tests - Second Half & Functional Tests (ubuntu, 50% + functional)
Smoke Tests - First Third (windows) Smoke Tests - First Quarter (windows)
Smoke Tests - Second Third (windows) Smoke Tests - Second Quarter (windows)
Smoke Tests - Third Third & Functional Tests (windows) Smoke Tests - Third Quarter (windows)
Smoke Tests - Fourth Quarter & Functional Tests (windows)

Java parallelism

Increased integ-buildcmd-java from -n 2 to -n 3 to reduce Windows runtime from ~10m to ~7m. Java build tests are I/O-bound (invoking gradle/maven), so the third worker helps while the others wait on build tool I/O.

Tests skipped in PR workflow (pr_skip marker)

Introduced a new @pytest.mark.pr_skip marker for tests that are redundant or low-risk for PR validation. These tests are skipped only in build.yml and continue to run in the nightly integration-tests.yml workflow.

File Class Tests Justification
test_build_cmd_node.py EsbuildFunctions_With_External_Manifest 6 Esbuild bundling already covered by EsbuildFunctions; external manifest resolution covered by NodeFunctions_With_External_Manifest
test_build_cmd_node.py EsbuildFunctionProperties 12 Already skipped on Windows CI; sourcemap/node options is a variation of the same esbuild build path tested by EsbuildFunctions
test_build_cmd_python.py PythonFunctions_With_Specified_Architecture 12 Architecture flag is a thin wrapper over the standard build path; same runtimes and build logic already covered by WithoutDocker_al2023
test_build_cmd_arm64.py EsbuildFunctions_With_External_Manifest_arm64 3 Same justification as the non-arm64 esbuild external manifest class
test_build_cmd_arm64.py Rust_arm64 16 cargo-lambda builder already covered by non-arm64 test_build_cmd_rust.py; arm64 cross-compilation is a cargo flag, not SAM CLI logic
test_init_command.py TestInitForParametersCompatibility 7 Parameter validation edge cases (missing name, wrong packagetype, etc.) well covered by unit tests
test_copy_terraform_built_artifacts.py TestCopyTerraformBuiltArtifacts 11 Terraform-specific script tests for artifact copying; low risk for PR validation
test_docs_command.py TestDocsCommand 25 Static URL mapping validation (sam docs <command> → URL); these mappings rarely change

Total: 92 tests skipped in PR builds.

Results

Before (develop branch, run #24024561824):

Job Worst time
integ-buildcmd-main win 3.10 17m 42s
integ-buildcmd-java win 3.11 12m 53s
integ-all-other win 3.10 12m 56s
integ-buildcmd-arm64 ubuntu 3.11 11m 21s
Smoke & Functional Tests - All ubuntu 11m 6s
Smoke Tests - Second Third win 3.10 11m 14s

After (run #24056335724):

Job Worst time
integ-buildcmd-main ubuntu 3.10 9m 28s
integ-buildcmd-java win 3.11 7m 7s
integ-all-other win 3.10 8m 55s
integ-buildcmd-arm64 ubuntu 3.10 6m 41s
Smoke Tests - Fourth Quarter & Functional Tests win 3.11 9m 20s
All other jobs under 9m

All jobs now complete within 10 minutes.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

- Split integ-buildcmd-main: extract python tests (19 tests, 42% of load) into integ-buildcmd-python
- Split integ-all-other: extract local tests (413 tests, 82% of load) into integ-local
@licjun licjun requested a review from a team as a code owner April 2, 2026 17:39
licjun added 13 commits April 6, 2026 09:29
- Split integ-buildcmd-arm64 into python-node and other groups
- Split integ-buildcmd-dotnet out of integ-buildcmd-main
- Separate integ-telemetry to run without parallelism (fixes port 18298 conflict)
- Split Windows smoke tests from 3 groups (thirds) to 4 groups (quarters)
With -n 2, two workers run sam init simultaneously, both cloning
templates to the same shared directory (~/.sam/), causing conflicts
on ubuntu. The group only has 89 tests and finishes in ~4 min,
so parallelism isn't needed.
…r integ-all-other

- Move Ruby into arm64-python-node for better balance (11 vs 10)
- Split node out of integ-buildcmd-main (was 10 min on Windows)
- Isolate integ-init (sequential, avoids clone conflict)
- Restore -n 2 for integ-all-other (pipeline+root+scripts+docs)
…test changes

Per reviewer feedback, reverted most integration test splits to reduce
total job count. Kept only:
- Split integ-buildcmd-python out of integ-buildcmd-main (17 min on Windows)
- Smoke tests: ubuntu 1 group → 2 halves, windows 3 thirds → 4 quarters
Add @pytest.mark.pr_skip to skip tests in build.yml that are still
run in integration-tests.yml (nightly/merge):

- EsbuildFunctions_With_External_Manifest (6 tests): redundant with
  EsbuildFunctions (same esbuild logic) and NodeFunctions_With_External_Manifest
  (same external manifest resolution)
- EsbuildFunctionProperties (12 tests): already skipped on Windows CI;
  sourcemap/node options is a variation of the same esbuild build path
  covered by EsbuildFunctions
- PythonFunctions_With_Specified_Architecture (12 tests): architecture
  flag is a thin wrapper; same runtimes and build logic already covered
  by WithoutDocker_al2023
- TestDocsCommand (25 tests): static URL mapping validation that rarely
  changes and is low-risk for PR validation
- Add pr_skip to EsbuildFunctions_With_External_Manifest_arm64 (3 tests):
  redundant with EsbuildFunctions_arm64 and NodeFunctions_arm64
- Revert parallelism from n=3 back to n=2 for arm64, buildcmd-main,
  and all-other (n=3 didn't help, 2 cores on runners)
- Rust_arm64 (16 tests): cargo-lambda builder already covered by
  non-arm64 test_build_cmd_rust.py; arm64 cross-compilation is a
  cargo flag, not SAM CLI logic
- TestInitForParametersCompatibility (7 tests): parameter validation
  edge cases well covered by unit tests
- TestCopyTerraformBuiltArtifacts (11 tests): Terraform-specific
  script tests, low risk for PR validation
Java tests only need Python + Java. Skip Go, Ruby, Node, Dotnet,
and Rust setup steps to save ~3 min of setup overhead on each
Java test runner.
With -n 2 and skipped setup steps, two parallel Gradle builds start
faster and collide on the shared gradle-cache lock file on Windows.
Running sequentially avoids the lock conflict. Combined with the
setup skip saving ~3 min, total time should stay around 10 min.
Copy link
Copy Markdown
Member

@roger-zhangg roger-zhangg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@reedham-aws reedham-aws added this pull request to the merge queue Apr 7, 2026
Merged via the queue into develop with commit 57f68ad Apr 7, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants