-
Notifications
You must be signed in to change notification settings - Fork 33
224 lines (215 loc) · 10.6 KB
/
InitDev, Unit tests, Integration tests, Package.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
# SPDX-License-Identifier: Apache-2.0
# Licensed to the Ed-Fi Alliance under one or more agreements.
# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
# See the LICENSE and NOTICES files in the project root for more information.
name: InitDev, Unit tests, Integration tests, Package
run-name: ${{github.event.client_payload.branch}}
on:
pull_request:
branches: [main, 'b-v*-patch*','feature-*']
types: [opened, synchronize, reopened, unlabeled]
push:
branches: [main, 'b-v*-patch*','feature-*']
workflow_dispatch:
inputs:
distinct_id:
description: 'distinct ID for Trgr InitDev workflows in Implementation repo workflow'
required: false
default: 'distinct_id'
permissions: read-all
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
INFORMATIONAL_VERSION: "7.4"
BUILD_INCREMENTER: "-4197"
CONFIGURATION: "Release"
HEAD_REF: ${{ GITHUB.HEAD_REF }}
REF_NAME: ${{ GITHUB.REF_NAME }}
REPOSITORY_DISPATCH_BRANCH: ${{ github.event.client_payload.branch }}
EDFI_SUITE_NUMBER: "Suite3"
msbuild_buildConfiguration: "release"
DB_PASS: ${{ secrets.BUILD_DB_PASS }}
AZURE_ARTIFACT_URL: "https://pkgs.dev.azure.com/ed-fi-alliance/Ed-Fi-Alliance-OSS/_packaging/EdFi/nuget/v3/index.json"
AZURE_ARTIFACT_NUGET_KEY: ${{ secrets.AZURE_ARTIFACTS_PERSONAL_ACCESS_TOKEN }}
VSS_NUGET_EXTERNAL_FEED_ENDPOINTS : '{"endpointCredentials": [{"endpoint": "https://pkgs.dev.azure.com/ed-fi-alliance/Ed-Fi-Alliance-OSS/_packaging/EdFi/nuget/v3/index.json","password": "${{ secrets.AZURE_ARTIFACTS_PERSONAL_ACCESS_TOKEN }}"}]}'
jobs:
FindStandardAndExtensionVersions:
uses: Ed-Fi-Alliance-OSS/Ed-Fi-ODS/.github/workflows/Find Standard and Extension Versions.yml@874b608a0f3a14243e0035dd1222169fafcbe8d3
with:
calling_branch: ${{ github.head_ref || github.ref_name }}
build:
needs: FindStandardAndExtensionVersions
services:
mssql:
image: mcr.microsoft.com/mssql/server:2019-latest
volumes:
- /MssqlBackupVolume:/DatabaseBackups
env:
ACCEPT_EULA: Y
SA_PASSWORD: ${{ env.DB_PASS }}
ports:
- 1433:1433
options: >-
--health-cmd "exit 0"
--health-interval 10s
--health-timeout 5s
--health-retries 3
--name mssql
--user root
runs-on: ubuntu-24.04
permissions:
checks: write
strategy:
fail-fast: false
matrix:
StandardVersion: ${{ fromJson(needs.FindStandardAndExtensionVersions.outputs.StandardVersions) }}
ExtensionVersion: ${{ fromJson(needs.FindStandardAndExtensionVersions.outputs.ExtensionVersions) }}
name: build (Standard Version ${{ matrix.StandardVersion }})
steps:
- name: echo distinct ID ${{ github.event.inputs.distinct_id }}
run: echo "${{ github.event.inputs.distinct_id }}"
- name: Set permissions for database server container backup directory
run: docker exec --user root mssql chmod 777 /DatabaseBackups
shell: pwsh
- name: Checkout Ed-Fi-ODS-Implementation
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
with:
repository: Ed-Fi-Alliance-OSS/Ed-Fi-ODS-Implementation
path: Ed-Fi-ODS-Implementation/
- name: Is pull request branch exists in Ed-Fi-ODS-Implementation
working-directory: ./Ed-Fi-ODS-Implementation/
shell: pwsh
run: |
.\build.githubactions.ps1 CheckoutBranch -RelativeRepoPath "."
- name: Checkout Ed-Fi-ODS
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
with:
repository: Ed-Fi-Alliance-OSS/Ed-Fi-ODS
path: Ed-Fi-ODS/
- name: Is pull request branch exists in Ed-Fi-ODS
working-directory: ./Ed-Fi-ODS-Implementation/
shell: pwsh
run: |
.\build.githubactions.ps1 CheckoutBranch -RelativeRepoPath "../Ed-Fi-ODS"
- name: update BUILD_INCREMENTER
run: |
$newRevision = ([int]${{ github.run_number }}) + ([int]${{env.BUILD_INCREMENTER}})
if ($newRevision -lt 0) {
$newRevision = 1
echo "BUILD_INCREMENTER=$newRevision">> $env:GITHUB_ENV
}
shell: pwsh
# This step shall be removed in ODS-6572
- name: Install Mono and Nuget
working-directory: ./Ed-Fi-ODS-Implementation/.github/workflows
run: sudo ./install-mono.sh
- name: Cache Nuget packages
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 #v4.0.1
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj*', '**/configuration.packages.json') }}
restore-keys: |
${{ runner.os }}-nuget-
${{ runner.os }}-
nuget-
enableCrossOsArchive: true
- name: Restore NuGet packages
working-directory: ./Ed-Fi-ODS-Implementation/
run: |
.\build.githubactions.ps1 restore -Solution "$env:GITHUB_WORKSPACE/Ed-Fi-ODS/Utilities/SdkGen/EdFi.SdkGen.sln"
.\build.githubactions.ps1 restore -Solution "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/Application/Ed-Fi-Ods.sln"
shell: pwsh
- name: Update build.props
working-directory: ./Ed-Fi-ODS/
run: |
$buildPropsPath = "$env:GITHUB_WORKSPACE/Ed-Fi-ODS/Application/Directory.Build.props"
[int]$BuildCounter = "${{ github.run_number }}"
[int]$BuildIncrementer = "${{ env.BUILD_INCREMENTER }}"
[int]$newRevision = $BuildCounter + $BuildIncrementer
[string]$version = "${{ env.INFORMATIONAL_VERSION}}"+ "." + $newRevision.ToString()
(Get-Content $buildPropsPath).Replace("<AssemblyVersion>1.0.0</AssemblyVersion>","<AssemblyVersion>$version</AssemblyVersion>") | Set-Content $buildPropsPath
shell: pwsh
- name: ODS/API InitDev, SdkGen,Run Integration Tests,Run Unit Tests, Package
working-directory: ./Ed-Fi-ODS-Implementation/
run: |
$ErrorActionPreference = 'Stop'
[int]$BuildCounter = "${{ github.run_number }}"
[int]$BuildIncrementer = "${{ env.BUILD_INCREMENTER }}"
[int]$newRevision = $BuildCounter + $BuildIncrementer
[string]$version = "${{ env.INFORMATIONAL_VERSION}}"+ "." + $newRevision.ToString()
.\build.github.ps1 -PackageVersion $version `
-RepositoryRoot $env:GITHUB_WORKSPACE `
-UsePlugins `
-RunSdkGen `
-GenerateApiSdkPackage `
-RunPostman `
-RunPester `
-RunDotnetTest `
-PackageOutput "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/NugetPackages" `
-NoRestore `
-StandardVersion "${{ matrix.StandardVersion }}" `
-ExtensionVersion "${{ matrix.ExtensionVersion }}" `
-MssqlSaPassword "$env:DB_PASS" `
-LocalDbBackupDirectory /MssqlBackupVolume `
-DbServerBackupDirectory /DatabaseBackups
shell: pwsh
- name: Upload Unit And Integration Test Reports
if: success() || failure()
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:
name: test-results-${{ matrix.StandardVersion }}
path: |
${{ github.workspace }}/Ed-Fi-ODS-Implementation/reports/*.trx
${{ github.workspace }}/Ed-Fi-ODS-Implementation/reports/*.html
- name: Unit Test Report
uses: dorny/test-reporter@eaa763f6ffc21c7a37837f56cd5f9737f27fc6c8 # v1.8
if: success() || failure()
with:
name: Unit Tests
path: ${{ github.workspace }}/Ed-Fi-ODS-Implementation/reports/*.trx
path-replace-backslashes: 'true'
working-directory: ${{ github.workspace }}/Ed-Fi-ODS-Implementation
reporter: dotnet-trx
- name: Postman Test Report
uses: dorny/test-reporter@eaa763f6ffc21c7a37837f56cd5f9737f27fc6c8 # v1.8
if: success() || failure()
with:
name: Integration Tests
path: ${{ github.workspace }}/Ed-Fi-ODS-Implementation/reports/*.xml
path-replace-backslashes: 'true'
working-directory: ${{ github.workspace }}/Ed-Fi-ODS-Implementation
reporter: java-junit
- name: Upload initdev logs
if: success() || failure()
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:
name: Initdev logs-${{ matrix.StandardVersion }}
path: |
${{ github.workspace }}/Ed-Fi-ODS-Implementation/Application/EdFi.Ods.Api.IntegrationTestHarness/bin/**/PostmanIntegrationTestsLog.log
${{ github.workspace }}/Ed-Fi-ODS-Implementation/Application/EdFi.Ods.Api.IntegrationTestHarness/bin/**/*TestHarnessLog.log
${{ github.workspace }}/Ed-Fi-ODS-Implementation/Application/EdFi.Ods.Api.IntegrationTestHarness/bin/**/*TestHarnessRequestResponseDetailsLog.log
- name: Create EdF.Ods.WebApi.Prerelease for Staging
working-directory: ./Ed-Fi-ODS-Implementation/
run: |
$ErrorActionPreference = 'Stop'
. $env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/Initialize-PowershellForDevelopment.ps1
[int]$BuildCounter = "${{ github.run_number }}"
[int]$BuildIncrementer = "${{ env.BUILD_INCREMENTER }}"
[int]$newRevision = $BuildCounter + $BuildIncrementer
$params = @{
ProjectPath = $env:GITHUB_WORKSPACE + '/Ed-Fi-ODS-Implementation/Application/EdFi.Ods.WebApi'
PackageDefinitionFile = $env:GITHUB_WORKSPACE + '/Ed-Fi-ODS-Implementation/Application/EdFi.Ods.WebApi/bin/**/**/publish/EdFi.Ods.WebApi.Prerelease.nuspec'
PackageId = 'EdFi.' + $env:EDFI_SUITE_NUMBER + '.Ods.WebApi.Prerelease.Standard.${{ matrix.StandardVersion }}'
Version = '${{ env.INFORMATIONAL_VERSION}}.' + $newRevision.ToString()
Properties = (Get-DefaultNuGetProperties)
OutputDirectory = $env:GITHUB_WORKSPACE + '/Ed-Fi-ODS-Implementation/NugetPackages'
}
New-WebPackage @params
shell: pwsh
- name: Upload SandboxAdmin,SwaggerUI,WebApi,Databases,EdFi.Ods.Api.Sdk,EdFi.SdkGen NugetPackages
if: success()
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:
name: NugetPackages.Artifacts-${{ matrix.StandardVersion }}
path: ${{ github.workspace }}/Ed-Fi-ODS-Implementation/NugetPackages/*.nupkg