diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e51cf2dc9af..3e641801d393 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -519,6 +519,7 @@ jobs: PIP_INDEX_URL: https://pypi.org/simple needs: - prepare-workflow + - test - build-ci-deps steps: - uses: actions/checkout@v4 @@ -540,22 +541,12 @@ jobs: python3 -m pip install 'nox==2022.8.7' - - - name: Merge All Code Coverage Test Run Artifacts - continue-on-error: true - uses: actions/upload-artifact/merge@v4 - with: - name: all-testrun-coverage-artifacts - pattern: all-testrun-coverage-artifacts-* - separate-directories: false - delete-merged: true - - name: Get coverage reports id: get-coverage-reports uses: actions/download-artifact@v4 with: path: artifacts/coverage/ - pattern: all-testrun-coverage-artifacts* + pattern: coverage* merge-multiple: true - name: Display structure of downloaded files diff --git a/.github/workflows/templates/ci.yml.jinja b/.github/workflows/templates/ci.yml.jinja index 69c1e6287cfb..86a1f41a66b5 100644 --- a/.github/workflows/templates/ci.yml.jinja +++ b/.github/workflows/templates/ci.yml.jinja @@ -290,6 +290,7 @@ PIP_INDEX_URL: https://pypi.org/simple needs: - prepare-workflow + - test <%- for need in test_salt_needs.iter(consume=False) %> - <{ need }> <%- endfor %> @@ -324,22 +325,12 @@ send-notifications --git-service github --sha ${{ github.sha }} #} - - - name: Merge All Code Coverage Test Run Artifacts - continue-on-error: true - uses: actions/upload-artifact/merge@v4 - with: - name: all-testrun-coverage-artifacts - pattern: all-testrun-coverage-artifacts-* - separate-directories: false - delete-merged: true - - name: Get coverage reports id: get-coverage-reports uses: actions/download-artifact@v4 with: path: artifacts/coverage/ - pattern: all-testrun-coverage-artifacts* + pattern: coverage* merge-multiple: true - name: Display structure of downloaded files diff --git a/.github/workflows/test-action.yml b/.github/workflows/test-action.yml index f44f680a185c..c90688e4d35d 100644 --- a/.github/workflows/test-action.yml +++ b/.github/workflows/test-action.yml @@ -334,10 +334,10 @@ jobs: run: | sudo chown -R "$(id -un)" . - - name: Combine Coverage Reports - if: always() && inputs.skip-code-coverage == false - run: | - nox --force-color -e combine-coverage + #- name: Combine Coverage Reports + # if: always() && inputs.skip-code-coverage == false + # run: | + # nox --force-color -e combine-coverage - name: Prepare Test Run Artifacts id: download-artifacts-from-vm @@ -347,15 +347,15 @@ jobs: # from it showing in the tree command below sudo rm -rf artifacts/salt* tree -a artifacts - if [ "${{ inputs.skip-code-coverage }}" != "true" ]; then - mv artifacts/coverage/.coverage artifacts/coverage/.coverage.${{ matrix.slug }}.${{ inputs.nox-session }}.${{ matrix.transport }}.${{ matrix.tests-chunk }} - fi + # if [ "${{ inputs.skip-code-coverage }}" != "true" ]; then + # mv artifacts/coverage/.coverage* artifacts/coverage/ + # fi - name: Upload Code Coverage Test Run Artifacts - if: always() && inputs.skip-code-coverage == false && steps.download-artifacts-from-vm.outcome == 'success' && job.status != 'cancelled' + if: ${{ !cancelled() && !inputs.skip-code-coverage }} uses: actions/upload-artifact@v4 with: - name: testrun-coverage-artifacts-${{ matrix.slug }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-${{ env.TIMESTAMP }} + name: coverage-artifacts-${{ matrix.slug }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-${{ env.TIMESTAMP }} path: | artifacts/coverage/ include-hidden-files: true @@ -651,11 +651,6 @@ jobs: run: | sudo chown -R "$(id -un)" . - - name: Combine Coverage Reports - if: always() && inputs.skip-code-coverage == false - run: | - nox --force-color -e combine-coverage - - name: Prepare Test Run Artifacts id: download-artifacts-from-vm if: always() @@ -664,12 +659,12 @@ jobs: # from it showing in the tree command below sudo rm -rf artifacts/salt* tree -a artifacts - if [ "${{ inputs.skip-code-coverage }}" != "true" ]; then - mv artifacts/coverage/.coverage artifacts/coverage/.coverage.${{ matrix.slug }}.${{ inputs.nox-session }}.${{ matrix.transport }}.${{ matrix.tests-chunk }} - fi + # if [ "${{ inputs.skip-code-coverage }}" != "true" ]; then + # mv artifacts/coverage/.coverage artifacts/coverage/.coverage.${{ matrix.slug }}.${{ inputs.nox-session }}.${{ matrix.transport }}.${{ matrix.tests-chunk }} + # fi - name: Upload Code Coverage Test Run Artifacts - if: always() && inputs.skip-code-coverage == false && steps.download-artifacts-from-vm.outcome == 'success' && job.status != 'cancelled' + if: ${{ !cancelled() && !inputs.skip-code-coverage }} uses: actions/upload-artifact@v4 with: name: testrun-coverage-artifacts-${{ matrix.slug }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-${{ env.TIMESTAMP }} @@ -930,10 +925,10 @@ jobs: run: | sudo chown -R "$(id -un)" . - - name: Combine Coverage Reports - if: always() && inputs.skip-code-coverage == false - run: | - nox --force-color -e combine-coverage + # - name: Combine Coverage Reports + # if: always() && inputs.skip-code-coverage == false + # run: | + # nox --force-color -e combine-coverage - name: Prepare Test Run Artifacts id: download-artifacts-from-vm @@ -943,12 +938,12 @@ jobs: # from it showing in the tree command below rm -rf artifacts/salt* tree -a artifacts - if [ "${{ inputs.skip-code-coverage }}" != "true" ]; then - mv artifacts/coverage/.coverage artifacts/coverage/.coverage.${{ matrix.slug }}.${{ inputs.nox-session }}.${{ matrix.transport }}.${{ matrix.tests-chunk }} - fi + # if [ "${{ inputs.skip-code-coverage }}" != "true" ]; then + # mv artifacts/coverage/.coverage artifacts/coverage/.coverage.${{ matrix.slug }}.${{ inputs.nox-session }}.${{ matrix.transport }}.${{ matrix.tests-chunk }} + # fi - name: Upload Code Coverage Test Run Artifacts - if: always() && inputs.skip-code-coverage == false && steps.download-artifacts-from-vm.outcome == 'success' && job.status != 'cancelled' + if: ${{ !cancelled() && !inputs.skip-code-coverage }} uses: actions/upload-artifact@v4 with: name: testrun-coverage-artifacts-${{ matrix.slug }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-${{ matrix.test-group || 1 }}-${{ env.TIMESTAMP }} @@ -1231,10 +1226,10 @@ jobs: --slow-tests --core-tests -k "win" --test-group-count=${{ matrix.test-group-count || 1 }} --test-group=${{ matrix.test-group || 1 }} - - name: Combine Coverage Reports - if: always() && inputs.skip-code-coverage == false - run: | - nox --force-color -e combine-coverage + #- name: Combine Coverage Reports + # if: always() && inputs.skip-code-coverage == false + # run: | + # nox --force-color -e combine-coverage - name: Prepare Test Run Artifacts id: download-artifacts-from-vm @@ -1244,12 +1239,12 @@ jobs: # Delete the salt onedir, we won't need it anymore and it will prevent # from it showing in the tree command below rm -rf artifacts/salt* - if [ "${{ inputs.skip-code-coverage }}" != "true" ]; then - mv artifacts/coverage/.coverage artifacts/coverage/.coverage.${{ matrix.slug }}.${{ inputs.nox-session }}.${{ matrix.transport }}.${{ matrix.tests-chunk }} - fi + # if [ "${{ inputs.skip-code-coverage }}" != "true" ]; then + # mv artifacts/coverage/.coverage artifacts/coverage/.coverage.${{ matrix.slug }}.${{ inputs.nox-session }}.${{ matrix.transport }}.${{ matrix.tests-chunk }} + # fi - name: Upload Code Coverage Test Run Artifacts - if: always() && inputs.skip-code-coverage == false && steps.download-artifacts-from-vm.outcome == 'success' && job.status != 'cancelled' + if: ${{ !cancelled() && !inputs.skip-code-coverage }} uses: actions/upload-artifact@v4 with: name: testrun-coverage-artifacts-${{ matrix.slug }}-${{ inputs.nox-session }}-${{ matrix.transport }}-${{ matrix.tests-chunk }}-${{ matrix.test-group || 1 }}-${{ env.TIMESTAMP }} @@ -1323,24 +1318,24 @@ jobs: separate-directories: false delete-merged: true - - name: Merge Code Coverage Test Run Artifacts - if: ${{ inputs.skip-code-coverage == false }} - continue-on-error: true - uses: actions/upload-artifact/merge@v4 - with: - name: testrun-coverage-artifacts-${{ matrix.slug }}-${{ inputs.nox-session }} - pattern: testrun-coverage-artifacts-${{ matrix.slug }}-${{ inputs.nox-session }}-* - separate-directories: false - delete-merged: true - - - name: Download Code Coverage Test Run Artifacts - uses: actions/download-artifact@v4 - if: ${{ inputs.skip-code-coverage == false }} - id: download-coverage-artifacts - with: - path: artifacts/coverage/ - pattern: testrun-coverage-artifacts-${{ matrix.slug }}-${{ inputs.nox-session }}* - merge-multiple: true + # - name: Merge Code Coverage Test Run Artifacts + # if: ${{ inputs.skip-code-coverage == false }} + # continue-on-error: true + # uses: actions/upload-artifact/merge@v4 + # with: + # name: testrun-coverage-artifacts-${{ matrix.slug }}-${{ inputs.nox-session }} + # pattern: testrun-coverage-artifacts-${{ matrix.slug }}-${{ inputs.nox-session }}-* + # separate-directories: false + # delete-merged: true + + # - name: Download Code Coverage Test Run Artifacts + # uses: actions/download-artifact@v4 + # if: ${{ inputs.skip-code-coverage == false }} + # id: download-coverage-artifacts + # with: + # path: artifacts/coverage/ + # pattern: testrun-coverage-artifacts-${{ matrix.slug }}-${{ inputs.nox-session }}* + # merge-multiple: true - name: Show Downloaded Test Run Artifacts if: ${{ inputs.skip-code-coverage == false }} @@ -1356,35 +1351,35 @@ jobs: run: | python3 -m pip install 'nox==${{ inputs.nox-version }}' - - name: Create XML Coverage Reports - if: always() && inputs.skip-code-coverage == false && steps.download-coverage-artifacts.outcome == 'success' && job.status != 'cancelled' - run: | - nox --force-color -e create-xml-coverage-reports - mv artifacts/coverage/salt.xml artifacts/coverage/salt..${{ matrix.slug }}..${{ inputs.nox-session }}.xml - mv artifacts/coverage/tests.xml artifacts/coverage/tests..${{ matrix.slug }}..${{ inputs.nox-session }}.xml - - - name: Report Salt Code Coverage - if: always() && inputs.skip-code-coverage == false && steps.download-coverage-artifacts.outcome == 'success' - continue-on-error: true - run: | - nox --force-color -e report-coverage -- salt - - - name: Report Combined Code Coverage - if: always() && inputs.skip-code-coverage == false && steps.download-coverage-artifacts.outcome == 'success' - continue-on-error: true - run: | - nox --force-color -e report-coverage - - - name: Rename Code Coverage DB - if: always() && inputs.skip-code-coverage == false && steps.download-coverage-artifacts.outcome == 'success' - continue-on-error: true - run: | - mv artifacts/coverage/.coverage artifacts/coverage/.coverage.${{ matrix.slug }}.${{ inputs.nox-session }} - - - name: Upload Code Coverage DB - if: always() && inputs.skip-code-coverage == false && steps.download-coverage-artifacts.outcome == 'success' - uses: actions/upload-artifact@v4 - with: - name: all-testrun-coverage-artifacts-${{ matrix.slug }}.${{ inputs.nox-session }} - path: artifacts/coverage - include-hidden-files: true + # - name: Create XML Coverage Reports + # if: !cancelled() && inputs.skip-code-coverage == false + # run: | + # nox --force-color -e create-xml-coverage-reports + # mv artifacts/coverage/salt.xml artifacts/coverage/salt..${{ matrix.slug }}..${{ inputs.nox-session }}.xml + # mv artifacts/coverage/tests.xml artifacts/coverage/tests..${{ matrix.slug }}..${{ inputs.nox-session }}.xml + + # - name: Report Salt Code Coverage + # if: always() && inputs.skip-code-coverage == false && steps.download-coverage-artifacts.outcome == 'success' + # continue-on-error: true + # run: | + # nox --force-color -e report-coverage -- salt + + # - name: Report Combined Code Coverage + # if: always() && inputs.skip-code-coverage == false && steps.download-coverage-artifacts.outcome == 'success' + # continue-on-error: true + # run: | + # nox --force-color -e report-coverage + + # - name: Rename Code Coverage DB + # if: always() && inputs.skip-code-coverage == false && steps.download-coverage-artifacts.outcome == 'success' + # continue-on-error: true + # run: | + # mv artifacts/coverage/.coverage artifacts/coverage/.coverage.${{ matrix.slug }}.${{ inputs.nox-session }} + + # - name: Upload Code Coverage DB + # if: always() && inputs.skip-code-coverage == false && job.status != 'cancelled' + # uses: actions/upload-artifact@v4 + # with: + # name: all-testrun-coverage-artifacts-${{ matrix.slug }}.${{ inputs.nox-session }} + # path: artifacts/coverage + # include-hidden-files: true diff --git a/.github/workflows/test-packages-action.yml b/.github/workflows/test-packages-action.yml index c781beb1fda0..5de06edaeca0 100644 --- a/.github/workflows/test-packages-action.yml +++ b/.github/workflows/test-packages-action.yml @@ -434,9 +434,6 @@ jobs: # Delete the salt onedir, we won't need it anymore and it will prevent # from it showing in the tree command below rm -rf artifacts/salt* - if [ "${{ inputs.skip-code-coverage }}" != "true" ]; then - mv artifacts/coverage/.coverage artifacts/coverage/.coverage.${{ matrix.slug }}.${{ inputs.nox-session }}.${{ matrix.transport }}.${{ matrix.tests-chunk }} - fi - name: Upload Test Run Log Artifacts if: always() diff --git a/tools/ci.py b/tools/ci.py index f29c7acafd38..974794b7c319 100644 --- a/tools/ci.py +++ b/tools/ci.py @@ -231,7 +231,7 @@ def _get_pr_test_labels_from_event_payload( """ if "pull_request" not in gh_event: return [] - return _filter_test_labels(gh_event["pull_request"]["labels"]) + return [_[0] for _ in _filter_test_labels(gh_event["pull_request"]["labels"])] def _filter_test_labels(labels: list[dict[str, Any]]) -> list[tuple[str, str]]: @@ -544,21 +544,21 @@ def _define_testrun(ctx, changed_files, labels, full): ) if full: ctx.info("Full test run chosen") - testrun = TestRun(type="full", skip_code_coverage=True) + testrun = TestRun(type="full", skip_code_coverage=False) elif changed_pkg_requirements_files or changed_test_requirements_files: ctx.info( "Full test run chosen because there was a change made " "to the requirements files." ) - testrun = TestRun(type="full", skip_code_coverage=True) + testrun = TestRun(type="full", skip_code_coverage=False) elif "test:full" in labels: ctx.info("Full test run chosen because the label `test:full` is set.\n") - testrun = TestRun(type="full", skip_code_coverage=True) + testrun = TestRun(type="full", skip_code_coverage=False) else: testrun_changed_files_path = tools.utils.REPO_ROOT / "testrun-changed-files.txt" testrun = TestRun( type="changed", - skip_code_coverage=True, + skip_code_coverage=False, from_filenames=str( testrun_changed_files_path.relative_to(tools.utils.REPO_ROOT) ), @@ -730,6 +730,7 @@ def workflow_config( if "pull_request" in gh_event: pr = gh_event["pull_request"]["number"] labels = _get_pr_test_labels_from_event_payload(gh_event) + ctx.info(f"labels are {labels!r}") else: ctx.warn("The 'pull_request' key was not found on the event payload.") @@ -744,7 +745,7 @@ def workflow_config( # Public repositories can use github's arm64 runners. config["linux_arm_runner"] = "ubuntu-24.04-arm" - if event_name != "pull_request" or "test:full" in [_[0] for _ in labels]: + if event_name != "pull_request" or "test:full" in labels: full = True slugs = os.environ.get("FULL_TESTRUN_SLUGS", "") if not slugs: @@ -770,6 +771,7 @@ def workflow_config( config["skip_code_coverage"] = True if "test:coverage" in labels: + ctx.info("Code coverage enabled.") config["skip_code_coverage"] = False else: ctx.info("Skipping code coverage.")