Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ jobs:
PIP_INDEX_URL: https://pypi.org/simple
needs:
- prepare-workflow
- test
- build-ci-deps
steps:
- uses: actions/checkout@v4
Expand All @@ -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
Expand Down
13 changes: 2 additions & 11 deletions .github/workflows/templates/ci.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Expand Down Expand Up @@ -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
Expand Down
163 changes: 79 additions & 84 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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()
Expand All @@ -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 }}
Expand Down Expand Up @@ -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
Expand All @@ -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 }}
Expand Down Expand Up @@ -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
Expand All @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand All @@ -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
3 changes: 0 additions & 3 deletions .github/workflows/test-packages-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
14 changes: 8 additions & 6 deletions tools/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]:
Expand Down Expand Up @@ -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)
),
Expand Down Expand Up @@ -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.")

Expand All @@ -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:
Expand All @@ -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.")
Expand Down
Loading