Skip to content

Refresh Dataflow

Refresh Dataflow #251

Workflow file for this run

# Pull Request Validation Workflow
# Runs integration tests on every PR to validate changes
name: PR Validation
permissions:
contents: read
pull-requests: write
checks: write
actions: read
on:
pull_request:
branches: [main, develop]
types: [opened, synchronize, reopened, ready_for_review]
# Also run on pushes to main/develop for consistency
push:
branches: [main, develop]
# Cancel previous runs when new commits are pushed to the same PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pr-integration-tests:
name: πŸ§ͺ Integration Tests
runs-on: ubuntu-latest
# Skip draft PRs unless explicitly requested
if: github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'test-draft')
steps:
- name: πŸ“₯ Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for better analysis
- name: ⚑ Setup .NET 10
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"
include-prerelease: true
- name: πŸ“¦ Restore Dependencies
run: dotnet restore --configfile ../nuget.public.config
working-directory: ./DataFactory.MCP
- name: πŸ”¨ Build Main Project
run: dotnet build --no-restore --configuration Release
working-directory: ./DataFactory.MCP
- name: πŸ“¦ Restore Dependencies Tests
run: dotnet restore --configfile ../nuget.public.config
working-directory: ./DataFactory.MCP.Tests
- name: πŸ”¨ Build Test Project
run: dotnet build --no-restore --configuration Release
working-directory: ./DataFactory.MCP.Tests
- name: πŸ§ͺ Run Integration Tests
id: run-tests
run: |
dotnet test \
--no-build \
--configuration Release \
--verbosity normal \
--logger trx \
--logger "console;verbosity=detailed" \
--results-directory TestResults \
--collect:"XPlat Code Coverage"
working-directory: ./DataFactory.MCP.Tests
env:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
- name: πŸ“Š Publish Test Results
uses: dorny/test-reporter@v1
if: always() # Always run, even if tests fail
with:
name: πŸ§ͺ Integration Test Results
path: "./DataFactory.MCP.Tests/TestResults/*.trx"
reporter: dotnet-trx
fail-on-error: true
path-replace-backslashes: false
list-suites: all
list-tests: all
max-annotations: 10
fail-on-empty: true
only-summary: false
token: ${{ secrets.GITHUB_TOKEN }}
- name: πŸ“ˆ Publish Code Coverage
uses: codecov/codecov-action@v4
if: always()
with:
file: "./DataFactory.MCP.Tests/TestResults/*/coverage.cobertura.xml"
fail_ci_if_error: false
- name: πŸ’¬ Comment PR Results
uses: actions/github-script@v7
if: always() && github.event_name == 'pull_request'
with:
script: |
const testPassed = '${{ steps.run-tests.outcome }}' === 'success';
const emoji = testPassed ? 'βœ…' : '❌';
const status = testPassed ? 'PASSED' : 'FAILED';
const body = `## ${emoji} Integration Tests ${status}
**Workflow:** \`${{ github.workflow }}\`
**Commit:** \`${{ github.sha }}\`
**Result:** ${status}
${testPassed ?
'πŸŽ‰ All integration tests passed! This PR is ready for review.' :
'⚠️ Some integration tests failed. Please check the logs and fix the issues.'}
[View full results](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})`;
// Find existing comment
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const existingComment = comments.data.find(
comment => comment.user.login === 'github-actions[bot]' &&
comment.body.includes('Integration Tests')
);
if (existingComment) {
// Update existing comment
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existingComment.id,
body: body
});
} else {
// Create new comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: body
});
}