-
Notifications
You must be signed in to change notification settings - Fork 4.9k
86 lines (68 loc) · 2.11 KB
/
ci-dotnet-samples.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: ci-dotnet-samples
env:
ROOT_FOLDER: BotBuilder-Samples/samples/
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- "samples/**/*.cs"
jobs:
generate:
name: detect and generate bot matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- name: git diff
uses: technote-space/get-diff-action@v4
with:
PATTERNS: samples/**/*.cs
ABSOLUTE: true
- name: generate matrix
id: set-matrix
shell: pwsh
if: env.GIT_DIFF
run: |
function UpSearchFolder {
param ([String] $path, [String] $file)
while ($path -and !(Test-Path (Join-Path $path $file))) {
$path = Split-Path $path -Parent
}
return $path
}
$paths = @("${{ env.GIT_DIFF_FILTERED }}" -replace "'", "" -split " ")
$rootFolder = "${{ env.ROOT_FOLDER }}"
$result = $paths | ForEach-Object { UpSearchFolder -path $_ -file "*.csproj" } | Get-Unique | ForEach-Object {
$folder = $_
return @{
name = $folder.Substring($folder.IndexOf($rootFolder) + $rootFolder.Length);
folder = $folder;
}
}
"Generated matrix:"
ConvertTo-Json @($result)
$matrix = ConvertTo-Json -Compress @($result)
echo "::set-output name=matrix::$($matrix)"
build:
needs: generate
runs-on: ubuntu-latest
strategy:
matrix:
include: ${{fromJSON(needs.generate.outputs.matrix)}}
fail-fast: false
name: bot - ${{ matrix.name }}
steps:
- uses: actions/checkout@v3
- name: use .net 8.0.x
uses: actions/setup-dotnet@v2
with:
dotnet-version: "8.0.x"
- name: dotnet restore
run: dotnet restore
working-directory: ${{ matrix.folder }}
- name: dotnet build
run: dotnet build --configuration Release --no-restore --nologo --clp:NoSummary
working-directory: ${{ matrix.folder }}