-
Notifications
You must be signed in to change notification settings - Fork 37
304 lines (283 loc) · 13.7 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
name: Build
on:
push:
branches:
- '**'
paths-ignore:
- '**.md'
pull_request:
branches:
- '**'
paths-ignore:
- '**.md'
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
buildConfiguration: 'Debug'
skipTests: false
deterministicTests: true
jobs:
BuildAndTest:
strategy:
fail-fast: false
matrix:
aceVersion:
- 2010
- 2016
aceArchitecture:
- x64
- x86
dataAccessProviderType:
- ODBC
- OLE DB
os:
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set additional variables
shell: pwsh
run: |
$os = '${{ matrix.os }}'.Split('-')[0]
echo "os=$os" >> $env:GITHUB_ENV
$dotnetInstallDirectory = '.\.dotnet_${{ matrix.aceArchitecture }}'
echo "dotnetInstallDirectory=$dotnetInstallDirectory" >> $env:GITHUB_ENV
$dotnetExecutable = Join-Path $dotnetInstallDirectory 'dotnet.exe'
echo "dotnetExecutable=$dotnetExecutable" >> $env:GITHUB_ENV
$aceUrls = @{
'2010' = @{
'x64' = 'https://download.microsoft.com/download/2/4/3/24375141-E08D-4803-AB0E-10F2E3A07AAA/AccessDatabaseEngine_X64.exe'
'x86' = 'https://download.microsoft.com/download/2/4/3/24375141-E08D-4803-AB0E-10F2E3A07AAA/AccessDatabaseEngine.exe'
'silent' = '/passive /quiet /norestart REBOOT=ReallySuppress'
}
'2016' = @{
'x64' = 'https://download.microsoft.com/download/3/5/C/35C84C36-661A-44E6-9324-8786B8DBE231/AccessDatabaseEngine_X64.exe'
'x86' = 'https://download.microsoft.com/download/3/5/C/35C84C36-661A-44E6-9324-8786B8DBE231/AccessDatabaseEngine.exe'
'silent' = '/passive /quiet /norestart REBOOT=ReallySuppress'
}
}
$aceUrl = $aceUrls['${{ matrix.aceVersion }}']['${{ matrix.aceArchitecture }}']
echo "aceUrl=$aceUrl" >> $env:GITHUB_ENV
$aceSilentInstallArgument = $aceUrls['${{ matrix.aceVersion }}']['silent']
echo "aceSilentInstallArgument=$aceSilentInstallArgument" >> $env:GITHUB_ENV
$defaultConnection = '${{ matrix.dataAccessProviderType }}' -eq 'ODBC' ? 'DBQ=Jet.accdb' : 'Data Source=Jet.accdb;Persist Security Info=False;'
echo "defaultConnection=$defaultConnection" >> $env:GITHUB_ENV
- name: Output Variables
shell: pwsh
run: |
echo "os: ${{ env.os }}"
echo "buildConfiguration: ${{ env.buildConfiguration }}"
echo "aceVersion: ${{ matrix.aceVersion }}"
echo "aceArchitecture: ${{ matrix.aceArchitecture }}"
echo "aceUrl: ${{ env.aceUrl }}"
echo "aceSilentInstallArgument: ${{ env.aceSilentInstallArgument }}"
echo "dataAccessProviderType: ${{ matrix.dataAccessProviderType }}"
echo "defaultConnection: ${{ env.defaultConnection }}"
echo "skipTests: ${{ env.skipTests }}"
echo "dotnetInstallDirectory: ${{ env.dotnetInstallDirectory }}"
echo "dotnetExecutable: ${{ env.dotnetExecutable }}"
echo "github.event_name: ${{ github.event_name }}"
echo "github.repository: ${{ github.repository }}"
- name: .NET Information Before SDK Install
shell: pwsh
run: try { & '${{ env.dotnetExecutable }}' --info } catch { echo 'No ${{ matrix.aceArchitecture }} .NET SDK installed.' }
- name: Install .NET SDK
shell: pwsh
run: |
&([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -JSonFile global.json -Architecture '${{ matrix.aceArchitecture }}' -InstallDir '${{ env.dotnetInstallDirectory }}' -Verbose
- name: .NET Information After SDK Install
shell: pwsh
run: try { & '${{ env.dotnetExecutable }}' --info } catch { echo 'No ${{ matrix.aceArchitecture }} .NET SDK installed.' }
- name: ACE Information Before ACE Install
shell: pwsh
run: |
'DAO:'
Get-ChildItem 'HKLM:\SOFTWARE\Classes\DAO.DBEngine*' | Select-Object
'OLE DB:'
foreach ($provider in [System.Data.OleDb.OleDbEnumerator]::GetRootEnumerator())
{
$v = New-Object PSObject
for ($i = 0; $i -lt $provider.FieldCount; $i++)
{
Add-Member -in $v NoteProperty $provider.GetName($i) $provider.GetValue($i)
}
$v
}
- name: Install Access Database Engine
shell: pwsh
run: |
$setupFileName = 'AccessDatabaseEngine_${{ matrix.aceVersion }}_${{ matrix.aceArchitecture }}.exe'
Invoke-WebRequest '${{ env.aceUrl }}' -OutFile $setupFileName
& ".\$setupFileName" ${{ env.aceSilentInstallArgument }} | Out-Default
- name: ACE Information After ACE Install
shell: pwsh
run: |
'DAO:'
Get-ChildItem 'HKLM:\SOFTWARE\Classes\DAO.DBEngine*' | Select-Object
'OLE DB:'
foreach ($provider in [System.Data.OleDb.OleDbEnumerator]::GetRootEnumerator())
{
$v = New-Object PSObject
for ($i = 0; $i -lt $provider.FieldCount; $i++)
{
Add-Member -in $v NoteProperty $provider.GetName($i) $provider.GetValue($i)
}
$v
}
- name: Build Solution
shell: pwsh
run: |
& '${{ env.dotnetExecutable }}' build --configuration ${{ env.buildConfiguration }} -p:FixedTestOrder=${{ env.deterministicTests }}
- name: 'Run Tests: EFCore.Jet.Data.Tests'
shell: pwsh
run: |
$env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}'
& '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.Data.Tests -c '${{ env.buildConfiguration }}' --no-build --logger trx --verbosity detailed --blame-hang-timeout 3m
- name: 'Run Tests: EFCore.Jet.FunctionalTests'
shell: pwsh
continue-on-error: true
run: |
$env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}'
& '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.FunctionalTests -c '${{ env.buildConfiguration }}' --no-build --logger trx --verbosity detailed --blame-hang-timeout 3m
exit 0
- name: 'Run Tests: EFCore.Jet.Tests'
shell: pwsh
run: |
$env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}'
& '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.Tests -c '${{ env.buildConfiguration }}' --no-build --logger trx --verbosity detailed --blame-hang-timeout 3m
NuGet:
needs: BuildAndTest
if: github.event_name == 'push' && github.repository == 'CirrusRedOrg/EntityFrameworkCore.Jet'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
- name: .NET Information
shell: pwsh
run: |
dotnet --info
- name: NuGet Pack
shell: pwsh
run: |
$officialBuild = '${{ github.ref }}' -match '(?<=^refs/tags/v)\d+\.\d+\.\d+.*$'
$officialVersion = $Matches.0
$wipBuild = '${{ github.ref }}' -match '^refs/heads/.*-wip$'
$ciBuildOnly = $wipBuild -or ('${{ github.ref }}' -match '^refs/heads/(?:master|.*-servicing)$')
$continuousIntegrationTimestamp = Get-Date -Format yyyyMMddHHmmss
$buildSha = '${{ github.sha }}'.SubString(0, 7);
$pack = $officialBuild -or $ciBuildOnly
$pushToAzureArtifacts = $pack
$pushToMygetOrg = $pack
$pushToNugetOrg = $pack -and $officialBuild
echo "pushToAzureArtifacts: $pushToAzureArtifacts"
echo "pushToMygetOrg: $pushToMygetOrg"
echo "pushToNugetOrg: $pushToNugetOrg"
echo "officialBuild: $officialBuild"
echo "officialVersion: $officialVersion"
echo "wipBuild: $wipBuild"
echo "ciBuildOnly: $ciBuildOnly"
echo "continuousIntegrationTimestamp: $continuousIntegrationTimestamp"
echo "buildSha: $buildSha"
echo "pack: $pack"
if ($pack)
{
$projectFiles = Get-ChildItem src/*/*.csproj -Recurse | % { $_.FullName }
$combinations = @('default', @('Release')), @('withPdbs', @('Release', 'Debug')) #, @('embeddedPdbs', @('Release', 'Debug'))
foreach ($combination in $combinations)
{
$type = $combination[0]
$configurations = $combination[1]
foreach ($configuration in $configurations)
{
$arguments = 'pack', '-c', $configuration, '-o', "nupkgs/$configuration/$type", '-p:ContinuousIntegrationBuild=true'
if ($officialBuild)
{
$finalOfficialVersion = $officialVersion
if ($configuration -eq 'Debug')
{
$finalOfficialVersion += '-debug'
}
$arguments += "-p:OfficialVersion=$finalOfficialVersion"
}
if ($ciBuildOnly)
{
$arguments += "-p:ContinuousIntegrationTimestamp=$continuousIntegrationTimestamp"
$arguments += "-p:BuildSha=$buildSha"
}
switch ($type)
{
'withPdbs' { $arguments += '-p:PackPdb=true', '-p:IncludeSymbols=false' }
'embeddedPdbs' { $arguments += '-p:DebugType=embedded', '-p:IncludeSymbols=false' }
}
foreach ($projectFile in $projectFiles)
{
echo "Type: $type, Configuration: $configuration, Project: $projectFile"
echo "Pack command: dotnet $(($arguments + $projectFile) -join ' ')"
& dotnet ($arguments + $projectFile)
}
}
}
}
echo "pushToAzureArtifacts=$pushToAzureArtifacts" >> $env:GITHUB_ENV
echo "pushToMygetOrg=$pushToMygetOrg" >> $env:GITHUB_ENV
echo "pushToNugetOrg=$pushToNugetOrg" >> $env:GITHUB_ENV
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: nupkgs
path: nupkgs
# - name: "NuGet Push - AZDO Feed - Debug"
# if: ${{ env.pushToAzureArtifacts == 'true' }}
# working-directory: nupkgs
# shell: pwsh
# run: |
# # https://learn.microsoft.com/en-us/azure/devops/artifacts/nuget/dotnet-exe?view=azure-devops#publish-packages-from-external-sources
# dotnet new nugetconfig --output './azdo-nuget' --force
# try
# {
# nuget sources Add -ConfigFile './azdo-nuget/nuget.config' -Name 'azdo-efcore-jet-debug' -Source 'https://bubibubi.pkgs.visualstudio.com/EntityFrameworkCore.Jet/_packaging/public/nuget/v3/index.json' -UserName '${{ vars.AZUREDEVOPS_BUBIBUBI_ALLPACKAGES_PUSHNEW_USERNAME }}' -Password '${{ secrets.AZUREDEVOPS_BUBIBUBI_ALLPACKAGES_PUSHNEW_PASSWORD }}' -StorePasswordInClearText
#
# nuget push './Release/withPdbs/**/*.nupkg' -ConfigFile './azdo-nuget/nuget.config' -ApiKey 'foo' -Source 'https://bubibubi.pkgs.visualstudio.com/EntityFrameworkCore.Jet/_packaging/public/nuget/v3/index.json'
# }
# finally
# {
# Remove-Item ./azdo-nuget -Recurse -Force
# }
# - name: "NuGet Push - AZDO Feed - Release"
# if: ${{ env.pushToAzureArtifacts == 'true' }}
# working-directory: nupkgs
# shell: pwsh
# run: |
# # https://learn.microsoft.com/en-us/azure/devops/artifacts/nuget/dotnet-exe?view=azure-devops#publish-packages-from-external-sources
# dotnet new nugetconfig --output './azdo-nuget' --force
# try
# {
# nuget sources Add -ConfigFile './azdo-nuget/nuget.config' -Name 'azdo-efcore-jet-public' -Source 'https://bubibubi.pkgs.visualstudio.com/EntityFrameworkCore.Jet/_packaging/public/nuget/v3/index.json' -UserName '${{ vars.AZUREDEVOPS_POMELO_ALLPACKAGES_PUSHNEW_USERNAME }}' -Password '${{ secrets.AZUREDEVOPS_POMELO_ALLPACKAGES_PUSHNEW_PASSWORD }}' -StorePasswordInClearText
#
# nuget push './Release/withPdbs/**/*.nupkg' -ConfigFile './azdo-nuget/nuget.config' -ApiKey 'foo' -Source 'https://bubibubi.pkgs.visualstudio.com/EntityFrameworkCore.Jet/_packaging/public/nuget/v3/index.json'
# }
# finally
# {
# Remove-Item ./azdo-nuget -Recurse -Force
# }
- name: "NuGet Push - myget.org - Debug"
if: ${{ env.pushToMygetOrg == 'true' }}
working-directory: nupkgs
shell: pwsh
run: dotnet nuget push './Debug/withPdbs/**/*.nupkg' --api-key '${{ secrets.MYGETORG_CIRRUSRED_ALLPACKAGES_DEBUG_PUSHNEW }}' --source 'https://www.myget.org/F/cirrusred-debug/api/v3/index.json'
- name: "NuGet Push - myget.org - Release"
if: ${{ env.pushToMygetOrg == 'true' }}
working-directory: nupkgs
shell: pwsh
run: dotnet nuget push './Release/default/**/*.nupkg' --api-key '${{ secrets.MYGETORG_CIRRUSRED_ALLPACKAGES_PUSHNEW }}' --source 'https://www.myget.org/F/cirrusred/api/v3/index.json'
- name: "NuGet Push - nuget.org - Release"
if: ${{ env.pushToNugetOrg == 'true' }}
working-directory: nupkgs
shell: pwsh
run: dotnet nuget push './Release/default/**/*.nupkg' --api-key '${{ secrets.NUGETORG_EFCOREJET_ALLPACKAGES_PUSHNEW }}' --source 'https://api.nuget.org/v3/index.json'