Skip to content

Commit 0934df5

Browse files
committed
📝 Chore(Actions): Upgraded build.yml with matrix strategy.
1 parent 5a228e0 commit 0934df5

1 file changed

Lines changed: 18 additions & 36 deletions

File tree

.github/workflows/build.yml

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build
1+
name: Build
22

33
on:
44
push:
@@ -17,67 +17,49 @@ on:
1717
workflow_dispatch:
1818

1919
jobs:
20-
build-on-windows:
21-
runs-on: windows-latest
20+
build:
21+
strategy:
22+
matrix:
23+
os: [windows-latest, linux-latest, macos-latest]
24+
25+
runs-on: ${{ matrix.os }}
2226

2327
steps:
2428
- uses: actions/checkout@v3
2529

2630
- name: Setup .NET
2731
uses: actions/setup-dotnet@v2
2832
with:
29-
dotnet-version: "6.0.x"
33+
dotnet-version: |
34+
6.0.x
35+
7.0.x
3036
include-prerelease: false
3137

3238
- name: Build
3339
run: |
3440
cd Common.BasicHelper
35-
dotnet build -c Release
36-
37-
build-on-ubuntu:
38-
runs-on: ubuntu-latest
39-
40-
steps:
41-
- uses: actions/checkout@v3
4241
43-
- name: Setup .NET
44-
uses: actions/setup-dotnet@v2
45-
with:
46-
dotnet-version: "6.0.x"
47-
include-prerelease: false
42+
dotnet build -c Release
4843
49-
- name: Build
44+
- name: Test
5045
run: |
51-
cd Common.BasicHelper
52-
dotnet build -c Release
46+
cd Common.BasicHelper.Test
47+
48+
dotnet test -c Release
5349
5450
- name: Add to GitHub Repo
51+
if: ${{ matrix.os == 'ubuntu-latest' }}
5552
run: |
5653
nuget sources add -name github -Source https://nuget.pkg.github.com/Crequency/index.json -Username Crequency -Password ${{ secrets.GitHubToken }}
5754
5855
- name: Install NuGet
56+
if: ${{ matrix.os == 'ubuntu-latest' }}
5957
uses: nuget/setup-nuget@v1
6058
with:
6159
nuget-version: "6.x"
6260

6361
- name: Publish Package to GitHub and NuGet
62+
if: ${{ matrix.os == 'ubuntu-latest' }}
6463
run: |
6564
nuget push ./Common.BasicHelper/bin/Release/*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NugetKey }} -NoSymbol
6665
nuget push ./Common.BasicHelper/bin/Release/*.nupkg -Source github -SkipDuplicate
67-
68-
build-on-macos:
69-
runs-on: macos-latest
70-
71-
steps:
72-
- uses: actions/checkout@v3
73-
74-
- name: Setup .NET
75-
uses: actions/setup-dotnet@v2
76-
with:
77-
dotnet-version: "6.0.x"
78-
include-prerelease: false
79-
80-
- name: Build
81-
run: |
82-
cd Common.BasicHelper
83-
dotnet build -c Release

0 commit comments

Comments
 (0)