diff --git a/.github/workflows/Pkg EdFi.Ods.Minimal.Template.TPDM.yml b/.github/workflows/Pkg EdFi.Ods.Minimal.Template.TPDM.yml index bdc00c944c..a8c23e16e6 100644 --- a/.github/workflows/Pkg EdFi.Ods.Minimal.Template.TPDM.yml +++ b/.github/workflows/Pkg EdFi.Ods.Minimal.Template.TPDM.yml @@ -28,6 +28,7 @@ env: HEAD_REF: ${{ GITHUB.HEAD_REF }} REF_NAME: ${{ GITHUB.REF_NAME }} REPOSITORY_OWNER: ${{ GITHUB.REPOSITORY_OWNER }} + DB_PASS: temporaryDbP@ssw0rd! jobs: @@ -39,7 +40,24 @@ jobs: build: if: ${{ always() }} needs: FindStandardAndExtensionVersions - runs-on: windows-latest + 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-latest strategy: matrix: StandardVersion: ${{ fromJson(needs.FindStandardAndExtensionVersions.outputs.StandardVersions) }} @@ -54,8 +72,9 @@ jobs: run: | echo "::error::Missing Azure Token" exit 1 - - name: Support longpaths - run: git config --system core.longpaths true + - 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 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 with: @@ -72,7 +91,7 @@ jobs: $standardTag = .\build.githubactions.ps1 StandardTag -standardVersion ${{ matrix.StandardVersion }} -ProjectFile "./Application/EdFi.Ods.Standard/EdFi.Ods.Standard.csproj" echo "EDFI_STANDARD_REFERENCE=$standardTag">> $env:GITHUB_ENV Write-host "Ed-Fi-Standard Tag is $standardTag" - shell: powershell + shell: pwsh - name: Checkout Ed-Fi-Data-Standard uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 with: @@ -85,7 +104,7 @@ jobs: $tpdmTag = .\build.githubactions.ps1 TpdmTag -standardVersion ${{ matrix.StandardVersion }} -ProjectFile "./Application/EdFi.Ods.Standard/EdFi.Ods.Standard.csproj" echo "EDFI_TPDM_REFERENCE=$tpdmTag">> $env:GITHUB_ENV Write-host "EdFi-Tpdm Tag is $tpdmTag" - shell: powershell + shell: pwsh - name: Checkout Ed-Fi-TPDM-Artifacts uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 with: @@ -94,7 +113,7 @@ jobs: ref: ${{ env.EDFI_TPDM_REFERENCE }} - name: Is pull request branch exists in Ed-Fi-ODS-Implementation working-directory: ./Ed-Fi-ODS/ - shell: powershell + shell: pwsh run: | .\build.githubactions.ps1 CheckoutBranch -RelativeRepoPath "../Ed-Fi-ODS-Implementation" - name: update BUILD_INCREMENTER @@ -105,11 +124,6 @@ jobs: echo "BUILD_INCREMENTER=$newRevision">> $env:GITHUB_ENV } shell: pwsh - - name: Install sql-server-2019 & sqlpackage - shell: powershell - run: | - choco install sql-server-2019 -y --params "'/IGNOREPENDINGREBOOT /IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /INSTANCEID=MSSQLSERVER /INSTANCENAME=MSSQLSERVER /TCPENABLED=1 /UPDATEENABLED=FALSE /FEATURES=SQL,Tools'" --execution-timeout=$installTimeout - choco install sqlpackage - name: Cache Nuget packages uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 #v4.0.1 with: @@ -121,7 +135,7 @@ jobs: working-directory: ./Ed-Fi-ODS/ run: | .\build.githubactions.ps1 restore -Solution "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/Application/Ed-Fi-Ods.sln" - shell: powershell + shell: pwsh - name: Initialize-DevelopmentEnvironment working-directory: ./Ed-Fi-ODS-Implementation/ run: | @@ -129,60 +143,37 @@ jobs: [Environment]::SetEnvironmentVariable('msbuild_buildConfiguration', '${{ env.CONFIGURATION }}') $PSVersionTable . $env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/Initialize-PowershellForDevelopment.ps1 - Initialize-DevelopmentEnvironment -UsePlugins -NoDeploy -NoRestore -ExtensionVersion ${{ matrix.ExtensionVersion }} -StandardVersion ${{ matrix.StandardVersion }} - shell: powershell + Initialize-DevelopmentEnvironment -UsePlugins -NoDeploy -NoRestore -ExtensionVersion ${{ matrix.ExtensionVersion }} -StandardVersion ${{ matrix.StandardVersion }} -MssqlSaPassword ${{ env.DB_PASS }} + shell: pwsh - name: Create Database Template (no extensions) working-directory: ./ run: | $ErrorActionPreference = 'Stop' [Environment]::SetEnvironmentVariable('msbuild_buildConfiguration', '${{ env.CONFIGURATION }}') Import-Module -Force -Scope Global "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/DatabaseTemplate/Modules/create-tpdm-minimal-template.psm1" - Initialize-TPDMMinimalTemplate -ExtensionVersion ${{ matrix.ExtensionVersion }} -StandardVersion ${{ matrix.StandardVersion }} - shell: powershell + Initialize-TPDMMinimalTemplate -ExtensionVersion ${{ matrix.ExtensionVersion }} -StandardVersion ${{ matrix.StandardVersion }} -LocalDbBackupDirectory /MssqlBackupVolume -DbServerBackupDirectory /DatabaseBackups + shell: pwsh + - name: Set permissions for database backup file + working-directory: ./ + run: sudo chmod -R 777 Ed-Fi-ODS-Implementation/DatabaseTemplate/Database/ + shell: pwsh - name: pack working-directory: ./Ed-Fi-ODS/ run: | .\build.githubactions.ps1 pack -Configuration ${{ env.CONFIGURATION }} -InformationalVersion ${{ env.INFORMATIONAL_VERSION }} -BuildCounter ${{ github.run_number }} -BuildIncrementer ${{env.BUILD_INCREMENTER}} -NuspecFilePath "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/DatabaseTemplate/Database/EdFi.Ods.Minimal.Template.TPDM.Core.${{ matrix.ExtensionVersion }}.Standard.${{ matrix.StandardVersion }}.nuspec" -PackageName "EdFi.Suite3.Ods.Minimal.Template.TPDM.Core.${{ matrix.ExtensionVersion }}.Standard.${{ matrix.StandardVersion }}" - shell: powershell + shell: pwsh - name: Install-credential-handler if: ${{ env.AZURE_ARTIFACT_NUGET_KEY != '' && github.event_name == 'workflow_dispatch' }} working-directory: ./Ed-Fi-ODS-Implementation/ run: | - Import-Module -Force -Scope Global "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/logistics/scripts/modules/utility/cross-platform.psm1" - if (Get-IsWindows -and -not Get-InstalledModule | Where-Object -Property Name -eq "7Zip4Powershell") { - Install-Module -Force -Scope CurrentUser -Name 7Zip4Powershell - } - - # using WebClient is faster then Invoke-WebRequest but shows no progress - $sourceUrl = ' https://github.com/microsoft/artifacts-credprovider/releases/download/v1.0.0/Microsoft.NuGet.CredentialProvider.zip' - $fileName = 'Microsoft.NuGet.CredentialProvider.zip' - Write-host "Downloading file from $sourceUrl..." - $webClient = New-Object System.Net.WebClient - $webClient.DownloadFile($sourceUrl, "$env:temp/$fileName") - - Write-host "Download complete." - - if (-not (Test-Path "$env:temp/$fileName")) { - Write-Warning "Microsoft.NuGet.CredentialProvider file '$fileName' not found." - exit 0 - } - - $packageFolder = "$env:temp/Microsoft.NuGet.CredentialProvider/" - - if ($fileName.EndsWith('.zip')) { - Write-host "Extracting $fileName..." - $zipFilePath = "$env:temp/$fileName" - if (Test-Path $zipFilePath) { Expand-Archive -Force -Path $zipFilePath -DestinationPath $packageFolder } - Copy-Item -Path $packageFolder\* -Destination "$env:UserProfile/.nuget/" -Recurse -Force - Write-Host "Extracted to: $env:UserProfile\.nuget\plugins\" -ForegroundColor Green - } - shell: powershell + .\build.githubactions.ps1 InstallCredentialHandler + shell: pwsh - name: publish working-directory: ./Ed-Fi-ODS/ if: ${{ env.AZURE_ARTIFACT_NUGET_KEY != '' && github.event_name == 'workflow_dispatch' }} run: | .\build.githubactions.ps1 publish -InformationalVersion ${{ env.INFORMATIONAL_VERSION }} -BuildCounter ${{ github.run_number }} -BuildIncrementer ${{env.BUILD_INCREMENTER}} -NuGetApiKey ${{ env.AZURE_ARTIFACT_NUGET_KEY }} -EdFiNuGetFeed ${{env.AZURE_ARTIFACT_URL}} -PackageName "EdFi.Suite3.Ods.Minimal.Template.TPDM.Core.${{ matrix.ExtensionVersion }}.Standard.${{ matrix.StandardVersion }}" - shell: powershell + shell: pwsh - name: Upload EdFi.Ods.Minimal.Template.TPDM.Core Artifacts if: success() || failure() uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 diff --git a/.github/workflows/Pkg EdFi.Ods.Minimal.Template.yml b/.github/workflows/Pkg EdFi.Ods.Minimal.Template.yml index e8c4c37e6c..253fd09685 100644 --- a/.github/workflows/Pkg EdFi.Ods.Minimal.Template.yml +++ b/.github/workflows/Pkg EdFi.Ods.Minimal.Template.yml @@ -28,6 +28,7 @@ env: HEAD_REF: ${{ GITHUB.HEAD_REF }} REF_NAME: ${{ GITHUB.REF_NAME }} REPOSITORY_OWNER: ${{ GITHUB.REPOSITORY_OWNER }} + DB_PASS: temporaryDbP@ssw0rd! jobs: @@ -37,9 +38,26 @@ jobs: calling_branch: ${{ github.head_ref || github.ref_name }} build: + runs-on: ubuntu-latest if: ${{ always() }} needs: FindStandardAndExtensionVersions - runs-on: windows-latest + 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 strategy: matrix: StandardVersion: ${{ fromJson(needs.FindStandardAndExtensionVersions.outputs.StandardVersions) }} @@ -53,8 +71,9 @@ jobs: run: | echo "::error::Missing Azure Token" exit 1 - - name: Support longpaths - run: git config --system core.longpaths true + - 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 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 with: @@ -71,7 +90,7 @@ jobs: $standardTag = .\build.githubactions.ps1 StandardTag -standardVersion ${{ matrix.StandardVersion }} -ProjectFile "./Application/EdFi.Ods.Standard/EdFi.Ods.Standard.csproj" echo "EDFI_STANDARD_REFERENCE=$standardTag">> $env:GITHUB_ENV Write-host "Ed-Fi-Standard Tag is $standardTag" - shell: powershell + shell: pwsh - name: Checkout Ed-Fi-Data-Standard uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 with: @@ -80,7 +99,7 @@ jobs: ref: ${{ env.EDFI_STANDARD_REFERENCE }} - name: Is pull request branch exists in Ed-Fi-ODS-Implementation working-directory: ./Ed-Fi-ODS/ - shell: powershell + shell: pwsh run: | .\build.githubactions.ps1 CheckoutBranch -RelativeRepoPath "../Ed-Fi-ODS-Implementation" - name: update BUILD_INCREMENTER @@ -91,11 +110,6 @@ jobs: echo "BUILD_INCREMENTER=$newRevision">> $env:GITHUB_ENV } shell: pwsh - - name: Install sql-server-2019 & sqlpackage - shell: powershell - run: | - choco install sql-server-2019 -y --params "'/IGNOREPENDINGREBOOT /IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /INSTANCEID=MSSQLSERVER /INSTANCENAME=MSSQLSERVER /TCPENABLED=1 /UPDATEENABLED=FALSE /FEATURES=SQL,Tools'" --execution-timeout=$installTimeout - choco install sqlpackage - name: Cache Nuget packages uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 #v4.0.1 with: @@ -107,7 +121,7 @@ jobs: working-directory: ./Ed-Fi-ODS/ run: | .\build.githubactions.ps1 restore -Solution "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/Application/Ed-Fi-Ods.sln" - shell: powershell + shell: pwsh - name: Initialize-DevelopmentEnvironment working-directory: ./Ed-Fi-ODS-Implementation/ run: | @@ -115,66 +129,43 @@ jobs: [Environment]::SetEnvironmentVariable('msbuild_buildConfiguration', '${{ env.CONFIGURATION }}') $PSVersionTable . $env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/Initialize-PowershellForDevelopment.ps1 - Initialize-DevelopmentEnvironment -NoDeploy -NoRestore -StandardVersion ${{ matrix.StandardVersion }} -ExtensionVersion ${{ matrix.ExtensionVersion }} - shell: powershell + Initialize-DevelopmentEnvironment -NoDeploy -NoRestore -StandardVersion ${{ matrix.StandardVersion }} -ExtensionVersion ${{ matrix.ExtensionVersion }} -MssqlSaPassword ${{ env.DB_PASS }} + shell: pwsh - name: Remove Plug-Ins working-directory: ./Ed-Fi-ODS-Implementation/ run: | $ErrorActionPreference = 'Stop' - rm -R "./Plugin/Extensions.*" - shell: powershell + rm -r Plugin/Extensions.* + shell: pwsh - name: Create Database Template (no extensions) working-directory: ./ run: | $ErrorActionPreference = 'Stop' [Environment]::SetEnvironmentVariable('msbuild_buildConfiguration', '${{ env.CONFIGURATION }}') Import-Module -Force -Scope Global "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/DatabaseTemplate/Modules/create-minimal-template.psm1" - Initialize-MinimalTemplate -samplePath './Ed-Fi-Data-Standard/Descriptors' -noExtensions -StandardVersion ${{ matrix.StandardVersion }} -ExtensionVersion ${{ matrix.ExtensionVersion }} - shell: powershell + Initialize-MinimalTemplate -samplePath './Ed-Fi-Data-Standard/Descriptors' -noExtensions -StandardVersion ${{ matrix.StandardVersion }} -ExtensionVersion ${{ matrix.ExtensionVersion }} -LocalDbBackupDirectory /MssqlBackupVolume -DbServerBackupDirectory /DatabaseBackups + shell: pwsh + - name: Set permissions for database backup file + working-directory: ./ + run: sudo chmod -R 777 Ed-Fi-ODS-Implementation/DatabaseTemplate/Database/ + shell: pwsh - name: pack working-directory: ./Ed-Fi-ODS/ run: | .\build.githubactions.ps1 pack -Configuration ${{ env.CONFIGURATION }} -InformationalVersion ${{ env.INFORMATIONAL_VERSION }} -BuildCounter ${{ github.run_number }} -BuildIncrementer ${{env.BUILD_INCREMENTER}} -NuspecFilePath "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/DatabaseTemplate/Database/EdFi.Ods.Minimal.Template.Standard.${{ matrix.StandardVersion }}.nuspec" -PackageName "EdFi.Suite3.Ods.Minimal.Template.Standard.${{ matrix.StandardVersion }}" - shell: powershell + shell: pwsh - name: Install-credential-handler if: ${{ env.AZURE_ARTIFACT_NUGET_KEY != '' && github.event_name == 'workflow_dispatch' }} working-directory: ./Ed-Fi-ODS-Implementation/ run: | - Import-Module -Force -Scope Global "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/logistics/scripts/modules/utility/cross-platform.psm1" - if (Get-IsWindows -and -not Get-InstalledModule | Where-Object -Property Name -eq "7Zip4Powershell") { - Install-Module -Force -Scope CurrentUser -Name 7Zip4Powershell - } - - # using WebClient is faster then Invoke-WebRequest but shows no progress - $sourceUrl = ' https://github.com/microsoft/artifacts-credprovider/releases/download/v1.0.0/Microsoft.NuGet.CredentialProvider.zip' - $fileName = 'Microsoft.NuGet.CredentialProvider.zip' - Write-host "Downloading file from $sourceUrl..." - $webClient = New-Object System.Net.WebClient - $webClient.DownloadFile($sourceUrl, "$env:temp/$fileName") - - Write-host "Download complete." - - if (-not (Test-Path "$env:temp/$fileName")) { - Write-Warning "Microsoft.NuGet.CredentialProvider file '$fileName' not found." - exit 0 - } - - $packageFolder = "$env:temp/Microsoft.NuGet.CredentialProvider/" - - if ($fileName.EndsWith('.zip')) { - Write-host "Extracting $fileName..." - $zipFilePath = "$env:temp/$fileName" - if (Test-Path $zipFilePath) { Expand-Archive -Force -Path $zipFilePath -DestinationPath $packageFolder } - Copy-Item -Path $packageFolder\* -Destination "$env:UserProfile/.nuget/" -Recurse -Force - Write-Host "Extracted to: $env:UserProfile\.nuget\plugins\" -ForegroundColor Green - } - shell: powershell + .\build.githubactions.ps1 InstallCredentialHandler + shell: pwsh - name: publish working-directory: ./Ed-Fi-ODS/ if: ${{ env.AZURE_ARTIFACT_NUGET_KEY != '' && github.event_name == 'workflow_dispatch' }} run: | .\build.githubactions.ps1 publish -InformationalVersion ${{ env.INFORMATIONAL_VERSION }} -BuildCounter ${{ github.run_number }} -BuildIncrementer ${{env.BUILD_INCREMENTER}} -NuGetApiKey ${{ env.AZURE_ARTIFACT_NUGET_KEY }} -EdFiNuGetFeed ${{env.AZURE_ARTIFACT_URL}} -PackageName "EdFi.Suite3.Ods.Minimal.Template.Standard.${{ matrix.StandardVersion }}" - shell: powershell + shell: pwsh - name: Upload EdFi.Ods.Minimal.Template Artifacts if: success() || failure() uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 diff --git a/.github/workflows/Pkg EdFi.Ods.Populated.Template.TPDM.yml b/.github/workflows/Pkg EdFi.Ods.Populated.Template.TPDM.yml index b73cbdf8c3..269cd94291 100644 --- a/.github/workflows/Pkg EdFi.Ods.Populated.Template.TPDM.yml +++ b/.github/workflows/Pkg EdFi.Ods.Populated.Template.TPDM.yml @@ -28,6 +28,7 @@ env: HEAD_REF: ${{ GITHUB.HEAD_REF }} REF_NAME: ${{ GITHUB.REF_NAME }} REPOSITORY_OWNER: ${{ GITHUB.REPOSITORY_OWNER }} + DB_PASS: temporaryDbP@ssw0rd! jobs: @@ -39,7 +40,24 @@ jobs: build: if: ${{ always() }} needs: FindStandardAndExtensionVersions - runs-on: windows-latest + 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-latest strategy: matrix: StandardVersion: ${{ fromJson(needs.FindStandardAndExtensionVersions.outputs.StandardVersions) }} @@ -54,8 +72,9 @@ jobs: run: | echo "::error::Missing Azure Token" exit 1 - - name: Support longpaths - run: git config --system core.longpaths true + - 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 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 with: @@ -72,7 +91,7 @@ jobs: $standardTag = .\build.githubactions.ps1 StandardTag -standardVersion ${{ matrix.StandardVersion }} -ProjectFile "./Application/EdFi.Ods.Standard/EdFi.Ods.Standard.csproj" echo "EDFI_STANDARD_REFERENCE=$standardTag">> $env:GITHUB_ENV Write-host "Ed-Fi-Standard Tag is $standardTag" - shell: powershell + shell: pwsh - name: Checkout Ed-Fi-Data-Standard uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 with: @@ -85,7 +104,7 @@ jobs: $tpdmTag = .\build.githubactions.ps1 TpdmTag -standardVersion ${{ matrix.StandardVersion }} -ProjectFile "./Application/EdFi.Ods.Standard/EdFi.Ods.Standard.csproj" echo "EDFI_TPDM_REFERENCE=$tpdmTag">> $env:GITHUB_ENV Write-host "EdFi-Tpdm Tag is $tpdmTag" - shell: powershell + shell: pwsh - name: Checkout Ed-Fi-TPDM-Artifacts uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 with: @@ -94,7 +113,7 @@ jobs: ref: ${{ env.EDFI_TPDM_REFERENCE }} - name: Is pull request branch exists in Ed-Fi-ODS-Implementation working-directory: ./Ed-Fi-ODS/ - shell: powershell + shell: pwsh run: | .\build.githubactions.ps1 CheckoutBranch -RelativeRepoPath "../Ed-Fi-ODS-Implementation" - name: update BUILD_INCREMENTER @@ -105,11 +124,6 @@ jobs: echo "BUILD_INCREMENTER=$newRevision">> $env:GITHUB_ENV } shell: pwsh - - name: Install sql-server-2019 & sqlpackage - shell: powershell - run: | - choco install sql-server-2019 -y --params "'/IGNOREPENDINGREBOOT /IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /INSTANCEID=MSSQLSERVER /INSTANCENAME=MSSQLSERVER /TCPENABLED=1 /UPDATEENABLED=FALSE /FEATURES=SQL,Tools'" --execution-timeout=$installTimeout - choco install sqlpackage - name: Cache Nuget packages uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 #v4.0.1 with: @@ -121,7 +135,7 @@ jobs: working-directory: ./Ed-Fi-ODS/ run: | .\build.githubactions.ps1 restore -Solution "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/Application/Ed-Fi-Ods.sln" - shell: powershell + shell: pwsh - name: Initialize-DevelopmentEnvironment working-directory: ./Ed-Fi-ODS-Implementation/ run: | @@ -129,60 +143,37 @@ jobs: [Environment]::SetEnvironmentVariable('msbuild_buildConfiguration', '${{ env.CONFIGURATION }}') $PSVersionTable . $env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/Initialize-PowershellForDevelopment.ps1 - Initialize-DevelopmentEnvironment -UsePlugins -NoDeploy -NoRestore -ExtensionVersion ${{ matrix.ExtensionVersion }} -StandardVersion ${{ matrix.StandardVersion }} - shell: powershell + Initialize-DevelopmentEnvironment -UsePlugins -NoDeploy -NoRestore -ExtensionVersion ${{ matrix.ExtensionVersion }} -StandardVersion ${{ matrix.StandardVersion }} -MssqlSaPassword ${{ env.DB_PASS }} + shell: pwsh - name: Create Database Template (no extensions) working-directory: ./ run: | $ErrorActionPreference = 'Stop' [Environment]::SetEnvironmentVariable('msbuild_buildConfiguration', '${{ env.CONFIGURATION }}') - Import-Module -Force -Scope Global "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/DatabaseTemplate/Modules/create-tpdm-template.psm1" - Initialize-TPDMTemplate -extensionVersion ${{ matrix.ExtensionVersion }} -standardVersion ${{ matrix.StandardVersion }} - shell: powershell + Import-Module -Force -Scope Global "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/DatabaseTemplate/Modules/create-tpdm-template.psm1" + Initialize-TPDMTemplate -extensionVersion ${{ matrix.ExtensionVersion }} -StandardVersion ${{ matrix.StandardVersion }} -LocalDbBackupDirectory /MssqlBackupVolume -DbServerBackupDirectory /DatabaseBackups + shell: pwsh + - name: Set permissions for database backup file + working-directory: ./ + run: sudo chmod -R 777 Ed-Fi-ODS-Implementation/DatabaseTemplate/Database/ + shell: pwsh - name: pack working-directory: ./Ed-Fi-ODS/ run: | .\build.githubactions.ps1 pack -Configuration ${{ env.CONFIGURATION }} -InformationalVersion ${{ env.INFORMATIONAL_VERSION }} -BuildCounter ${{ github.run_number }} -BuildIncrementer ${{env.BUILD_INCREMENTER}} -NuspecFilePath "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/DatabaseTemplate/Database/EdFi.Ods.Populated.Template.TPDM.Core.${{ matrix.ExtensionVersion }}.Standard.${{ matrix.StandardVersion }}.nuspec" -PackageName "EdFi.Suite3.Ods.Populated.Template.TPDM.Core.${{ matrix.ExtensionVersion }}.Standard.${{ matrix.StandardVersion }}" - shell: powershell + shell: pwsh - name: Install-credential-handler if: ${{ env.AZURE_ARTIFACT_NUGET_KEY != '' && github.event_name == 'workflow_dispatch' }} working-directory: ./Ed-Fi-ODS-Implementation/ run: | - Import-Module -Force -Scope Global "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/logistics/scripts/modules/utility/cross-platform.psm1" - if (Get-IsWindows -and -not Get-InstalledModule | Where-Object -Property Name -eq "7Zip4Powershell") { - Install-Module -Force -Scope CurrentUser -Name 7Zip4Powershell - } - - # using WebClient is faster then Invoke-WebRequest but shows no progress - $sourceUrl = ' https://github.com/microsoft/artifacts-credprovider/releases/download/v1.0.0/Microsoft.NuGet.CredentialProvider.zip' - $fileName = 'Microsoft.NuGet.CredentialProvider.zip' - Write-host "Downloading file from $sourceUrl..." - $webClient = New-Object System.Net.WebClient - $webClient.DownloadFile($sourceUrl, "$env:temp/$fileName") - - Write-host "Download complete." - - if (-not (Test-Path "$env:temp/$fileName")) { - Write-Warning "Microsoft.NuGet.CredentialProvider file '$fileName' not found." - exit 0 - } - - $packageFolder = "$env:temp/Microsoft.NuGet.CredentialProvider/" - - if ($fileName.EndsWith('.zip')) { - Write-host "Extracting $fileName..." - $zipFilePath = "$env:temp/$fileName" - if (Test-Path $zipFilePath) { Expand-Archive -Force -Path $zipFilePath -DestinationPath $packageFolder } - Copy-Item -Path $packageFolder\* -Destination "$env:UserProfile/.nuget/" -Recurse -Force - Write-Host "Extracted to: $env:UserProfile\.nuget\plugins\" -ForegroundColor Green - } - shell: powershell + .\build.githubactions.ps1 InstallCredentialHandler + shell: pwsh - name: publish if: ${{ env.AZURE_ARTIFACT_NUGET_KEY != '' && github.event_name == 'workflow_dispatch' }} working-directory: ./Ed-Fi-ODS/ run: | .\build.githubactions.ps1 publish -InformationalVersion ${{ env.INFORMATIONAL_VERSION }} -BuildCounter ${{ github.run_number }} -BuildIncrementer ${{env.BUILD_INCREMENTER}} -NuGetApiKey ${{ env.AZURE_ARTIFACT_NUGET_KEY }} -EdFiNuGetFeed ${{env.AZURE_ARTIFACT_URL}} -PackageName "EdFi.Suite3.Ods.Populated.Template.TPDM.Core.${{ matrix.ExtensionVersion }}.Standard.${{ matrix.StandardVersion }}" - shell: powershell + shell: pwsh - name: Upload EdFi.Ods.Populated.Template.TPDM.Core Artifacts if: success() || failure() uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 @@ -211,4 +202,4 @@ jobs: with: name: Create Database Template Logs-${{ matrix.StandardVersion }} path: | - ${{ github.workspace }}/CreateDatabaseTemplateLogs/*.* \ No newline at end of file + ${{ github.workspace }}/CreateDatabaseTemplateLogs/*.* diff --git a/.github/workflows/Pkg EdFi.Ods.Populated.Template.yml b/.github/workflows/Pkg EdFi.Ods.Populated.Template.yml index c72cd12599..5ab65e03a1 100644 --- a/.github/workflows/Pkg EdFi.Ods.Populated.Template.yml +++ b/.github/workflows/Pkg EdFi.Ods.Populated.Template.yml @@ -28,6 +28,7 @@ env: HEAD_REF: ${{ GITHUB.HEAD_REF }} REF_NAME: ${{ GITHUB.REF_NAME }} REPOSITORY_OWNER: ${{ GITHUB.REPOSITORY_OWNER }} + DB_PASS: temporaryDbP@ssw0rd! jobs: @@ -39,7 +40,24 @@ jobs: build: if: ${{ always() }} needs: FindStandardAndExtensionVersions - runs-on: windows-latest + runs-on: ubuntu-latest + 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 strategy: matrix: StandardVersion: ${{ fromJson(needs.FindStandardAndExtensionVersions.outputs.StandardVersions) }} @@ -53,8 +71,9 @@ jobs: run: | echo "::error::Missing Azure Token" exit 1 - - name: Support longpaths - run: git config --system core.longpaths true + - 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 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 with: @@ -71,7 +90,7 @@ jobs: $standardTag = .\build.githubactions.ps1 StandardTag -standardVersion ${{ matrix.StandardVersion }} -ProjectFile "./Application/EdFi.Ods.Standard/EdFi.Ods.Standard.csproj" echo "EDFI_STANDARD_REFERENCE=$standardTag">> $env:GITHUB_ENV Write-host "Ed-Fi-Standard Tag is $standardTag" - shell: powershell + shell: pwsh - name: Checkout Ed-Fi-Data-Standard uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 with: @@ -80,14 +99,9 @@ jobs: ref: ${{ env.EDFI_STANDARD_REFERENCE }} - name: Is pull request branch exists in Ed-Fi-ODS-Implementation working-directory: ./Ed-Fi-ODS/ - shell: powershell + shell: pwsh run: | .\build.githubactions.ps1 CheckoutBranch -RelativeRepoPath "../Ed-Fi-ODS-Implementation" - - name: Install sql-server-2019 & sqlpackage - shell: powershell - run: | - choco install sql-server-2019 -y --params "'/IGNOREPENDINGREBOOT /IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /INSTANCEID=MSSQLSERVER /INSTANCENAME=MSSQLSERVER /TCPENABLED=1 /UPDATEENABLED=FALSE /FEATURES=SQL,Tools'" --execution-timeout=$installTimeout - choco install sqlpackage - name: Cache Nuget packages uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 #v4.0.1 with: @@ -107,7 +121,7 @@ jobs: working-directory: ./Ed-Fi-ODS/ run: | .\build.githubactions.ps1 restore -Solution "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/Application/Ed-Fi-Ods.sln" - shell: powershell + shell: pwsh - name: Initialize-DevelopmentEnvironment working-directory: ./Ed-Fi-ODS-Implementation/ run: | @@ -115,66 +129,43 @@ jobs: [Environment]::SetEnvironmentVariable('msbuild_buildConfiguration', '${{ env.CONFIGURATION }}') $PSVersionTable . $env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/Initialize-PowershellForDevelopment.ps1 - Initialize-DevelopmentEnvironment -NoDeploy -NoRestore -StandardVersion ${{ matrix.StandardVersion }} -ExtensionVersion ${{ matrix.ExtensionVersion }} - shell: powershell + Initialize-DevelopmentEnvironment -NoDeploy -NoRestore -StandardVersion ${{ matrix.StandardVersion }} -ExtensionVersion ${{ matrix.ExtensionVersion }} -MssqlSaPassword ${{ env.DB_PASS }} + shell: pwsh - name: Remove Plug-Ins working-directory: ./Ed-Fi-ODS-Implementation/ run: | $ErrorActionPreference = 'Stop' - rm -R "./Plugin/Extensions.*" - shell: powershell + rm -r Plugin/Extensions.* + shell: pwsh - name: Create Database Template (no extensions) working-directory: ./ run: | $ErrorActionPreference = 'Stop' [Environment]::SetEnvironmentVariable('msbuild_buildConfiguration', '${{ env.CONFIGURATION }}') Import-Module -Force -Scope Global "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/DatabaseTemplate/Modules/create-populated-template.psm1" - Initialize-PopulatedTemplate -samplePath './Ed-Fi-Data-Standard/' -noExtensions -StandardVersion ${{ matrix.StandardVersion }} -ExtensionVersion ${{ matrix.ExtensionVersion }} - shell: powershell + Initialize-PopulatedTemplate -samplePath './Ed-Fi-Data-Standard/' -noExtensions -StandardVersion ${{ matrix.StandardVersion }} -ExtensionVersion ${{ matrix.ExtensionVersion }} -LocalDbBackupDirectory /MssqlBackupVolume -DbServerBackupDirectory /DatabaseBackups + shell: pwsh + - name: Set permissions for database backup file + working-directory: ./ + run: sudo chmod -R 777 Ed-Fi-ODS-Implementation/DatabaseTemplate/Database/ + shell: pwsh - name: pack working-directory: ./Ed-Fi-ODS/ run: | .\build.githubactions.ps1 pack -Configuration ${{ env.CONFIGURATION }} -InformationalVersion ${{ env.INFORMATIONAL_VERSION }} -BuildCounter ${{ github.run_number }} -BuildIncrementer ${{env.BUILD_INCREMENTER}} -NuspecFilePath "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/DatabaseTemplate/Database/EdFi.Ods.Populated.Template.Standard.${{ matrix.StandardVersion }}.nuspec" -PackageName "EdFi.Suite3.Ods.Populated.Template.Standard.${{ matrix.StandardVersion }}" - shell: powershell + shell: pwsh - name: Install-credential-handler if: ${{ env.AZURE_ARTIFACT_NUGET_KEY != '' && github.event_name == 'workflow_dispatch' }} working-directory: ./Ed-Fi-ODS-Implementation/ run: | - Import-Module -Force -Scope Global "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/logistics/scripts/modules/utility/cross-platform.psm1" - if (Get-IsWindows -and -not Get-InstalledModule | Where-Object -Property Name -eq "7Zip4Powershell") { - Install-Module -Force -Scope CurrentUser -Name 7Zip4Powershell - } - - # using WebClient is faster then Invoke-WebRequest but shows no progress - $sourceUrl = ' https://github.com/microsoft/artifacts-credprovider/releases/download/v1.0.0/Microsoft.NuGet.CredentialProvider.zip' - $fileName = 'Microsoft.NuGet.CredentialProvider.zip' - Write-host "Downloading file from $sourceUrl..." - $webClient = New-Object System.Net.WebClient - $webClient.DownloadFile($sourceUrl, "$env:temp/$fileName") - - Write-host "Download complete." - - if (-not (Test-Path "$env:temp/$fileName")) { - Write-Warning "Microsoft.NuGet.CredentialProvider file '$fileName' not found." - exit 0 - } - - $packageFolder = "$env:temp/Microsoft.NuGet.CredentialProvider/" - - if ($fileName.EndsWith('.zip')) { - Write-host "Extracting $fileName..." - $zipFilePath = "$env:temp/$fileName" - if (Test-Path $zipFilePath) { Expand-Archive -Force -Path $zipFilePath -DestinationPath $packageFolder } - Copy-Item -Path $packageFolder\* -Destination "$env:UserProfile/.nuget/" -Recurse -Force - Write-Host "Extracted to: $env:UserProfile\.nuget\plugins\" -ForegroundColor Green - } - shell: powershell + .\build.githubactions.ps1 InstallCredentialHandler + shell: pwsh - name: publish if: ${{ env.AZURE_ARTIFACT_NUGET_KEY != '' && github.event_name == 'workflow_dispatch' }} working-directory: ./Ed-Fi-ODS/ run: | .\build.githubactions.ps1 publish -InformationalVersion ${{ env.INFORMATIONAL_VERSION }} -BuildCounter ${{ github.run_number }} -BuildIncrementer ${{env.BUILD_INCREMENTER}} -NuGetApiKey ${{ env.AZURE_ARTIFACT_NUGET_KEY }} -EdFiNuGetFeed ${{env.AZURE_ARTIFACT_URL}} -PackageName "EdFi.Suite3.Ods.Populated.Template.Standard.${{ matrix.StandardVersion }}" - shell: powershell + shell: pwsh - name: Upload EdFi.Ods.Populated.Template Artifacts if: success() || failure() uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0