-
Notifications
You must be signed in to change notification settings - Fork 11
70 lines (55 loc) · 2.81 KB
/
build.yml
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
68
69
70
name: Build
on:
workflow_call:
inputs:
dotnet-version:
required: true
type: string
description: 'The version of .NET to use for the build'
default: '8.0.x'
os:
required: true
type: string
description: 'The operating system to use for the build'
default: 'ubuntu-latest'
jobs:
build:
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v4
- name: Emit .NET 6.0 Framework Version (Ubuntu or MacOS)
if: ${{ inputs.dotnet-version == '6.0.x' && (startsWith(inputs.os, 'ubuntu-') || startsWith(inputs.os, 'macos-')) }}
run: echo "DOTNET_FX_VERSION=net6.0" >> $GITHUB_ENV
- name: Emit .NET 6.0 Framework Version (Windows)
if: ${{ inputs.dotnet-version == '6.0.x' && startsWith(inputs.os, 'windows-') }}
run: echo "DOTNET_FX_VERSION=net6.0" >> $env:GITHUB_ENV
- name: Emit .NET 7.0 Framework Version (Ubuntu or MacOS)
if: ${{ inputs.dotnet-version == '7.0.x' && (startsWith(inputs.os, 'ubuntu-') || startsWith(inputs.os, 'macos-')) }}
run: echo "DOTNET_FX_VERSION=net7.0" >> $GITHUB_ENV
- name: Emit .NET 7.0 Framework Version (Windows)
if: ${{ inputs.dotnet-version == '7.0.x' && startsWith(inputs.os, 'windows-') }}
run: echo "DOTNET_FX_VERSION=net7.0" >> $env:GITHUB_ENV
- name: Emit .NET 8.0 Framework Version (Ubuntu or MacOS)
if: ${{ inputs.dotnet-version == '8.0.x' && (startsWith(inputs.os, 'ubuntu-') || startsWith(inputs.os, 'macos-')) }}
run: echo "DOTNET_FX_VERSION=net8.0" >> $GITHUB_ENV
- name: Emit .NET 8.0 Framework Version (Windows)
if: ${{ inputs.dotnet-version == '8.0.x' && startsWith(inputs.os, 'windows-') }}
run: echo "DOTNET_FX_VERSION=net8.0" >> $env:GITHUB_ENV
- name: Setup .NET ${{ inputs.dotnet-version }} Framework
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ inputs.dotnet-version }}
- name: Restore dependencies
run: dotnet restore
- name: Build (Ubuntu or MacOS)
run: dotnet build --no-restore -c Release -f ${{ env.DOTNET_FX_VERSION }}
if: ${{ startsWith(inputs.os, 'ubuntu-') || startsWith(inputs.os, 'macos-') }}
- name: Build (Windows)
run: dotnet build --no-restore -c Release -f $env:DOTNET_FX_VERSION
if: ${{ startsWith(inputs.os, 'windows-') }}
- name: Test (Ubuntu or MacOS)
run: dotnet test --no-build --verbosity normal -c Release -f ${{ env.DOTNET_FX_VERSION }}
if: ${{ startsWith(inputs.os, 'ubuntu-') || startsWith(inputs.os, 'macos-') }}
- name: Test (Windows)
run: dotnet test --no-build --verbosity normal -c Release -f $env:DOTNET_FX_VERSION
if: ${{ startsWith(inputs.os, 'windows-') }}