-
-
Notifications
You must be signed in to change notification settings - Fork 171
172 lines (153 loc) · 5.88 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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: 🏭 Build
on:
push:
branches:
- main
- 'v*.*'
- validate/*
pull_request:
workflow_dispatch:
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
BUILDCONFIGURATION: Release
# codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages/
# dotnetfoundation code signing
jobs:
build:
name: 🏭 Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
- windows-2022
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
submodules: true
- name: ⚙ Install prerequisites
run: |
./init.ps1 -UpgradePrerequisites
dotnet --info
# Print mono version if it is present.
if (Get-Command mono -ErrorAction SilentlyContinue) {
mono --version
}
shell: pwsh
- name: ⚙ Install 32-bit .NET SDK and runtimes
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile dotnet-install.ps1
& .\dotnet-install.ps1 -Architecture x86 -Version 9.0.101 -InstallDir "C:\Program Files (x86)\dotnet\" -NoPath -Verbose
if: runner.os == 'Windows'
- name: ⚙️ Set pipeline variables based on source
run: tools/variables/_define.ps1
shell: pwsh
- name: 🛠 build
run: dotnet build -t:build,pack --no-restore -c ${{ env.BUILDCONFIGURATION }} -warnAsError -warnNotAsError:NU1901,NU1902,NU1903,NU1904 /bl:"${{ runner.temp }}/_artifacts/build_logs/build.binlog"
- name: 🛠️ Build LKG package
run: dotnet pack -c ${{ env.BUILDCONFIGURATION }} --no-build -p:PackLKG=true /bl:"${{ runner.temp }}/_artifacts/build_logs/msbuild_lkg.binlog"
working-directory: src/Nerdbank.GitVersioning.Tasks
- name: 📢 Publish nbgv tool
run: dotnet publish -c ${{ env.BUILDCONFIGURATION }} -o ../nerdbank-gitversioning.npm/out/nbgv.cli/tools/net8.0/any /bl:"${{ runner.temp }}/_artifacts/build_logs/nbgv_publish.binlog"
working-directory: src/nbgv
- name: 🛠️ Build nerdbank-gitversioning NPM package
run: yarn build
working-directory: src/nerdbank-gitversioning.npm
- name: Capture .git directory
shell: pwsh
run: |
md $(Build.ArtifactStagingDirectory)\drop
7z a $(Build.ArtifactStagingDirectory)\drop\nbgv.7z * -r
Write-Host "##vso[artifact.upload containerfolder=drop;artifactname=drop;]$(Build.ArtifactStagingDirectory)\drop"
if: failure() && runner.os == 'Windows'
- name: 🧪 test
run: |
Write-Host "⚙️ Configure git commit author for testing"
git config --global user.name ci
git config --global user.email me@ci.com
Write-Host "🧪 Run tests"
tools/dotnet-test-cloud.ps1 -Configuration ${{ env.BUILDCONFIGURATION }} -Agent ${{ runner.os }} -PublishResults
shell: pwsh
- name: 🧪 test x86
run: tools/dotnet-test-cloud.ps1 -Configuration ${{ env.BUILDCONFIGURATION }} -Agent ${{ runner.os }} -PublishResults -X86
if: success() && runner.os == 'Windows'
- name: 💅🏻 Verify formatted code
run: dotnet format --verify-no-changes --no-restore
shell: pwsh
if: runner.os == 'Linux'
- name: 📚 Verify docfx build
run: dotnet docfx docfx/docfx.json --warningsAsErrors --disableGitFeatures
if: runner.os == 'Linux'
- name: ⚙ Update pipeline variables based on build outputs
run: tools/variables/_define.ps1
shell: pwsh
- name: 📢 Publish artifacts
uses: ./.github/actions/publish-artifacts
if: cancelled() == false
- name: 📢 Publish code coverage results to codecov.io
run: ./tools/publish-CodeCov.ps1 -CodeCovToken "${{ env.codecov_token }}" -PathToCodeCoverage "${{ runner.temp }}/_artifacts/coverageResults" -Name "${{ runner.os }} Coverage Results" -Flags "${{ runner.os }}"
shell: pwsh
timeout-minutes: 3
continue-on-error: true
if: env.codecov_token != ''
functional_testing:
name: 🧪 Functional testing
needs: build
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
container:
- mcr.microsoft.com/dotnet/sdk:8.0-jammy
- mcr.microsoft.com/dotnet/sdk:9.0-noble
- mcr.microsoft.com/dotnet/sdk:8.0
- mcr.microsoft.com/dotnet/sdk:9.0
steps:
- name: Show .NET SDK info
run: dotnet --info
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
name: deployables-Windows
path: ${{ runner.temp }}/deployables
- name: Set up git username and email address
run: |
git config --global init.defaultBranch main
git config --global user.name ci
git config --global user.email me@ci.com
perf_testing:
name: 🫏 Performance testing
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
repoDir: '~/git'
- os: windows-2022
repoDir: '${USERPROFILE}/source/repos'
- os: macos-14
repoDir: '~/git'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
submodules: true
- name: Setup .NET Core
uses: actions/setup-dotnet@v2
with:
global-json-file: global.json
- name: Show .NET SDK info
run: dotnet --info
- name: Clone test repos
shell: bash
run: |
mkdir -p $(repoDir)
git clone https://github.com/xunit/xunit "${{ matrix.repoDir }}"
git clone https://github.com/gimlichael/Cuemon "${{ matrix.repoDir }}"
git clone https://github.com/kerryjiang/SuperSocket "${{ matrix.repoDir }}"
git clone https://github.com/dotnet/Nerdbank.GitVersioning "${{ matrix.repoDir }}"