66 os :
77 required : true
88 type : string
9- arch :
10- required : true
11- type : string
129 cs_symbols :
1310 required : false
1411 type : string
1512 default : " "
1613
1714jobs :
15+ # todo, consider matrix of slnf files to group assemblies together. each job could run a separate slnf.
16+ # this may be more practical after githubactionstestrunner supports MTP, making failures easier to understand at a glance.
17+ discover-projects :
18+ runs-on : ubuntu-latest
19+ name : discover-projects-${{ inputs.os }}
20+ outputs :
21+ modules : ${{ steps.discover.outputs.modules }}
22+ steps :
23+ - uses : actions/checkout@v4
24+ - id : discover
25+ run : |
26+ find src -maxdepth 3 -name "*.Tests.csproj" > projects.txt
27+ echo "src/KurrentDB/KurrentDB.csproj" >> projects.txt
28+ modules=$(cat projects.txt | jq -R . | jq -sc .)
29+ echo "modules=$modules" >> $GITHUB_OUTPUT
30+ # each assembly is built in its own job because the repo is small and the build is fairly quick.
31+ # building it once and copying the build output between jobs is much slower
1832 build :
33+ needs : discover-projects
1934 env :
2035 DB_IMAGE : kurrentdb-test-container
2136 strategy :
2237 fail-fast : false
2338 matrix :
2439 configuration : [release]
40+ module : ${{ fromJson(needs.discover-projects.outputs.modules) }}
2541 runs-on : ${{ inputs.os }}
26- name : ci/github/build- ${{ inputs.os }}
42+ name : ${{ matrix.module }}
2743 steps :
2844 -
2945 name : Install Azure Emulator
@@ -32,14 +48,15 @@ jobs:
3248 npm install -g azurite
3349 azurite --location /tmp/azurite &
3450 curl -I http://127.0.0.1:10000/ --retry 5 --retry-delay 1 --retry-connrefused
35- -
36- name : Free Disk Space (Ubuntu)
37- if : ${{ !startsWith(inputs.os, 'windows') }}
38- 39- with :
40- tool-cache : false
41- dotnet : false
42- docker-images : false
51+ # takes time and may no longer be necessary now that each step only does one assembly
52+ # -
53+ # name: Free Disk Space (Ubuntu)
54+ # if: ${{ !startsWith(inputs.os, 'windows') }}
55+ # uses: jlumbroso/[email protected] 56+ # with:
57+ # tool-cache: false
58+ # dotnet: false
59+ # docker-images: false
4360 -
4461 name : Checkout
4562 uses : actions/checkout@v4
@@ -48,12 +65,20 @@ jobs:
4865 if : ${{ !startsWith(inputs.os, 'windows') }}
4966 uses : docker/setup-buildx-action@v2
5067 -
51- name : Install net8 .0
68+ name : Install net10 .0
5269 uses : actions/setup-dotnet@v3
5370 with :
54- dotnet-version : 8.0.x
71+ dotnet-version : 10.0.x
72+ -
73+ name : Use nuget cache
74+ uses : actions/cache@v4
75+ with :
76+ path : ~/.nuget/packages
77+ key : nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj') }}
78+ restore-keys : |
79+ nuget-${{ runner.os }}-
5580 -
56- name : Clear Nuget Cache
81+ name : Clear Nuget Config
5782 shell : powershell
5883 if : ${{ startsWith(inputs.os, 'windows') }}
5984 run : |
@@ -64,16 +89,21 @@ jobs:
6489 -
6590 name : Compile
6691 shell : bash
67- run : |
68- dotnet build --configuration ${{ matrix.configuration }} -p:Platform=${{ inputs.arch }} src/KurrentDB.sln
92+ run : >
93+ dotnet build
94+ --configuration ${{ matrix.configuration }}
95+ -p:DefineConstants=${{ inputs.cs_symbols }}
96+ ${{ matrix.module }}
6997 -
7098 name : Verify Build
99+ if : ${{ matrix.module == 'src/KurrentDB/KurrentDB.csproj' }}
71100 shell : bash
72101 run : |
73- dotnet run --project src/KurrentDB --configuration ${{ matrix.configuration }} -- --insecure --what-if
102+ dotnet run --project ${{ matrix.module }} --configuration ${{ matrix.configuration }} -- --insecure --what-if
103+ # so that the oauth tests have an up to date server image to run against
74104 -
75105 name : Build Test Image
76- if : ${{ !startsWith(inputs.os, 'windows') }}
106+ if : ${{ matrix.module == 'src/KurrentDB.Auth.OAuth.Tests/KurrentDB.Auth.OAuth.Tests.csproj' && !startsWith(inputs.os, 'windows') }}
77107 uses : docker/build-push-action@v4
78108 with :
79109 context : .
@@ -82,27 +112,28 @@ jobs:
82112 tags : ${{ env.DB_IMAGE }}
83113 -
84114 name : Run Tests
115+ if : ${{ endsWith(matrix.module, '.Tests.csproj') }}
85116 shell : bash
86117 run : >
87118 dotnet test
88- --configuration ${{ matrix.configuration }}
89- -p:Platform=${{ inputs.arch }}
90- -p:DefineConstants=${{ inputs.cs_symbols }}
91- --blame
92- --blame-hang-timeout 5min
93- --blame-hang-dump-type mini
94- --settings ./ci/ci.local.runsettings
95- --logger:GitHubActions
96- --logger:trx
97- --logger:"console;verbosity=normal"
98119 --results-directory $(pwd)/test-results
99- src/KurrentDB.sln
100- -- --report-trx --results-directory $(pwd)/test-results
120+ --no-build
121+ --configuration ${{ matrix.configuration }}
122+ --project ${{ matrix.module }}
123+ -
124+ name : Remove slashes
125+ if : ${{ endsWith(matrix.module, '.Tests.csproj') }}
126+ id : remove_slashes
127+ shell : bash
128+ run : |
129+ base="${{ matrix.module }}"
130+ safe="${base//\//-}"
131+ echo "value=$safe" >> $GITHUB_OUTPUT
101132 -
102133 name : Publish Test Results (All)
103134 uses : actions/upload-artifact@v4
104- if : always()
135+ if : ${{ endsWith(matrix.module, '.Tests.csproj') }}
105136 with :
106- name : test-results-${{ matrix.configuration }}-${{ inputs.os }}
137+ name : test-results-${{ steps.remove_slashes.outputs.value }}
107138 path : |
108139 test-results/*.trx
0 commit comments