-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathci.yml
More file actions
138 lines (134 loc) · 4.58 KB
/
ci.yml
File metadata and controls
138 lines (134 loc) · 4.58 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# Reusable workflow that builds the repository's code, executes tests, and then deploys the packages to NuGet when a push is made to the default branch.
# To configure this workflow, replace variables with their correct values in the workflow-scoped env map.
name: CI/CD
on:
push:
branches:
- $default-branch
paths-ignore:
- '.github/workflows/**'
- '!.github/workflows/ci.yml'
pull_request:
branches:
- $default-branch
workflow_call:
inputs:
release-build:
required: true
type: boolean
default: false
skip-tests:
required: false
type: boolean
default: false
outputs:
build-artifact-name:
description: Build output artifact name
value: ${{ jobs.build.outputs.build-artifact-name }}
secrets:
REPO_TOKEN:
required: true
NUGET_API_KEY:
required: true
env:
PACKAGE_CONFIGURATION: 'Release' # Replace with the build configuration to use when creating packages.
ADDITIONAL_RESTORE_PROPERTIES: # Add any additional MSBuild properties to define during package restoration.
BUILD_ARTIFACT_NAME: 'binaries'
jobs:
build:
name: Fetch and Build Source
runs-on: windows-2025-vs2026
outputs:
build-submodule-sha: ${{ steps.submodule-status.outputs.BUILD_SUBMODULE_SHA }}
build-artifact-name: ${{ env.BUILD_ARTIFACT_NAME }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Get Build Submodule Hash
id: submodule-status
run: Write-Output "BUILD_SUBMODULE_SHA=$($(-split $(git submodule status build))[0])" >> $Env:GITHUB_OUTPUT
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Build
run: .\build\Invoke-Build.ps1 -ReleaseBuild:$([System.Convert]::ToBoolean($Env:RELEASE_BUILD)) -PackageConfiguration:$Env:PACKAGE_CONFIGURATION -AdditionalRestoreProperties:@($Env:ADDITIONAL_RESTORE_PROPERTIES)
env:
RELEASE_BUILD: ${{ inputs.release-build != '' && inputs.release-build || 'false' }}
PACKAGE_CONFIGURATION: ${{ env.PACKAGE_CONFIGURATION }}
ADDITIONAL_RESTORE_PROPERTIES: ${{ env.ADDITIONAL_RESTORE_PROPERTIES }}
# Store our compiled assets for subsequent jobs.
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_ARTIFACT_NAME }}
path: bin/rel/
- name: Upload Package Artifact
uses: actions/upload-artifact@v4
with:
name: packages
path: artifacts/
test:
name: Run Unit Tests
needs: build
if: inputs.skip-tests != true
runs-on: windows-2025-vs2026
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Add VSTest to PATH
uses: darenm/Setup-VSTest@v1.3
- name: Download Build Artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.BUILD_ARTIFACT_NAME }}
path: bin/rel/
- name: Execute Test Runner
run: |
Get-ChildItem bin\rel\*.Tests.dll | `
ForEach-Object {vstest.console /Logger:trx`;LogFileName="$($_.BaseName).trx" /ResultsDirectory:testResults $_.FullName; if ($LASTEXITCODE -eq 1) {$failWhenDone = $true} }; `
if ($failWhenDone -eq $true) { exit 1 }
- name: Upload Test Artifact
uses: actions/upload-artifact@v4
with:
name: test-results
path: testResults/
- name: Generate Report
if: always()
uses: EnricoMi/publish-unit-test-result-action/windows@v2
with:
check_name: Unit Test Results
files: testResults/**/*.trx
deploy:
name: Deploy Packages
needs: [build, test]
if: always() && github.event_name != 'pull_request'
runs-on: windows-2025-vs2026
steps:
- name: Check Previous Jobs' Results
if: needs.build.result != 'success' || (needs.test.result != 'success' && inputs.skip-tests != true)
run: exit 1
- name: Checkout Build Submodule
uses: actions/checkout@v4
with:
repository: BadEcho/build
ref: ${{ needs.build.outputs.build-submodule-sha }}
path: build
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Download Package Artifact
uses: actions/download-artifact@v4
with:
name: packages
path: artifacts/
- name: Push to NuGet
run: .\build\Publish-Packages.ps1 ${{ secrets.NUGET_API_KEY }}