feat(testing): TD_018 C# Event Infrastructure Integration Tests #95
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Streamlined CI | |
on: | |
push: | |
branches: [ main, develop ] | |
pull_request: | |
branches: [ main, develop ] | |
types: [ opened, synchronize, reopened ] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pull-requests: read | |
checks: write | |
jobs: | |
# Job 1: Quick verification (trust local hooks did their job) | |
verify: | |
name: π Verify Local Fixes | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: π Verify build cleanliness | |
run: | | |
echo "π Verifying no build artifacts committed..." | |
if find . -type d -name "bin" -o -name "obj" | grep -q .; then | |
echo "β Build artifacts found in repo" | |
exit 1 | |
else | |
echo "β Repository is clean (no build artifacts)" | |
fi | |
- name: π Verify code formatting | |
run: | | |
echo "π Verifying local hooks did their job..." | |
# Check if code would be changed by formatting | |
dotnet format src/Darklands.Core.csproj --verify-no-changes --verbosity diagnostic | |
dotnet format tests/Darklands.Core.Tests.csproj --verify-no-changes --verbosity diagnostic | |
echo "β Code formatting is correct (local hooks worked!)" | |
# Clean up any build artifacts created during format verification | |
echo "π§Ή Cleaning up format verification artifacts..." | |
find . -type d -name "bin" -o -name "obj" | grep -v .godot | xargs rm -rf || true | |
# Job 2: Fast build and test | |
test: | |
name: π§ͺ Build & Test | |
runs-on: ubuntu-latest | |
needs: [verify] | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: ποΈ Restore dependencies | |
run: dotnet restore | |
- name: ποΈ Build projects | |
run: | | |
dotnet build src/Darklands.Core.csproj --configuration Release | |
dotnet build tests/Darklands.Core.Tests.csproj --configuration Release | |
# Godot project (optional - may need Godot runtime) | |
dotnet build Darklands.csproj --configuration Release || { | |
echo "βΉοΈ Godot project build skipped (requires Godot runtime)" | |
} | |
- name: π§ͺ Run tests | |
run: | | |
dotnet test tests/Darklands.Core.Tests.csproj \ | |
--configuration Release \ | |
--logger "console;verbosity=normal" \ | |
--collect:"XPlat Code Coverage" \ | |
--results-directory ./TestResults \ | |
--filter "FullyQualifiedName!~MediatR_Should_Discover_All_Handlers_In_Core_Assembly" | |
- name: π Upload coverage | |
uses: codecov/codecov-action@v4 | |
if: always() | |
with: | |
directory: ./TestResults | |
flags: unittests | |
fail_ci_if_error: false | |
# Job 3: Security and quality checks | |
security: | |
name: π Security & Quality | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: π Security scan | |
run: | | |
echo "π Scanning for security issues..." | |
# Check for hardcoded secrets (basic check) - more specific patterns | |
if grep -r "password\s*=\s*[\"'].*[\"']" --include="*.cs" . || \ | |
grep -r "secret\s*=\s*[\"'].*[\"']" --include="*.cs" . || \ | |
grep -r "apikey\s*=\s*[\"'].*[\"']" --include="*.cs" . || \ | |
grep -r "connectionstring\s*=\s*[\"'].*[\"']" --include="*.cs" .; then | |
echo "β οΈ Potential hardcoded credentials found" | |
exit 1 | |
else | |
echo "β No hardcoded credentials detected" | |
fi | |
- name: π Validate commit messages (PR only) | |
if: github.event_name == 'pull_request' | |
run: | | |
echo "π Validating commit messages..." | |
# Simple conventional commit check | |
git log --format=%s origin/main..HEAD | while read commit; do | |
if echo "$commit" | grep -qE "^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\([a-zA-Z0-9_-]+\))?: .+|.*\[Phase [1-4]/4\]"; then | |
echo "β $commit" | |
else | |
echo "β οΈ Non-conventional: $commit" | |
fi | |
done | |
# Job 4: Success summary (only runs if all pass) | |
success: | |
name: β CI Success | |
runs-on: ubuntu-latest | |
needs: [verify, test, security] | |
if: success() | |
steps: | |
- name: π All checks passed | |
run: | | |
echo "π All CI checks passed!" | |
echo "" | |
echo "β Local hooks verification: PASSED" | |
echo "β Build and tests: PASSED" | |
echo "β Security scan: PASSED" | |
echo "" | |
echo "π Ready to merge!" |