Repository navigation
70 lines (60 loc) · 2.65 KB
/
Copy pathci.yml
File metadata and controls
70 lines (60 loc) · 2.65 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
68
69
70
name: ci
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
jobs:
ci:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set template validation paths
shell: pwsh
run: |
"TEMPLATE_OUTPUT=$(Join-Path $env:RUNNER_TEMP 'template-validation')" >> $env:GITHUB_ENV
"TEMPLATE_PACKAGES=$(Join-Path $env:RUNNER_TEMP 'template-packages')" >> $env:GITHUB_ENV
- name: Setup .NET 10
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.x
- name: Pack template in Release
shell: pwsh
run: dotnet pack XrmBedrock.Template.csproj --configuration Release --output "$env:TEMPLATE_PACKAGES"
- name: Install packed template
shell: pwsh
run: |
$packages = @(Get-ChildItem "$env:TEMPLATE_PACKAGES/XrmBedrock.*.nupkg")
if ($packages.Count -ne 1) { throw 'Expected exactly one packed template' }
$package = $packages[0]
dotnet new install $package.FullName
if ($LASTEXITCODE -ne 0) { throw 'Template installation failed' }
- name: Create solution from packed template
shell: pwsh
run: |
# Do not run the interactive Dataverse post-action; use offline sample data below.
dotnet new xrmbedrock --name TemplateValidation --company-name ValidationCompany --publisher-prefix val --solution ValidationSolution --output "$env:TEMPLATE_OUTPUT" --allow-scripts no --no-update-check
# 105 means creation succeeded but a post-action failed (the script is intentionally denied).
$creationExitCode = $LASTEXITCODE
if ($creationExitCode -notin @(0, 105)) {
throw "Template creation failed with exit code $creationExitCode"
}
if (-not (Test-Path "$env:TEMPLATE_OUTPUT/ValidationCompany.slnx")) {
throw 'The generated solution was not renamed correctly'
}
if (-not (Test-Path "$env:TEMPLATE_OUTPUT/test/Tests/DataProducer/DataProducer_SampleArea.cs")) {
throw 'The packed template is missing the sample data producer'
}
# GitHub's pwsh wrapper propagates LASTEXITCODE, so clear the accepted post-action status.
$global:LASTEXITCODE = 0
- name: Set up generated solution with sample data
uses: ./.github/actions/setup-build-env
with:
working-directory: ${{ env.TEMPLATE_OUTPUT }}
- name: Build generated solution in Release
working-directory: ${{ env.TEMPLATE_OUTPUT }}
run: dotnet build ValidationCompany.slnx --no-restore --configuration Release