Skip to content

Commit 7e68276

Browse files
baywetCopilot
andauthored
fix(ci): select integration test events explicitly (#14603)
### Motivation and Context <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> Select integration-test jobs using pull-request repository identity while retaining build and unit-test checks for all pull requests and the merge queue. ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> - Skip integration jobs for fork pull requests and Dependabot-triggered pull requests, while allowing other same-repository pull requests, merge groups, and manual runs on repository branches. The Dependabot exclusion applies only to pull-request events. - Preserve the existing scheduled/manual split for the full Python integration suite. - Separate .NET integration tests from build and unit-test jobs, and include the separate job in the final result check. - Keep Python integration settings on test steps and integration setup permissions on the jobs that use them. Validation from the isolated worktree: - Temporary session-only checks using the Actions expression evaluator: the initial event-policy update passed all 19 cases after 9 intended assertion failures. For the Dependabot refinement, `node '<session-files>\workflow-policy-check\check.mjs' 'D:\github\semantic-kernel-integration-event-selection'` produced 3 intended Dependabot-PR assertion failures and 20 passes before the fix; afterward, all 23 cases passed. Coverage includes same-repository human PRs, Dependabot PRs, fork PRs, unavailable PR head repositories, merge groups and manual runs with a Dependabot actor, manual topic-branch runs, and the Python scheduled/manual split. No new CI unit tests or dependencies are retained in this PR. - `actionlint -shellcheck= -pyflakes= -ignore 'constant expression "false" in condition' .github\workflows\dotnet-build-and-test.yml .github\workflows\dotnet-integration-tests.yml .github\workflows\python-integration-tests.yml`: passed. The exclusion covers three pre-existing constant-false conditions in disabled Python steps, confirmed against the base revision. - `git diff --check`: passed. Live integration tests and repository-wide .NET/Python builds were not run locally. The initial PR revision passed all applicable GitHub checks, including the three .NET build-and-test jobs; the updated revision requires a fresh CI run. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄 --------- Co-authored-by: Copilot <[email protected]> Copilot-Session: 7d5f1773-4610-4dc8-8e7a-6cd710cfda0e
1 parent 5b4a326 commit 7e68276

3 files changed

Lines changed: 129 additions & 98 deletions

File tree

‎.github/workflows/dotnet-build-and-test.yml‎

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ concurrency:
2121

2222
permissions:
2323
contents: read
24-
id-token: "write"
2524

2625
jobs:
2726
paths-filter:
@@ -60,14 +59,11 @@ jobs:
6059
dotnet: "10.0",
6160
os: "ubuntu-latest",
6261
configuration: Release,
63-
integration-tests: true,
64-
environment: "integration",
6562
}
6663
- { dotnet: "10.0", os: "windows-latest", configuration: Debug }
6764
- { dotnet: "9.0", os: "windows-latest", configuration: Release }
6865

6966
runs-on: ${{ matrix.os }}
70-
environment: ${{ matrix.environment }}
7167
steps:
7268
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
7369
with:
@@ -124,8 +120,43 @@ jobs:
124120
shell: pwsh
125121
run: .github/workflows/test-aot-compatibility.ps1 ${{ matrix.dotnet }}
126122

123+
# Generate test reports and check coverage
124+
- name: Generate test reports
125+
uses: danielpalme/ReportGenerator-GitHub-Action@18e0cd4c1bebd0c8b3978b380a6a4ea61c51178e # 5.4.15
126+
with:
127+
reports: "./TestResults/Coverage/**/coverage.cobertura.xml"
128+
targetdir: "./TestResults/Reports"
129+
reporttypes: "HtmlInline;JsonSummary"
130+
131+
- name: Upload coverage report artifact
132+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
133+
with:
134+
name: CoverageReport-${{ matrix.os }}-${{ matrix.dotnet }}-${{ matrix.configuration }} # Artifact name
135+
path: ./TestResults/Reports # Directory containing files to upload
136+
137+
- name: Check coverage
138+
shell: pwsh
139+
run: .github/workflows/check-coverage.ps1 -JsonReportPath "TestResults/Reports/Summary.json" -CoverageThreshold $env:COVERAGE_THRESHOLD
140+
141+
dotnet-integration-tests:
142+
needs: paths-filter
143+
if: (github.event_name != 'pull_request' || (github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository)) && needs.paths-filter.outputs.dotnetChanges == 'true'
144+
runs-on: ubuntu-latest
145+
environment: "integration"
146+
permissions:
147+
contents: read
148+
id-token: write
149+
steps:
150+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
151+
with:
152+
persist-credentials: false
153+
154+
- name: Setup dotnet
155+
uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0
156+
with:
157+
global-json-file: ${{ github.workspace }}/dotnet/global.json
158+
127159
- name: Azure CLI Login
128-
if: github.event_name != 'pull_request' && matrix.integration-tests
129160
uses: azure/login@7184910d9eb2b1c5e48f7073824a90609bb9b6d6 # v2.3.1
130161
with:
131162
client-id: ${{ secrets.AZURE_CLIENT_ID }}
@@ -134,11 +165,10 @@ jobs:
134165

135166
- name: Run Integration Tests
136167
shell: bash
137-
if: github.event_name != 'pull_request' && matrix.integration-tests
138168
run: |
139169
export INTEGRATION_TEST_PROJECTS=$(find ./dotnet -type f -name "*IntegrationTests.csproj" | grep -v "Experimental.Orchestration.Flow.IntegrationTests.csproj" | grep -v "VectorDataIntegrationTests.csproj" | tr '\n' ' ')
140170
for project in $INTEGRATION_TEST_PROJECTS; do
141-
dotnet test -f net10.0 -c ${{ matrix.configuration }} $project --no-build -v Normal --logger trx
171+
dotnet test -f net10.0 -c Release $project -v Normal --logger trx
142172
done
143173
env:
144174
# Azure OpenAI Deployments
@@ -182,29 +212,11 @@ jobs:
182212
AzureAI__ConnectionString: ${{ secrets.AZUREAI__CONNECTIONSTRING }}
183213
AzureAI__ChatModelId: ${{ vars.AZUREAI__CHATMODELID }}
184214

185-
# Generate test reports and check coverage
186-
- name: Generate test reports
187-
uses: danielpalme/ReportGenerator-GitHub-Action@18e0cd4c1bebd0c8b3978b380a6a4ea61c51178e # 5.4.15
188-
with:
189-
reports: "./TestResults/Coverage/**/coverage.cobertura.xml"
190-
targetdir: "./TestResults/Reports"
191-
reporttypes: "HtmlInline;JsonSummary"
192-
193-
- name: Upload coverage report artifact
194-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
195-
with:
196-
name: CoverageReport-${{ matrix.os }}-${{ matrix.dotnet }}-${{ matrix.configuration }} # Artifact name
197-
path: ./TestResults/Reports # Directory containing files to upload
198-
199-
- name: Check coverage
200-
shell: pwsh
201-
run: .github/workflows/check-coverage.ps1 -JsonReportPath "TestResults/Reports/Summary.json" -CoverageThreshold $env:COVERAGE_THRESHOLD
202-
203215
# This final job is required to satisfy the merge queue. It must only run (or succeed) if no tests failed
204216
dotnet-build-and-test-check:
205217
if: always()
206218
runs-on: ubuntu-latest
207-
needs: [dotnet-build-and-test]
219+
needs: [dotnet-build-and-test, dotnet-integration-tests]
208220
steps:
209221
- name: Get Date
210222
shell: bash

‎.github/workflows/dotnet-integration-tests.yml‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,29 @@ permissions:
1616

1717
jobs:
1818
integration-tests:
19+
if: github.event_name != 'pull_request' || (github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository)
1920
strategy:
2021
matrix:
2122
os: [ubuntu-latest]
2223
configuration: [Debug]
2324
runs-on: ${{ matrix.os }}
2425
steps:
2526
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
26-
if: ${{ github.event_name != 'pull_request' }}
2727
with:
2828
clean: true
2929
persist-credentials: false
3030

3131
- name: Setup .NET
3232
uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0
33-
if: ${{ github.event_name != 'pull_request' }}
3433
with:
3534
dotnet-version: 10.0.x
3635

3736
- name: Find projects
3837
shell: bash
39-
if: ${{ github.event_name != 'pull_request' }}
4038
run: echo "projects=$(find ./dotnet -type f -name "*Tests.csproj" | tr '\n' ' ')" >> $GITHUB_ENV
4139

4240
- name: Integration Tests
4341
shell: bash
44-
if: ${{ github.event_name != 'pull_request' }}
4542
env: # Set Azure credentials secret as an input
4643
AzureOpenAI__Label: azure-text-davinci-003
4744
AzureOpenAIEmbedding__Label: azure-text-embedding-ada-002
@@ -64,4 +61,4 @@ jobs:
6461
with:
6562
name: dotnet-testresults-${{ matrix.configuration }}
6663
path: ./TestResults
67-
if: ${{ github.event_name != 'pull_request' && always() }}
64+
if: ${{ always() }}

0 commit comments

Comments
 (0)