Repository navigation
Expand file tree
/
Copy pathtemplate-build-test-project.yml
More file actions
67 lines (60 loc) · 2.29 KB
/
Copy pathtemplate-build-test-project.yml
File metadata and controls
67 lines (60 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Template - Project Build/Test
on:
workflow_call:
inputs:
name:
description: "Display Name of Job"
required: true
type: string
source-directory:
description: "Relative path to source directory folder"
required: true
type: string
source-project:
description: "File name of .csproj file in source directory folder"
required: true
type: string
test-directory:
description: "Relative path to test directory folder"
required: true
type: string
test-project:
description: "File Name of .csproj file in test directory folder"
required: true
type: string
jobs:
project-build-test:
name: ${{ inputs.name }} (${{ matrix.dotnet-target-framework }})
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-target-framework: ["net6.0", "net7.0", "net8.0"]
include:
- dotnet-install-framework: 6.0.x
dotnet-target-framework: net6.0
- dotnet-install-framework: 7.0.x
dotnet-target-framework: net7.0
- dotnet-install-framework: 8.0.x
dotnet-target-framework: net8.0
env:
source-directory: ${{ inputs.source-directory }}
source-project: ${{ inputs.source-project }}
test-directory: ${{ inputs.test-directory }}
test-project: ${{ inputs.test-project }}
steps:
- uses: actions/checkout@v2
- name: Install .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-install-framework }}
include-prerelease: true
- name: Install Dependencies
run: |
dotnet restore ${{ env.source-directory }}/${{ env.source-project }} -p:TargetFramework=${{ matrix.dotnet-target-framework }}
dotnet restore ${{ env.test-directory }}/${{ env.test-project }} -p:TargetFramework=${{ matrix.dotnet-target-framework }}
- name: Build
working-directory: ${{ env.source-directory }}
run: dotnet build --configuration Release -p:TargetFramework=${{ matrix.dotnet-target-framework }} --no-restore
- name: Test
working-directory: ${{ env.test-directory }}
run: dotnet test -p:TargetFramework=${{ matrix.dotnet-target-framework }} --no-restore --verbosity normal