From 948a427280c032c7db2fe0dd86a37d8fd7518bce Mon Sep 17 00:00:00 2001 From: kuddev Date: Mon, 14 Sep 2026 20:35:37 +0800 Subject: [PATCH] ci: reduce native test compilation and artifact upload overhead --- .github/ci-profile.toml | 23 +++++++++++++++++++++++ .github/workflows/linux-lua.yml | 2 ++ .github/workflows/release.yml | 9 +++++++++ docs/architecture-decisions.md | 5 +++++ scripts/ci_native_tests.py | 7 ++++++- scripts/tests/test_ci_native_tests.py | 23 ++++++++++++++++++++++- 6 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 .github/ci-profile.toml diff --git a/.github/ci-profile.toml b/.github/ci-profile.toml new file mode 100644 index 0000000..509b709 --- /dev/null +++ b/.github/ci-profile.toml @@ -0,0 +1,23 @@ +# Test compilation only; packaging continues to use profile.release. +# Named dependency overrides take precedence over "*", so reset those too. +[profile.ci] +inherits = "dev" +opt-level = 0 +debug = 0 +debug-assertions = true +overflow-checks = true +split-debuginfo = "off" +incremental = false +codegen-units = 256 +lto = false + +[profile.ci.package] +"*" = { opt-level = 0 } +resvg = { opt-level = 0 } +rustybuzz = { opt-level = 0 } +taffy = { opt-level = 0 } +ttf-parser = { opt-level = 0 } +smol = { opt-level = 0 } +gpui = { opt-level = 0 } +gpui_macros = { opt-level = 0 } +nebula_terminal = { opt-level = 0 } diff --git a/.github/workflows/linux-lua.yml b/.github/workflows/linux-lua.yml index f7f477b..b006226 100644 --- a/.github/workflows/linux-lua.yml +++ b/.github/workflows/linux-lua.yml @@ -10,6 +10,7 @@ on: - "Cargo.lock" - "rust-toolchain.toml" - ".github/workflows/linux-lua.yml" + - ".github/ci-profile.toml" pull_request: paths: - "**/*.rs" @@ -18,6 +19,7 @@ on: - "Cargo.lock" - "rust-toolchain.toml" - ".github/workflows/linux-lua.yml" + - ".github/ci-profile.toml" permissions: contents: read diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4d89fb2..5a0c8eb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -174,6 +174,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: + compression-level: 0 name: native-timings-${{ matrix.platform }} path: target/cargo-timings if-no-files-found: warn @@ -283,6 +284,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: + compression-level: 0 name: stable-package-linux-x64 path: | dist/*.AppImage @@ -294,6 +296,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: + compression-level: 0 name: stable-evidence-linux-x64 path: dist/conformance if-no-files-found: warn @@ -424,6 +427,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: + compression-level: 0 name: stable-package-macos-${{ matrix.asset_architecture }} path: dist/*.dmg if-no-files-found: error @@ -432,6 +436,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: + compression-level: 0 name: stable-evidence-macos-${{ matrix.architecture }} path: dist/conformance if-no-files-found: warn @@ -502,6 +507,7 @@ jobs: - name: Retain built Windows runtime before packaging uses: actions/upload-artifact@v4 with: + compression-level: 0 name: stable-runtime-windows-x64 path: | target/release/pebrel.exe @@ -536,6 +542,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: + compression-level: 0 name: stable-package-windows-x64 path: | dist/Pebrel-v${{ needs.prepare.outputs.version }}-windows-x64.zip @@ -546,6 +553,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: + compression-level: 0 name: stable-evidence-windows-x64 path: dist/conformance if-no-files-found: warn @@ -593,6 +601,7 @@ jobs: - name: Upload complete stable release set uses: actions/upload-artifact@v4 with: + compression-level: 0 name: Pebrel-v${{ needs.prepare.outputs.version }} path: release-dist if-no-files-found: error diff --git a/docs/architecture-decisions.md b/docs/architecture-decisions.md index c9b7ca4..3d1cef7 100644 --- a/docs/architecture-decisions.md +++ b/docs/architecture-decisions.md @@ -434,6 +434,11 @@ settings files. platform still runs the complete Python helper and harness suites. Cache keys preserve the existing platform namespace and retain workspace crates. Cargo still validates source, profile and feature fingerprints before reuse. +- **Test profile:** An explicit CI-only profile removes developer-preview + optimization and debug information from test compilation, including named + dependency overrides. It retains debug assertions and overflow checks. The + native suite also checks the actual product feature configuration, since GPUI + test support changes dependency features. Release optimization is unaffected. - **Product compilation:** The application keeps O3 and Thin LTO and uses 16 codegen units to parallelize its large translation unit. Other package settings retain their existing values. Both Windows packagers call one explicit builder diff --git a/scripts/ci_native_tests.py b/scripts/ci_native_tests.py index 8e5545b..36022a4 100644 --- a/scripts/ci_native_tests.py +++ b/scripts/ci_native_tests.py @@ -8,11 +8,16 @@ import sys def native_commands() -> list[list[str]]: + profile = ["--config", ".github/ci-profile.toml", "--profile", "ci"] return [ [sys.executable, "-m", "unittest", "discover", "-s", "scripts/tests", "-v"], [sys.executable, "-m", "unittest", "discover", "-s", "scripts/conformance/tests", "-v"], [ - "cargo", "test", "--locked", "--workspace", + "cargo", "check", "--locked", *profile, "-p", "nebula", "--bin", "pebrel", + "--features", "gpui-shell", "--timings", + ], + [ + "cargo", "test", "--locked", *profile, "--workspace", "--features", "nebula/gpui-test-support", "--timings", ], ] diff --git a/scripts/tests/test_ci_native_tests.py b/scripts/tests/test_ci_native_tests.py index 4f25da8..a9490da 100644 --- a/scripts/tests/test_ci_native_tests.py +++ b/scripts/tests/test_ci_native_tests.py @@ -1,6 +1,8 @@ from __future__ import annotations import subprocess +from pathlib import Path +import tomllib import unittest from unittest.mock import patch @@ -9,7 +11,7 @@ from scripts.ci_native_tests import main, native_commands class NativeSuiteTests(unittest.TestCase): def test_full_workspace_and_interactions_share_one_unfiltered_invocation(self): - rust = [command for command in native_commands() if command[0] == "cargo"] + rust = [command for command in native_commands() if command[:2] == ["cargo", "test"]] self.assertEqual(len(rust), 1) command = rust[0] self.assertEqual(command[1], "test") @@ -21,6 +23,25 @@ class NativeSuiteTests(unittest.TestCase): self.assertNotIn("--skip", command) self.assertNotIn("--", command) + def test_actual_product_feature_graph_is_also_checked(self): + checks = [command for command in native_commands() if command[:2] == ["cargo", "check"]] + self.assertEqual(len(checks), 1) + command = checks[0] + self.assertEqual(command[command.index("--features") + 1], "gpui-shell") + self.assertEqual(command[command.index("--bin") + 1], "pebrel") + + def test_fast_test_profile_preserves_runtime_checks_and_resets_named_overrides(self): + root = Path(__file__).resolve().parents[2] + config = tomllib.loads((root / ".github/ci-profile.toml").read_text()) + workspace = tomllib.loads((root / "Cargo.toml").read_text()) + profile = config["profile"]["ci"] + self.assertEqual(profile["inherits"], "dev") + self.assertTrue(profile["debug-assertions"]) + self.assertTrue(profile["overflow-checks"]) + for package in workspace["profile"]["dev"]["package"]: + self.assertEqual(profile["package"][package]["opt-level"], 0) + self.assertNotIn("release", config["profile"]) + def test_both_python_test_roots_are_discovered(self): suites = [command for command in native_commands() if "unittest" in command] self.assertEqual(