-
Notifications
You must be signed in to change notification settings - Fork 4
149 lines (130 loc) · 7.09 KB
/
build-minimal-template-sqlServer.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
name: build TPDM Minimal Template sqlServer
on:
workflow_dispatch:
inputs:
ODS_version:
type: string
required: false
description: "ODS_version: Ed-Fi ODS/API version. Default: 6.1"
tpdm_version:
type: string
required: false
description: "tpdm_version: TPDM version as noted in the Community Extension built nuget package artifact. Default: 1.1.0"
Ed-Fi-ODS-ref:
type: string
required: false
description: "Ed-Fi-ODS-ref: checks out the specified branch/tag of the Ed-Fi-ODS repo. Default branch if not specified."
Ed-Fi-ODS-Implementation-ref:
type: string
required: false
description: "Ed-Fi-ODS-Implementation-ref: checks out the specified branch/tag of the Ed-Fi-ODS-Implementation repo. Default branch if not specified."
env:
tpdm_version: "1.1.0"
version_suite: "3"
ODS_version: "6.1"
ods_ref: ""
ods_ref_implementation: ""
jobs:
build:
runs-on: windows-latest
steps:
- name: Set env variables
shell: pwsh
run: |
$version_patch = ${{ format('{0}{1}', github.run_number , github.run_attempt) }}
if ("${{ github.event.inputs.tpdm_version }}" -ne "") {
echo "tpdm_version=${{ github.event.inputs.tpdm_version }}" >> $env:GITHUB_ENV
}
if ("${{ github.event.inputs.Ed-Fi-ODS-ref }}" -ne "") {
echo "ods_ref=${{ github.event.inputs.Ed-Fi-ODS-ref }}" >> $env:GITHUB_ENV
}
if ("${{ github.event.inputs.Ed-Fi-ODS-Implementation-ref }}" -ne "") {
echo "ods_ref_implementation=${{ github.event.inputs.Ed-Fi-ODS-Implementation-ref }}" >> $env:GITHUB_ENV
}
if ("${{ github.event.inputs.ODS_version }}" -ne "") {
echo "ODS_version=${{ github.event.inputs.ODS_version }}" >> $env:GITHUB_ENV
}
echo ("version_core=${{ env.ODS_version }}." + "$version_patch") >> $env:GITHUB_ENV
echo "temp=${{ github.workspace }}\temp" >> $env:GITHUB_ENV
- name: Git long filename support
run: |
git config --system core.longpaths true
- name: Ed-Fi-ODS
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
with:
repository: Ed-Fi-Alliance-OSS/Ed-Fi-ODS
ref: ${{ env.ods_ref }}
path: Ed-Fi-ODS
- name: Ed-Fi-ODS-Implementation
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
with:
repository: Ed-Fi-Alliance-OSS/Ed-Fi-ODS-Implementation
ref: ${{ env.ods_ref_implementation }}
path: Ed-Fi-ODS-Implementation
- name: Ed-Fi-Extension
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
with:
path: Ed-Fi-TPDM-Extension
- name: Workaround for duplicate package references in EdFi.Ods.Sandbox.csproj
run: |
$f = Get-Content .\EdFi.Ods.Sandbox.csproj -Raw
$first_part = $f | Select-String -Pattern '(?s)^.*?(?=\<PackageReference)' | Foreach {$_.matches.value} | Out-String
$unique_packages = $f | Select-String -allmatches -Pattern '(?m)^.*?<PackageReference.*$' | Foreach {$_.Matches.value} | Select-Object -Unique | Out-String
$last_part = $f | Select-String -Pattern '(?s)\<\/ItemGroup.*' | Foreach {$_.matches.value} | Out-String
$first_part + $unique_packages + $last_part > .\EdFi.Ods.Sandbox.csproj
working-directory: Ed-Fi-ODS\Application\EdFi.Ods.Sandbox
- name: Workaround for file copy
run: |
(get-content ./Ed-Fi-ODS-Implementation/DatabaseTemplate/Modules/create-database-template.psm1 -Raw).replace('-Destination "$directory\$xmlFile"', '-Destination "$directory\$($xmlFile.Name)"').replace('-Destination "$directory\$xsdFile"', '-Destination "$directory\$($xsdFile.Name)"') | set-content ./Ed-Fi-ODS-Implementation/DatabaseTemplate/Modules/create-database-template.psm1
- name: Replace package name and version in packages config
run: |
(Get-Content configuration.packages.json -Raw) `
-replace '(?ism)(?<="tpdm")(.*?)\d(.*?)Core\.(\d+.\d+\.\d+)(.*?)\d+.\d+\.\d+' `
, '${1}3$2Community.${{ env.tpdm_version }}${4}${{ env.tpdm_package_version }}' `
| Out-File configuration.packages.json
working-directory: ./Ed-Fi-ODS-Implementation
- name: Replace package name in create script
run: |
(Get-Content ./Ed-Fi-ODS-Implementation/DatabaseTemplate/Modules/create-tpdm-minimal-template.psm1) `
-replace 'Core', 'Community' ` |
Out-File ./Ed-Fi-ODS-Implementation/DatabaseTemplate/Modules/create-tpdm-minimal-template.psm1
- name: Install SQL Server
run: choco install sql-server-2019 --no-progress --params="'/IgnorePendingReboot'"
- name: Remove Ed-Fi Databases
run: |
$ErrorActionPreference = 'Stop'
Import-Module ./Ed-Fi-ODS-Implementation/logistics/scripts/modules/build-management.psm1
Remove-EdFiDatabases -Force
- name: Initialize-DevelopmentEnvironment
run: |
$ErrorActionPreference = 'Stop'
./Initialize-PowershellForDevelopment.ps1
Initialize-DevelopmentEnvironment -UsePlugins -NoDeploy
working-directory: ./Ed-Fi-ODS-Implementation
- name: Create Database Template
run: |
Import-Module -Force -Scope Global ${{ github.workspace }}\Ed-Fi-ODS-Implementation\DatabaseTemplate\Modules\create-tpdm-minimal-template.psm1
Initialize-TPDMMinimalTemplate -samplePath "D:\a\Ed-Fi-TPDM-Community-Artifacts\Ed-Fi-TPDM-Community-Artifacts\Ed-Fi-TPDM-Extension\"
working-directory: ./Ed-Fi-TPDM-Extension
- name: Pack
run: |
nuget pack ${{ github.workspace }}/Ed-Fi-ODS-Implementation/DatabaseTemplate/Database/EdFi.Ods.Minimal.Template.TPDM.Community.nuspec `
-OutputDirectory ${{ github.workspace }}/NugetPackages `
-Version ${{ env.version_core }} `
-Properties configuration=release `
-Properties authors="Ed-Fi Alliance" `
-Properties owners="Ed-Fi Alliance" `
-Properties copyright="Copyright ©Ed-Fi Alliance, LLC. 2020" `
-Properties id="EdFi.Suite${{ env.version_suite }}.Ods.Minimal.Template.TPDM.Community.${{ env.tpdm_version }}" `
-Properties title="EdFi.Suite${{ env.version_suite }}.Ods.Minimal.Template.TPDM.Community.${{ env.tpdm_version }}" `
-Properties description="EdFi Ods Minimal Template TPDM Community Database" `
-NoPackageAnalysis -NoDefaultExcludes
working-directory: ${{ github.workspace }}/Ed-Fi-TPDM-Extension
- name: Create temp folder for upload artifact action
run: |
mkdir temp
- name: Upload artifact
uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571
with:
name: EdFi.Suite${{ env.version_suite }}.Ods.Minimal.Template.TPDM.Community.${{ env.tpdm_version }}.${{ env.version_core }}.nupkg
path: NugetPackages\*.nupkg