Skip to content

Commit 057d082

Browse files
author
Alex Peck
committed
build parallel
1 parent 019070a commit 057d082

File tree

1 file changed

+124
-205
lines changed

1 file changed

+124
-205
lines changed

.github/workflows/gate.yml

Lines changed: 124 additions & 205 deletions
Original file line numberDiff line numberDiff line change
@@ -8,216 +8,135 @@ 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: Build and Test (${{ matrix.os }}, .NET ${{ matrix.dotnet-version }}, ${{ matrix.framework }})
13+
runs-on: ${{ matrix.os }}
17414
permissions:
17515
checks: write
16+
strategy:
17+
matrix:
18+
include:
19+
# Windows
20+
- os: windows-latest
21+
dotnet-version: 3.1.x
22+
framework: net48
23+
coverage: false
24+
results: results4.trx
25+
artifact: test-results-win48
26+
std: false
27+
flag: ""
28+
publish_nuget: true
29+
30+
- os: windows-latest
31+
dotnet-version: 3.1.x
32+
framework: netcoreapp3.1
33+
coverage: true
34+
results: results3.trx
35+
artifact: test-results-win3
36+
std: false
37+
flag: win3
38+
publish_nuget: true
39+
40+
- os: windows-latest
41+
dotnet-version: 6.0.x
42+
framework: net6.0
43+
coverage: true
44+
results: results6.trx
45+
artifact: test-results-win6
46+
std: true
47+
flag: win6
48+
publish_nuget: false
49+
50+
- os: windows-latest
51+
dotnet-version: 9.0.x
52+
framework: net9.0
53+
coverage: true
54+
results: results9.trx
55+
artifact: test-results-win9
56+
std: true
57+
flag: win9
58+
publish_nuget: false
59+
60+
# macOS
61+
- os: macos-latest
62+
dotnet-version: 6.0.x
63+
framework: net6.0
64+
coverage: true
65+
results: results.trx
66+
artifact: test-results-mac
67+
std: true
68+
flag: mac
69+
publish_nuget: false
70+
71+
# Linux
72+
- os: ubuntu-latest
73+
dotnet-version: 6.0.x
74+
framework: net6.0
75+
coverage: true
76+
results: results.trx
77+
artifact: test-results-linux
78+
std: true
79+
flag: linux
80+
publish_nuget: false
17681

17782
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
83+
- uses: actions/checkout@v4
84+
85+
- name: Setup .NET Core
86+
uses: actions/setup-dotnet@v4
87+
with:
88+
dotnet-version: ${{ matrix.dotnet-version }}
89+
90+
- name: Install dependencies
91+
run: dotnet restore
92+
93+
- name: Build
94+
run: dotnet build --configuration Release --no-restore
95+
96+
- name: Test
97+
run: |
98+
dotnet test --no-restore --verbosity normal -f ${{ matrix.framework }} \
99+
${{ matrix.coverage && '/p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov' || '' }} \
100+
--logger "trx;LogFileName=${{ matrix.results }}"
101+
shell: bash
102+
103+
- name: Upload test results
104+
uses: actions/upload-artifact@v4
105+
if: success() || failure()
106+
with:
107+
name: ${{ matrix.artifact }}
108+
path: BitFaster.Caching.UnitTests/TestResults/${{ matrix.results }}
109+
110+
- name: Upload test results (.NET Std)
111+
if: ${{ matrix.std }}
112+
uses: actions/upload-artifact@v4
113+
with:
114+
name: ${{ matrix.artifact }}-std
115+
path: BitFaster.Caching.UnitTests.Std/TestResults/${{ matrix.results }}
116+
117+
- name: Publish coverage report to coveralls.io
118+
if: ${{ matrix.coverage && matrix.flag != '' }}
119+
uses: coverallsapp/github-action@master
120+
with:
121+
github-token: ${{ secrets.GITHUB_TOKEN }}
122+
path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.${{ matrix.framework }}.info
123+
flag-name: ${{ matrix.flag }}
124+
parallel: true
125+
126+
- name: Publish NuGet artifacts
127+
if: ${{ matrix.publish_nuget }}
128+
uses: actions/upload-artifact@v4
129+
with:
130+
name: NuGet package
131+
path: BitFaster.Caching/bin/Release/
211132

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

0 commit comments

Comments
 (0)