diff --git a/.config/nextest.toml b/.config/nextest.toml index 3ed9d4f5e39..6fed3a70fb7 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -1,3 +1,9 @@ [profile.default] # Print a slow warning after period, terminate unit-test after 4x period. slow-timeout = { period = "5s", terminate-after = 4 } + +[profile.ci] +fail-fast = false + +[profile.ci.junit] +path = "junit.xml" diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 00000000000..4f28881c56f --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,3 @@ +flag_management: + default_rules: # the rules that will be followed for any flag added, generally + carryforward: false diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 44c4ec3299c..b77a74afc13 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -191,7 +191,16 @@ jobs: if: ${{ inputs.unit-tests }} env: NEXTEST_RETRIES: 2 # https://github.com/servo/servo/issues/30683 - run: ./mach test-unit --profile ${{ inputs.profile }} + run: ./mach test-unit --profile ${{ inputs.profile }} --nextest-profile ci + # We upload the test-results to Codecov to help us identify flaky unit-tests. + - name: Upload test results to Codecov + if: ${{ !cancelled() }} + uses: codecov/test-results-action@v1 + with: + files: target/nextest/ci/junit.xml + disable_search: true + flags: unittests,unittests-linux,unittests-linux-${{ inputs.profile }} + token: ${{ secrets.CODECOV_TOKEN }} - name: Devtools tests if: ${{ false && inputs.unit-tests }} # FIXME #39273 run: ./mach test-devtools --profile ${{ inputs.profile }} diff --git a/.github/workflows/mac-arm64.yml b/.github/workflows/mac-arm64.yml index 4f99be1746c..23004248835 100644 --- a/.github/workflows/mac-arm64.yml +++ b/.github/workflows/mac-arm64.yml @@ -148,7 +148,16 @@ jobs: if: ${{ inputs.unit-tests }} env: NEXTEST_RETRIES: 3 # https://github.com/servo/servo/issues/30683 - run: ./mach test-unit --profile ${{ inputs.profile }} + run: ./mach test-unit --profile ${{ inputs.profile }} --nextest-profile ci + # We upload the test-results to Codecov to help us identify flaky unit-tests. + - name: Upload test results to Codecov + if: ${{ !cancelled() }} + uses: codecov/test-results-action@v1 + with: + files: target/nextest/ci/junit.xml + disable_search: true + flags: unittests,unittests-mac-arm64,unittests-mac-arm64-${{ inputs.profile }} + token: ${{ secrets.CODECOV_TOKEN }} - name: Devtools tests if: ${{ false && inputs.unit-tests }} # FIXME #39273 run: ./mach test-devtools --profile ${{ inputs.profile }} diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index cfd0003af8c..eebba392257 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -167,7 +167,16 @@ jobs: if: ${{ inputs.unit-tests }} env: NEXTEST_RETRIES: 3 # https://github.com/servo/servo/issues/30683 - run: ./mach test-unit --profile ${{ inputs.profile }} + run: ./mach test-unit --profile ${{ inputs.profile }} --nextest-profile ci + # We upload the test-results to Codecov to help us identify flaky unit-tests. + - name: Upload test results to Codecov + if: ${{ !cancelled() }} + uses: codecov/test-results-action@v1 + with: + files: target/nextest/ci/junit.xml + disable_search: true + flags: unittests,unittests-mac,unittests-mac-${{ inputs.profile }} + token: ${{ secrets.CODECOV_TOKEN }} - name: Devtools tests if: ${{ false && inputs.unit-tests }} # FIXME #39273 run: ./mach test-devtools --profile ${{ inputs.profile }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 3f4267f41f7..8f771be56f6 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -180,7 +180,16 @@ jobs: if: ${{ inputs.unit-tests }} env: NEXTEST_RETRIES: 3 # https://github.com/servo/servo/issues/30683 - run: ./mach test-unit --profile ${{ inputs.profile }} + run: ./mach test-unit --profile ${{ inputs.profile }} --nextest-profile ci + # We upload the test-results to Codecov to help us identify flaky unit-tests. + - name: Upload test results to Codecov + if: ${{ !cancelled() }} + uses: codecov/test-results-action@v1 + with: + files: target/nextest/ci/junit.xml + disable_search: true + flags: unittests,unittests-windows,unittests-windows-${{ inputs.profile }} + token: ${{ secrets.CODECOV_TOKEN }} - name: Devtools tests if: ${{ false && inputs.unit-tests }} # FIXME #39273 run: .\mach test-devtools --profile ${{ inputs.profile }} diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 2641cdaf009..21672dd45eb 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -165,16 +165,20 @@ class MachCommands(CommandBase): ) @CommandArgument("--code-coverage", default=False, action="store_true", help="Run in code coverage mode") @CommandArgument("--llvm-cov-option", default=None, action="append", help="Additional options for llvm-cov") + @CommandArgument("--nextest-profile", default=None, help="Specify the Nextest profile to use") + @CommandArgument("params", nargs="...", help="Command-line arguments to be passed through to Cargo nextest") @CommandBase.common_command_arguments(build_configuration=True, build_type=True) def test_unit( self, build_type: BuildType, test_name: list[str] | None = None, + params: list[str] | None = None, package: str | None = None, bench: bool = False, code_coverage: bool = False, llvm_cov_option: Optional[List[str]] = None, nocapture: bool = False, + nextest_profile: str | None = None, **kwargs: Any, ) -> int: if test_name is None: @@ -247,7 +251,7 @@ class MachCommands(CommandBase): if len(packages) == 0 and len(in_crate_packages) == 0: return 0 - args: list[str] = [] + args: list[str] = params or [] if build_type.is_release(): args += ["--release"] @@ -256,6 +260,9 @@ class MachCommands(CommandBase): else: args += ["--cargo-profile", build_type.profile] + if nextest_profile is not None: + args += ["--profile", nextest_profile] + for crate in packages: args += ["-p", "%s_tests" % crate] for crate in in_crate_packages: