-
Notifications
You must be signed in to change notification settings - Fork 12
144 lines (135 loc) · 4.62 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
name: CI
on:
push:
branches:
- main
- validate/*
tags:
- v*.*
pull_request:
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
BUILDCONFIGURATION: Release
codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages/
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
- macos-14
- windows-2022
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- 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: ⚙️ Set pipeline variables based on source
run: azure-pipelines/variables/_pipelines.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: 🧪 test
run: azure-pipelines/dotnet-test-cloud.ps1 -Configuration ${{ env.BUILDCONFIGURATION }} -Agent ${{ runner.os }}
shell: pwsh
- 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: azure-pipelines/variables/_pipelines.ps1
shell: pwsh
- name: 📥 Collect artifacts
run: azure-pipelines/artifacts/_stage_all.ps1
shell: pwsh
if: always()
- name: 📢 Upload project.assets.json files
if: always()
uses: actions/upload-artifact@v4
with:
name: projectAssetsJson-${{ runner.os }}
path: ${{ runner.temp }}/_artifacts/projectAssetsJson
continue-on-error: true
- name: 📢 Upload variables
uses: actions/upload-artifact@v4
with:
name: variables-${{ runner.os }}
path: ${{ runner.temp }}/_artifacts/Variables
continue-on-error: true
- name: 📢 Upload build_logs
if: always()
uses: actions/upload-artifact@v4
with:
name: build_logs-${{ runner.os }}
path: ${{ runner.temp }}/_artifacts/build_logs
continue-on-error: true
- name: 📢 Upload test_logs
if: always()
uses: actions/upload-artifact@v4
with:
name: test_logs-${{ runner.os }}
path: ${{ runner.temp }}/_artifacts/test_logs
continue-on-error: true
- name: 📢 Upload testResults
if: always()
uses: actions/upload-artifact@v4
with:
name: testResults-${{ runner.os }}
path: ${{ runner.temp }}/_artifacts/testResults
continue-on-error: true
- name: 📢 Upload coverageResults
if: always()
uses: actions/upload-artifact@v4
with:
name: coverageResults-${{ runner.os }}
path: ${{ runner.temp }}/_artifacts/coverageResults
continue-on-error: true
- name: 📢 Upload symbols
uses: actions/upload-artifact@v4
with:
name: symbols-${{ runner.os }}
path: ${{ runner.temp }}/_artifacts/symbols
continue-on-error: true
- name: 📢 Upload deployables
uses: actions/upload-artifact@v4
with:
name: deployables-${{ runner.os }}
path: ${{ runner.temp }}/_artifacts/deployables
if: always()
- name: 📢 Publish code coverage results to codecov.io
run: ./azure-pipelines/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 != ''
ship:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: 🔻 Download deployables artifacts
uses: actions/download-artifact@v4
with:
name: deployables-Linux
path: ${{ runner.temp }}/deployables
- name: 🚀 Push NuGet packages
run: |
rm global.json
dotnet nuget push ${{ runner.temp }}/deployables/*.nupkg --source https://api.nuget.org/v3/index.json -k '${{ secrets.NUGET_API_KEY }}'