2020 default : " main"
2121
2222jobs :
23+ # Blocking gate: all tests must pass before any packing/publishing can run.
24+ test-gate :
25+ runs-on : ubuntu-latest
26+
27+ steps :
28+ - name : Checkout
29+ uses : actions/checkout@v6
30+ with :
31+ fetch-depth : 0
32+ ref : ${{ inputs.ref || github.ref }}
33+
34+ - name : Setup .NET
35+ uses : actions/setup-dotnet@v5
36+ with :
37+ dotnet-version : ' 10.0.x'
38+ cache : true
39+ cache-dependency-path : |
40+ FluentAAS/**/*.csproj
41+ FluentAAS/global.json
42+
43+ - name : Locate solution file
44+ id : solution
45+ shell : bash
46+ run : |
47+ SOLUTION=$(find . -maxdepth 5 -name "*.sln" | head -n 1)
48+ if [ -z "$SOLUTION" ]; then
49+ echo "❌ No solution file (*.sln) found in the repo."
50+ exit 1
51+ fi
52+ echo "SOLUTION_PATH=$SOLUTION" >> $GITHUB_OUTPUT
53+ echo "✅ Found solution: $SOLUTION"
54+
55+ - name : Restore dependencies
56+ run : dotnet restore "${{ steps.solution.outputs.SOLUTION_PATH }}"
57+
58+ - name : Build solution
59+ run : dotnet build "${{ steps.solution.outputs.SOLUTION_PATH }}" -c Release --no-restore
60+
61+ - name : Test solution (blocking gate)
62+ run : dotnet test "${{ steps.solution.outputs.SOLUTION_PATH }}" -c Release --no-build --verbosity normal
63+
2364 build-pack-push :
2465 runs-on : ubuntu-latest
66+ needs : test-gate
2567
2668 steps :
2769 - name : Checkout
85127 - name : Build solution
86128 run : dotnet build "${{ steps.solution.outputs.SOLUTION_PATH }}" -c Release --no-restore
87129
88- - name : Test solution
89- run : dotnet test "${{ steps.solution.outputs.SOLUTION_PATH }}" -c Release --no-build --verbosity normal
90-
91130 - name : Pack NuGet packages
92131 run : dotnet pack "${{ steps.solution.outputs.SOLUTION_PATH }}" -c Release -o ./artifacts --no-build /p:PackageVersion=${{ steps.version.outputs.VERSION }}
93132
@@ -96,16 +135,16 @@ jobs:
96135 run : |
97136 shopt -s nullglob
98137 packages=(./artifacts/*.nupkg)
99-
138+
100139 if [ ${#packages[@]} -eq 0 ]; then
101140 echo "❌ No NuGet packages found in ./artifacts/"
102141 exit 1
103142 fi
104-
143+
105144 echo "📦 Generated NuGet packages:"
106145 VERSION="${{ steps.version.outputs.VERSION }}"
107146 ESCAPED_VERSION="${VERSION//./\\.}"
108-
147+
109148 for pkg in "${packages[@]}"; do
110149 filename=$(basename "$pkg")
111150 echo " - $filename"
@@ -149,4 +188,4 @@ jobs:
149188 prerelease : false
150189 env :
151190 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
152- GITHUB_REPOSITORY : ${{ github.repository }}
191+ GITHUB_REPOSITORY : ${{ github.repository }}
0 commit comments