Skip to content

Commit fa14abd

Browse files
authored
parallelized matrix build (#693)
* build parallel * install all fwks * cleanup * 1line * gitbash * isolate * hyphen * publish once ---------
1 parent 019070a commit fa14abd

File tree

1 file changed

+125
-205
lines changed

1 file changed

+125
-205
lines changed

.github/workflows/gate.yml

Lines changed: 125 additions & 205 deletions
Original file line numberDiff line numberDiff line change
@@ -8,216 +8,136 @@ on:
88
branches: [ main ]
99

1010
jobs:
11-
win:
12-
13-
runs-on: windows-latest
14-
15-
permissions:
16-
checks: write
17-
18-
steps:
19-
- uses: actions/checkout@v4
20-
- name: Setup .NET Core
21-
uses: actions/setup-dotnet@v4
22-
with:
23-
dotnet-version: |
24-
3.1.x
25-
26-
- name: Install dependencies
27-
run: dotnet restore
28-
- name: Build
29-
run: dotnet build --configuration Release --no-restore
30-
31-
- name: Test (4.8)
32-
run: dotnet test --no-restore --verbosity normal -f net48 --logger "trx;LogFileName=results4.trx"
33-
- name: Upload test results (4.8)
34-
uses: actions/upload-artifact@v4 # upload test results
35-
if: success() || failure() # run this step even if previous step failed
36-
with:
37-
name: test-results-win48
38-
path: BitFaster.Caching.UnitTests/TestResults/results4.trx
39-
40-
- name: Test (3.1)
41-
run: dotnet test --no-restore --verbosity normal -f netcoreapp3.1 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov --logger "trx;LogFileName=results3.trx"
42-
- name: Upload test results (3.1)
43-
uses: actions/upload-artifact@v4 # upload test results
44-
if: success() || failure() # run this step even if previous step failed
45-
with:
46-
name: test-results-win3
47-
path: BitFaster.Caching.UnitTests/TestResults/results3.trx
48-
- name: Publish coverage report to coveralls.io (3.1)
49-
uses: coverallsapp/github-action@master
50-
with:
51-
github-token: ${{ secrets.GITHUB_TOKEN }}
52-
path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.netcoreapp3.1.info
53-
flag-name: win3
54-
parallel: true
55-
56-
- name: Publish NuGet artifacts
57-
uses: actions/upload-artifact@v4
58-
with:
59-
name: NuGet package
60-
path: BitFaster.Caching/bin/Release/
61-
win2:
62-
63-
runs-on: windows-latest
64-
65-
permissions:
66-
checks: write
67-
68-
steps:
69-
- uses: actions/checkout@v4
70-
- name: Setup .NET Core
71-
uses: actions/setup-dotnet@v4
72-
with:
73-
dotnet-version: |
74-
6.0.x
75-
8.0.x
76-
9.0.x
77-
- name: Install dependencies
78-
run: dotnet restore
79-
- name: Build
80-
run: dotnet build --configuration Release --no-restore
81-
82-
- name: Test (6.0)
83-
run: dotnet test --no-restore --verbosity normal -f net6.0 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov --logger "trx;LogFileName=results6.trx"
84-
- name: Upload test results (6.0)
85-
uses: actions/upload-artifact@v4 # upload test results
86-
if: success() || failure() # run this step even if previous step failed
87-
with:
88-
name: test-results-win6
89-
path: BitFaster.Caching.UnitTests/TestResults/results6.trx
90-
- name: Upload test results (6.0 .NET Std)
91-
uses: actions/upload-artifact@v4
92-
if: success() || failure()
93-
with:
94-
name: test-results-win6-std
95-
path: BitFaster.Caching.UnitTests.Std/TestResults/results6.trx
96-
97-
- name: Publish coverage report to coveralls.io (6.0)
98-
uses: coverallsapp/github-action@master
99-
with:
100-
github-token: ${{ secrets.GITHUB_TOKEN }}
101-
path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.net6.0.info
102-
flag-name: win6
103-
parallel: true
104-
105-
- name: Test (9.0)
106-
run: dotnet test --no-restore --verbosity normal -f net9.0 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov --logger "trx;LogFileName=results9.trx"
107-
- name: Upload test results (9.0)
108-
uses: actions/upload-artifact@v4 # upload test results
109-
if: success() || failure() # run this step even if previous step failed
110-
with:
111-
name: test-results-win9
112-
path: BitFaster.Caching.UnitTests/TestResults/results9.trx
113-
- name: Upload test results (9.0 .NET Std)
114-
uses: actions/upload-artifact@v4
115-
if: success() || failure()
116-
with:
117-
name: test-results-win9-std
118-
path: BitFaster.Caching.UnitTests.Std/TestResults/results9.trx
119-
120-
- name: Publish coverage report to coveralls.io (9.0)
121-
uses: coverallsapp/github-action@master
122-
with:
123-
github-token: ${{ secrets.GITHUB_TOKEN }}
124-
path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.net9.0.info
125-
flag-name: win9
126-
parallel: true
127-
128-
mac:
129-
130-
runs-on: macos-latest
131-
132-
permissions:
133-
checks: write
134-
135-
steps:
136-
- uses: actions/checkout@v4
137-
- name: Setup .NET Core
138-
uses: actions/setup-dotnet@v4
139-
with:
140-
dotnet-version: |
141-
6.0.x
142-
8.0.x
143-
9.0.x
144-
- name: Install dependencies
145-
run: dotnet restore
146-
- name: Build
147-
run: dotnet build --configuration Release --no-restore
148-
- name: Test
149-
run: dotnet test --no-restore --verbosity normal -f net6.0 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov --logger "trx;LogFileName=results.trx"
150-
- name: Publish coverage report to coveralls.io
151-
uses: coverallsapp/github-action@master
152-
with:
153-
github-token: ${{ secrets.GITHUB_TOKEN }}
154-
path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.net6.0.info
155-
flag-name: mac
156-
parallel: true
157-
- name: Upload test results (6.0)
158-
uses: actions/upload-artifact@v4
159-
if: success() || failure()
160-
with:
161-
name: test-results-mac
162-
path: BitFaster.Caching.UnitTests/TestResults/results.trx
163-
- name: Upload test results (6.0 .NET Std)
164-
uses: actions/upload-artifact@v4
165-
if: success() || failure()
166-
with:
167-
name: test-results-mac-std
168-
path: BitFaster.Caching.UnitTests.Std/TestResults/results.trx
169-
170-
linux:
171-
172-
runs-on: ubuntu-latest
173-
11+
build:
12+
name: ${{ matrix.framework }} ${{ matrix.os }}
13+
runs-on: ${{ matrix.os }}
17414
permissions:
17515
checks: write
16+
continue-on-error: true
17+
strategy:
18+
matrix:
19+
include:
20+
# Windows
21+
- os: windows-latest
22+
framework: net48
23+
coverage: false
24+
results: results4.trx
25+
artifact: test-results-win48
26+
std: false
27+
flag: net48
28+
publish_nuget: true
29+
30+
- os: windows-latest
31+
framework: netcoreapp3.1
32+
coverage: true
33+
results: results3.trx
34+
artifact: test-results-win3
35+
std: false
36+
flag: win3
37+
publish_nuget: false
38+
39+
- os: windows-latest
40+
framework: net6.0
41+
coverage: true
42+
results: results6.trx
43+
artifact: test-results-win6
44+
std: true
45+
flag: win6
46+
publish_nuget: false
47+
48+
- os: windows-latest
49+
framework: net9.0
50+
coverage: true
51+
results: results9.trx
52+
artifact: test-results-win9
53+
std: true
54+
flag: win9
55+
publish_nuget: false
56+
57+
# macOS
58+
- os: macos-latest
59+
framework: net6.0
60+
coverage: true
61+
results: results.trx
62+
artifact: test-results-mac
63+
std: true
64+
flag: mac
65+
publish_nuget: false
66+
67+
# Linux
68+
- os: ubuntu-latest
69+
framework: net6.0
70+
coverage: true
71+
results: results.trx
72+
artifact: test-results-linux
73+
std: true
74+
flag: linux
75+
publish_nuget: false
17676

17777
steps:
178-
- uses: actions/checkout@v4
179-
- name: Setup .NET Core
180-
uses: actions/setup-dotnet@v4
181-
with:
182-
dotnet-version: |
183-
6.0.x
184-
8.0.x
185-
9.0.x
186-
- name: Install dependencies
187-
run: dotnet restore
188-
- name: Build
189-
run: dotnet build --configuration Release --no-restore
190-
- name: Test
191-
run: dotnet test --no-restore --verbosity normal -f net6.0 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov --logger "trx;LogFileName=results.trx"
192-
- name: Publish coverage report to coveralls.io
193-
uses: coverallsapp/github-action@master
194-
with:
195-
github-token: ${{ secrets.GITHUB_TOKEN }}
196-
path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.net6.0.info
197-
flag-name: linux
198-
parallel: true
199-
- name: Upload test results (6.0)
200-
uses: actions/upload-artifact@v4
201-
if: success() || failure()
202-
with:
203-
name: test-results-linux
204-
path: BitFaster.Caching.UnitTests/TestResults/results.trx
205-
- name: Upload test results (6.0 .NET Std)
206-
uses: actions/upload-artifact@v4
207-
if: success() || failure()
208-
with:
209-
name: test-results-linux-std
210-
path: BitFaster.Caching.UnitTests.Std/TestResults/results.trx
78+
- uses: actions/checkout@v4
79+
80+
- name: Setup .NET Core
81+
uses: actions/setup-dotnet@v4
82+
with:
83+
dotnet-version: |
84+
3.1.x
85+
6.0.x
86+
8.0.x
87+
9.0.x
88+
89+
- name: Install dependencies
90+
run: dotnet restore
91+
92+
- name: Build
93+
run: dotnet build --configuration Release --no-restore
94+
95+
- name: Test
96+
run: |
97+
dotnet test --no-restore --verbosity normal -f ${{ matrix.framework }} \
98+
${{ matrix.coverage && '-p:CollectCoverage=true' || '' }} \
99+
${{ matrix.coverage && '-p:CoverletOutput=TestResults/' || '' }} \
100+
${{ matrix.coverage && '-p:CoverletOutputFormat=lcov' || '' }} \
101+
--logger "trx;LogFileName=${{ matrix.results }}"
102+
shell: bash
103+
104+
- name: Upload test results
105+
uses: actions/upload-artifact@v4
106+
if: success() || failure()
107+
with:
108+
name: ${{ matrix.artifact }}
109+
path: BitFaster.Caching.UnitTests/TestResults/${{ matrix.results }}
110+
111+
- name: Upload test results (.NET Std)
112+
if: ${{ matrix.std }}
113+
uses: actions/upload-artifact@v4
114+
with:
115+
name: ${{ matrix.artifact }}-std
116+
path: BitFaster.Caching.UnitTests.Std/TestResults/${{ matrix.results }}
117+
118+
- name: Publish coverage report to coveralls.io
119+
if: ${{ matrix.coverage && matrix.flag != '' }}
120+
uses: coverallsapp/github-action@master
121+
with:
122+
github-token: ${{ secrets.GITHUB_TOKEN }}
123+
path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.${{ matrix.framework }}.info
124+
flag-name: ${{ matrix.flag }}
125+
parallel: true
126+
127+
- name: Publish NuGet artifacts
128+
if: ${{ matrix.publish_nuget }}
129+
uses: actions/upload-artifact@v4
130+
with:
131+
name: NuGet package
132+
path: BitFaster.Caching/bin/Release/
211133

212134
coverage:
213-
214-
needs: [win, win2, mac, linux]
215-
135+
name: Coveralls Finished
136+
needs: build
216137
runs-on: ubuntu-latest
217-
218138
steps:
219-
- name: Coveralls Finished
220-
uses: coverallsapp/github-action@master
221-
with:
222-
github-token: ${{ secrets.GITHUB_TOKEN }}
223-
parallel-finished: true
139+
- name: Coveralls Finished
140+
uses: coverallsapp/github-action@master
141+
with:
142+
github-token: ${{ secrets.GITHUB_TOKEN }}
143+
parallel-finished: true

0 commit comments

Comments
 (0)