Skip to content

OpenLineage Build and Release #41

OpenLineage Build and Release

OpenLineage Build and Release #41

Workflow file for this run

name: OpenLineage Build and Release
on:
workflow_dispatch:
inputs:
environmentToDeploy:
type: choice
description: Which environment to deploy packages to?
options:
- All
- Dev
- Test
- Prod-Training
- Production
default: All
push:
branches: [ main ]
paths:
- '**.cs'
- '**.csproj'
- 'tests/integration/**'
pull_request:
branches: [ main ]
paths:
- '**.cs'
- '**.csproj'
- 'tests/integration/**'
env:
DOTNET_VERSION: '8.x.x'
REPO: "function-app/adb-to-purview/src/"
TEST: "function-app/adb-to-purview/tests/unit-tests"
AZURE_FUNCTIONAPP_PACKAGE_PATH: '${{ github.workspace }}/function-app/adb-to-purview/src/'
AZURE_FUNCTIONAPP_TEST_PATH: '${{ github.workspace }}/function-app/adb-to-purview/tests/unit-tests'
BUILD_OUTPUT_PATH: '${{ github.workspace }}/build-artifacts'
PUBLISH_OUTPUT_PATH: '${{ github.workspace }}/publish-artifacts'
BUILD_PACKAGE_NAME: 'az-func.zip'
BUILD_CONFIGURATION: 'Release'
defaults:
run:
shell: bash
permissions:
id-token: write
contents: read
jobs:
############################################################################
build:
name: "Build"
runs-on: udf-govern-dv
steps:
- name: 'Checking out source code ...'
uses: actions/checkout@v4
- name: 'Setup .NET Environment'
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
env:
DOTNET_INSTALL_DIR: '$GITHUB_WORKSPACE/Microsoft/dotnet'
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: dotnet restore ${{ env.REPO }}
- name: Build
run: dotnet build ${{ env.REPO }} -c ${{ env.BUILD_CONFIGURATION }} --no-restore
- name: Test
run: dotnet test ${{ env.TEST }} -c ${{ env.BUILD_CONFIGURATION }} --logger trx --results-directory "TestResults-${{ env.DOTNET_VERSION }}"
- name: Upload dotnet test results
uses: actions/upload-artifact@v4
with:
name: dotnet-results-${{ env.DOTNET_VERSION }}
path: TestResults-${{ env.DOTNET_VERSION }}
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
- name: 'Publish'
shell: bash
run: |
publishfolder="${{ env.PUBLISH_OUTPUT_PATH }}"
mkdir $publishfolder
cd $publishfolder
dotnet publish ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} -c ${{ env.BUILD_CONFIGURATION }} --output .
mkdir ${{ env.BUILD_OUTPUT_PATH }}
zip -r ${{ env.BUILD_OUTPUT_PATH }}/${{ env.BUILD_PACKAGE_NAME }} .
- name: 'Upload Function Zip Build Artifact'
uses: actions/upload-artifact@v4
with:
name: build_artifacts
path: ${{ env.BUILD_OUTPUT_PATH }}
if-no-files-found: error
- name: Create One Line OlToPurviewMappings
run: |
mkdir ${{ github.workspace }}/artifact-mappings
python ${{ github.workspace }}/deployment/util/mappings-remove-spaces.py ${{ github.workspace }}/deployment/infra/OlToPurviewMappings.json > ${{ github.workspace }}/artifact-mappings/one-line-mappings.json
sed -i -e 's/mysynapse/${{ vars.SYNAPSE_WORKSPACE_NAME }}/g' ${{ github.workspace }}/artifact-mappings/one-line-mappings.json
ls ${{ github.workspace }}/artifact-mappings
- name: Upload One Line OlToPurviewMappings Build Artifact
uses: actions/upload-artifact@v4
with:
name: mappings
path: ${{ github.workspace }}/artifact-mappings/one-line-mappings.json
############################################################################
deployToDev:
if: github.event_name != 'pull_request' && success() && (github.event.inputs.environmentToDeploy == 'All' || github.event.inputs.environmentToDeploy == 'Dev')
name: "Deploy to Dev"
needs: [build]
runs-on: udf-govern-dv
environment:
name: dev
env:
SECRET_STORE_NAME: ${{ vars.SECRET_STORE }}
SECRET_ENV_CODE: dev
AZURE_RESOURCE_GROUP_NAME: ${{ vars.AZURE_RESOURCE_GROUP_NAME }}
AZURE_FUNCTIONAPP_NAME: ${{ vars.AZURE_FUNCTIONAPP_NAME }}
steps:
- name: 'Checking out source code ...'
uses: actions/checkout@v4
- name: 'Create Artifact Directory'
run: |
mkdir ${{ env.BUILD_OUTPUT_PATH }}
- name: 'Download Application Artifacts'
uses: actions/download-artifact@v4
with:
name: build_artifacts
path: ${{ env.BUILD_OUTPUT_PATH }}
- name: Login with Contributor
uses: ./.github/actions/login-with-contributor
with:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
SECRET_ENV_CODE: ${SECRET_ENV_CODE}
SECRET_STORE_NAME: ${SECRET_STORE_NAME}
- name: 'Fetch Azure Functions Publishing Profile'
id: fncapp
uses: azure/powershell@v1
with:
inlineScript: |
$profile = ""
$profile = Get-AzWebAppPublishingProfile -ResourceGroupName $env:AZURE_RESOURCE_GROUP_NAME -Name $env:AZURE_FUNCTIONAPP_NAME
$profile = $profile.Replace("`r", "").Replace("`n", "")
Write-Output "::set-output name=pubprofile::$profile"
Remove-Variable profile
azPSVersion: "latest"
- name: 'Deploy Application'
uses: azure/functions-action@v1.5.1
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: ${{ env.BUILD_OUTPUT_PATH }}/${{ env.BUILD_PACKAGE_NAME }}
publish-profile: ${{ steps.fncapp.outputs.pubprofile }}
# TODO : Store as secret ${{ secrets.PUBLISH_PROFILE }}
############################################################################
############################################################################
deployToTest:
name: "Deploy to Test"
needs: [deployToDev]
if: |
github.event_name != 'pull_request' &&
github.ref == 'refs/heads/features/add-synapse-support' &&
(success() || needs.deployToDev.result == 'skipped') &&
(github.event.inputs.environmentToDeploy == 'All' || github.event.inputs.environmentToDeploy == 'Test')
runs-on: udf-govern-int
environment:
name: int
env:
SECRET_STORE_NAME: ${{ vars.SECRET_STORE }}
SECRET_ENV_CODE: int
AZURE_RESOURCE_GROUP_NAME: ${{ vars.AZURE_RESOURCE_GROUP_NAME }}
AZURE_FUNCTIONAPP_NAME: ${{ vars.AZURE_FUNCTIONAPP_NAME }}
steps:
- name: 'Checking out source code ...'
uses: actions/checkout@v4
- name: 'Create Artifact Directory'
run: |
mkdir ${{ env.BUILD_OUTPUT_PATH }}
- name: 'Download Application Artifacts'
uses: actions/download-artifact@v4
with:
name: build_artifacts
path: ${{ env.BUILD_OUTPUT_PATH }}
- name: Login with Contributor
uses: ./.github/actions/login-with-contributor
with:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
SECRET_ENV_CODE: ${SECRET_ENV_CODE}
SECRET_STORE_NAME: ${SECRET_STORE_NAME}
- name: 'Fetch Azure Functions Publishing Profile'
id: fncapp
uses: azure/powershell@v1
with:
inlineScript: |
$profile = ""
$profile = Get-AzWebAppPublishingProfile -ResourceGroupName $env:AZURE_RESOURCE_GROUP_NAME -Name $env:AZURE_FUNCTIONAPP_NAME
$profile = $profile.Replace("`r", "").Replace("`n", "")
Write-Output "::set-output name=pubprofile::$profile"
Remove-Variable profile
azPSVersion: "latest"
- name: 'Deploy Application'
uses: azure/functions-action@v1.5.1
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: ${{ env.BUILD_OUTPUT_PATH }}/${{ env.BUILD_PACKAGE_NAME }}
publish-profile: ${{ steps.fncapp.outputs.pubprofile }}
############################################################################
deployToPt:
name: "Deploy to PT"
needs: [deployToTest]
if: |
github.event_name != 'pull_request' &&
github.ref == 'refs/heads/features/add-synapse-support' &&
(success() || needs.deployToTest.result == 'skipped') &&
(github.event.inputs.environmentToDeploy == 'All' || github.event.inputs.environmentToDeploy == 'Prod-Training')
# if: |
# github.event_name != 'pull_request' &&
# github.ref == 'refs/heads/features/add-synapse-support' &&
# (github.event.inputs.environmentToDeploy == 'All' && success()) &&
# (github.event.inputs.environmentToDeploy == 'Prod-Training' && needs.deployToTest.result == 'skipped')
runs-on: udf-govern-pt
environment:
name: "pt"
env:
SECRET_STORE_NAME: ${{ vars.SECRET_STORE }}
SECRET_ENV_CODE: productiontraining
AZURE_RESOURCE_GROUP_NAME: ${{ vars.AZURE_RESOURCE_GROUP_NAME }}
AZURE_FUNCTIONAPP_NAME: ${{ vars.AZURE_FUNCTIONAPP_NAME }}
steps:
- name: 'Checking out source code ...'
uses: actions/checkout@v4
- name: 'Create Artifact Directory'
run: |
mkdir ${{ env.BUILD_OUTPUT_PATH }}
- name: 'Download Application Artifacts'
uses: actions/download-artifact@v4
with:
name: build_artifacts
path: ${{ env.BUILD_OUTPUT_PATH }}
- name: Login with Contributor
uses: ./.github/actions/login-with-contributor
with:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
SECRET_ENV_CODE: ${SECRET_ENV_CODE}
SECRET_STORE_NAME: ${SECRET_STORE_NAME}
- name: 'Fetch Azure Functions Publishing Profile'
id: fncapp
uses: azure/powershell@v1
with:
inlineScript: |
$profile = ""
$profile = Get-AzWebAppPublishingProfile -ResourceGroupName $env:AZURE_RESOURCE_GROUP_NAME -Name $env:AZURE_FUNCTIONAPP_NAME
$profile = $profile.Replace("`r", "").Replace("`n", "")
Write-Output "::set-output name=pubprofile::$profile"
Remove-Variable profile
azPSVersion: "latest"
- name: 'Deploy Application'
uses: azure/functions-action@v1.5.1
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: ${{ env.BUILD_OUTPUT_PATH }}/${{ env.BUILD_PACKAGE_NAME }}
publish-profile: ${{ steps.fncapp.outputs.pubprofile }}