1+ name : CI - Run Tests
2+
3+ on :
4+ push :
5+ branches : [ main, master ]
6+ pull_request :
7+ branches : [ main, master ]
8+ workflow_dispatch :
9+
10+ # --- DEFINED HERE FOR REUSABILITY ---
11+ env :
12+ PROJECT_NAME : OutSystems.YAML2JSON
13+ PRODUCT_NAME : YAML2JSON
14+ # ------------------------------------
15+
16+ jobs :
17+ test :
18+ name : Unit Tests
19+ runs-on : ubuntu-latest
20+
21+ steps :
22+ - name : Checkout Code
23+ uses : actions/checkout@v4
24+
25+ - name : Setup .NET
26+ uses : actions/setup-dotnet@v4
27+ with :
28+ dotnet-version : ' 8.0.x'
29+
30+ - name : Restore dependencies
31+ # Uses the variable to build the path
32+ run : dotnet restore ${{ env.PROJECT_NAME }}.UnitTests/${{ env.PROJECT_NAME }}.UnitTests.csproj
33+
34+ - name : Run Tests
35+ # Uses the variable in the test command
36+ run : |
37+ dotnet test ${{ env.PROJECT_NAME }}.UnitTests/${{ env.PROJECT_NAME }}.UnitTests.csproj \
38+ --configuration Release \
39+ --no-restore \
40+ --nologo \
41+ --collect:"XPlat Code Coverage" \
42+ --results-directory ./coverage
43+
44+ - name : Report Code Coverage
45+ uses : irongut/CodeCoverageSummary@v1.3.0
46+ with :
47+ filename : coverage/**/coverage.cobertura.xml
48+ badge : true
49+ fail_below_min : false
50+ format : markdown
51+ output : both
52+
53+ - name : Write Summary
54+ run : cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
55+
56+ - name : Upload coverage to Codecov
57+ uses : codecov/codecov-action@v5
58+ with :
59+ token : ${{ secrets.CODECOV_TOKEN }}
60+ directory : ./coverage
61+ fail_ci_if_error : true
62+ # OPTION A: If your Repo name matches the Codecov slug exactly,
63+ # you can often remove 'slug' entirely or use:
64+ # slug: ${{ github.repository }}
65+
66+ # OPTION B: If the slug is different, you can construct it:
67+ # (Assuming your repos are always named OutSystems.Extension.Name)
68+ slug : Redeagle48/OutSystems.Extension.${{ env.PROJECT_NAME }}
0 commit comments