Pkg EdFi.Ods.Minimal.Template.PostgreSQL #1257
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: Pkg EdFi.Ods.Minimal.Template.PostgreSQL | |
on: | |
push: | |
branches: [main, 'b-v*-patch*','feature-*'] | |
workflow_dispatch: | |
inputs: | |
distinct_id: | |
description: 'distinct ID for Rebuild Database Templates workflow' | |
required: false | |
default: 'distinct_id' | |
permissions: read-all | |
env: | |
INFORMATIONAL_VERSION: "7.3" | |
BUILD_INCREMENTER: "-985" | |
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 }}"}]}' | |
CONFIGURATION: "Release" | |
REPOSITORY_DISPATCH_BRANCH: ${{ github.event.client_payload.branch }} | |
HEAD_REF: ${{ GITHUB.HEAD_REF }} | |
REF_NAME: ${{ GITHUB.REF_NAME }} | |
REPOSITORY_OWNER: ${{ GITHUB.REPOSITORY_OWNER }} | |
jobs: | |
FindStandardAndExtensionVersions: | |
uses: ./.github/workflows/Find Standard and Extension Versions.yml | |
with: | |
calling_branch: ${{ github.head_ref || github.ref_name }} | |
build: | |
if: ${{ always() }} | |
needs: FindStandardAndExtensionVersions | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
StandardVersion: ${{ fromJson(needs.FindStandardAndExtensionVersions.outputs.StandardVersions) }} | |
ExtensionVersion: ${{ fromJson(needs.FindStandardAndExtensionVersions.outputs.ExtensionVersions) }} | |
name: build (Standard Version ${{ matrix.StandardVersion }}) | |
services: | |
postgres: | |
image: postgres:16.4-alpine3.20@sha256:ad47523c5154f587f0be492539c76c6c3394e8a7b02f2d86f7b8b32297a862a6 | |
env: | |
POSTGRES_HOST_AUTH_METHOD: trust | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: echo distinct ID ${{ github.event.inputs.distinct_id }} | |
run: echo "${{ github.event.inputs.distinct_id }}" | |
- name: Check for Azure token | |
if: ${{ env.REPOSITORY_OWNER == 'Ed-Fi-Alliance-OSS' && env.AZURE_ARTIFACT_NUGET_KEY == '' }} | |
run: | | |
echo "::error::Missing Azure Token" | |
exit 1 | |
- name: Checkout Ed-Fi-ODS | |
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 | |
with: | |
repository: Ed-Fi-Alliance-OSS/Ed-Fi-ODS | |
path: Ed-Fi-ODS/ | |
- 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: Set Ed-Fi-Standard Reference | |
working-directory: ./Ed-Fi-ODS/ | |
run: | | |
$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: pwsh | |
- name: Checkout Ed-Fi-Data-Standard | |
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 | |
with: | |
repository: Ed-Fi-Alliance-OSS/Ed-Fi-Data-Standard | |
path: Ed-Fi-Data-Standard/ | |
ref: ${{ env.EDFI_STANDARD_REFERENCE }} | |
- name: Is pull request branch exists in Ed-Fi-ODS-Implementation | |
working-directory: ./Ed-Fi-ODS/ | |
shell: pwsh | |
run: | | |
.\build.githubactions.ps1 CheckoutBranch -RelativeRepoPath "../Ed-Fi-ODS-Implementation" | |
- name: Install postgresql-client-16 package | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install curl ca-certificates | |
sudo install -d /usr/share/postgresql-common/pgdg | |
sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | |
sudo sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' | |
sudo apt-get update | |
sudo apt-get -y install postgresql-client-16 | |
- 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- | |
- name: Restore NuGet packages | |
working-directory: ./Ed-Fi-ODS/ | |
run: | | |
.\build.githubactions.ps1 restore -Solution "$env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/Application/Ed-Fi-Ods.sln" | |
shell: pwsh | |
- 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 | |
- name: Initialize-DevelopmentEnvironment | |
working-directory: ./Ed-Fi-ODS-Implementation/ | |
run: | | |
$ErrorActionPreference = 'Stop' | |
[Environment]::SetEnvironmentVariable('msbuild_buildConfiguration', '${{ env.CONFIGURATION }}') | |
$PSVersionTable | |
. $env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/Initialize-PowershellForDevelopment.ps1 | |
Initialize-DevelopmentEnvironment -NoDeploy -Engine PostgreSQL -NoRestore -StandardVersion ${{ matrix.StandardVersion }} -ExtensionVersion ${{ matrix.ExtensionVersion }} | |
shell: pwsh | |
- name: Remove Plug-Ins | |
working-directory: ./Ed-Fi-ODS-Implementation/ | |
run: | | |
$ErrorActionPreference = 'Stop' | |
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 -Engine PostgreSQL -StandardVersion ${{ matrix.StandardVersion }} -ExtensionVersion ${{ matrix.ExtensionVersion }} | |
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.PostgreSQL.Standard.${{ matrix.StandardVersion }}.nuspec" -PackageName "EdFi.Suite3.Ods.Minimal.Template.PostgreSQL.Standard.${{ matrix.StandardVersion }}" | |
shell: pwsh | |
- name: Install-credential-handler | |
if: ${{ env.AZURE_ARTIFACT_NUGET_KEY != '' && github.event_name == 'workflow_dispatch' }} | |
working-directory: ./Ed-Fi-ODS/ | |
run: | | |
.\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.PostgreSQL.Standard.${{ matrix.StandardVersion }}" | |
shell: pwsh | |
- name: Upload EdFi.Ods.Minimal.Template Artifacts | |
if: success() || failure() | |
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 | |
with: | |
name: NugetPackages.Artifacts-${{ matrix.StandardVersion }} | |
path: ${{ github.workspace }}/Ed-Fi-ODS/NugetPackages/EdFi.Suite3.Ods.Minimal.Template.PostgreSQL*.nupkg | |
- name: Move Log Files | |
if: success() || failure() | |
run: | | |
$bulkLoadClientSourcePath = "${{ github.workspace }}/Ed-Fi-ODS/Utilities/DataLoading/EdFi.BulkLoadClient.Console/bin/${{ env.CONFIGURATION }}/net8.0/logfile.txt" | |
$testHarnessSourcePath = "${{ github.workspace }}/Ed-Fi-ODS-Implementation/Application/EdFi.Ods.Api.IntegrationTestHarness/bin/${{ env.CONFIGURATION }}/net8.0/TestHarnessLog.log" | |
$testHarnessRequestResponseDetailsSourcePath = "${{ github.workspace }}/Ed-Fi-ODS-Implementation/Application/EdFi.Ods.Api.IntegrationTestHarness/bin/${{ env.CONFIGURATION }}/net8.0/TestHarnessRequestResponseDetailsLog.log" | |
$destinationPath = "${{ github.workspace }}/CreateDatabaseTemplateLogs/" | |
# Create the destination folder if it doesn't exist | |
if (!(Test-Path -Path $destinationPath)) { | |
New-Item -ItemType Directory -Path $destinationPath -Force | |
} | |
# Move the files | |
Move-Item -Path $bulkLoadClientSourcePath -Destination $destinationPath -Force | |
Move-Item -Path $testHarnessSourcePath -Destination $destinationPath -Force | |
Move-Item -Path $testHarnessRequestResponseDetailsSourcePath -Destination $destinationPath -Force | |
shell: pwsh | |
- name: Upload Create Database Template Logs | |
if: success() || failure() | |
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 | |
with: | |
name: Create Database Template Logs-${{ matrix.StandardVersion }} | |
path: | | |
${{ github.workspace }}/CreateDatabaseTemplateLogs/*.* |