Skip to content

CF.Cumulus-Sql-Server-core-CICD #3

CF.Cumulus-Sql-Server-core-CICD

CF.Cumulus-Sql-Server-core-CICD #3

# Job to build and publish the dacpac
name: CF.Cumulus-Sql-Server-core-CICD
on: [workflow_call, workflow_dispatch]
jobs:
build_core:
runs-on: windows-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2.4.2
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
- name: Build Database project
run: |
msbuild.exe src/metadata.core/metadata.core.sqlproj /p:Configuration=Release
- uses: actions/upload-artifact@v4
with:
name: coreartifact
path: ${{ github.workspace }}/src/metadata.core/bin/Release/
# Deploy dacpac job
deploy_dev:
# Set the dependency for the build job
needs: build_core
runs-on: windows-latest
environment: dev
steps:
- name: download artifact containing dacpac
uses: actions/download-artifact@v4
with:
name: coreartifact # Match the uploaded artifact name
path: ${{ github.workspace }}/src/metadata.core/bin/Release/
- name: Verify Artifact File
run: ls -R ${{ github.workspace }}/src/metadata.core/bin/Release/
- name: Azure SQL Deploy Common
uses: Azure/sql-action@v2.3
with:
connection-string: "${{ secrets.AZURE_SQL_CONNECTION_STRING }}"
path: ${{ github.workspace }}/src/metadata.core/bin/Release/metadata.common.dacpac
action: 'publish'
arguments: '/v:DatabricksWSName="${{ secrets.DBWNAME }}" /v:DatabricksHost="${{ secrets.DATABRICKS_HOST }}" /v:DLSName="${{ secrets.DLSNAME }}" /v:Environment="Dev" /v:KeyVaultName="${{ secrets.KEYVAULTNAME }}" /v:RGName="${{ secrets.RGNAME }}" /v:SubscriptionID="${{ secrets.AZURE_SUBSCRIPTION_ID }}" '
- name: Azure SQL Deploy Control
uses: Azure/sql-action@v2.3
with:
connection-string: "${{ secrets.AZURE_SQL_CONNECTION_STRING }}"
path: ${{ github.workspace }}/src/metadata.core/bin/Release/metadata.control.dacpac
action: 'publish'
arguments: '/v:Environment="Dev" /v:RGName="${{ secrets.RGNAME }}" /v:SubscriptionID="${{ secrets.AZURE_SUBSCRIPTION_ID }}" /v:ADFName="${{ secrets.ADFNAME }}" /v:TenantID="${{ secrets.AZURE_TENANT_ID }}" '
- name: Azure SQL Deploy Ingest
uses: Azure/sql-action@v2.3
with:
connection-string: "${{ secrets.AZURE_SQL_CONNECTION_STRING }}"
path: ${{ github.workspace }}/src/metadata.core/bin/Release/metadata.Ingest.dacpac
action: 'publish'
- name: Azure SQL Deploy Transform
uses: Azure/sql-action@v2.3
with:
connection-string: "${{ secrets.AZURE_SQL_CONNECTION_STRING }}"
path: ${{ github.workspace }}/src/metadata.core/bin/Release/metadata.Transform.dacpac
action: 'publish'
# Deploy dacpac job
deploy_test:
# Set the dependency for the build job
needs: deploy_dev
runs-on: windows-latest
environment: test
steps:
- name: download artifact containing dacpac
uses: actions/download-artifact@v4
with:
name: coreartifact # Match the uploaded artifact name
path: ${{ github.workspace }}/src/metadata.core/bin/Release/
- name: Verify Artifact File
run: ls -R ${{ github.workspace }}/src/metadata.core/bin/Release/
- name: Azure SQL Deploy Common
uses: Azure/sql-action@v2.3
with:
connection-string: "${{ secrets.AZURE_SQL_CONNECTION_STRING }}"
path: ${{ github.workspace }}/src/metadata.core/bin/Release/metadata.common.dacpac
action: 'publish'
arguments: '/v:DatabricksWSName="${{ secrets.DBWNAME }}" /v:DatabricksHost="${{ secrets.DATABRICKS_HOST }}" /v:DLSName="${{ secrets.DLSNAME }}" /v:Environment="Test" /v:KeyVaultName="${{ secrets.KEYVAULTNAME }}" /v:RGName="${{ secrets.RGNAME }}" /v:SubscriptionID="${{ secrets.AZURE_SUBSCRIPTION_ID }}" '
- name: Azure SQL Deploy Control
uses: Azure/sql-action@v2.3
with:
connection-string: "${{ secrets.AZURE_SQL_CONNECTION_STRING }}"
path: ${{ github.workspace }}/src/metadata.core/bin/Release/metadata.control.dacpac
action: 'publish'
arguments: '/v:Environment="Test" /v:RGName="${{ secrets.RGNAME }}" /v:SubscriptionID="${{ secrets.AZURE_SUBSCRIPTION_ID }}" /v:ADFName="${{ secrets.ADFNAME }}" /v:TenantID="${{ secrets.AZURE_TENANT_ID }}" '
- name: Azure SQL Deploy Ingest
uses: Azure/sql-action@v2.3
with:
connection-string: "${{ secrets.AZURE_SQL_CONNECTION_STRING }}"
path: ${{ github.workspace }}/src/metadata.core/bin/Release/metadata.ingest.dacpac
action: 'publish'
- name: Azure SQL Deploy Transform
uses: Azure/sql-action@v2.3
with:
connection-string: "${{ secrets.AZURE_SQL_CONNECTION_STRING }}"
path: ${{ github.workspace }}/src/metadata.core/bin/Release/metadata.transform.dacpac
action: 'publish'
# Deploy dacpac job
deploy_prod:
# Set the dependency for the build job
needs: deploy_test
runs-on: windows-latest
environment: prod
steps:
- name: download artifact containing dacpac
uses: actions/download-artifact@v4
with:
name: coreartifact # Match the uploaded artifact name
path: ${{ github.workspace }}/src/metadata.core/bin/Release/
- name: Verify Artifact File
run: ls -R ${{ github.workspace }}/src/metadata.core/bin/Release/
- name: Azure SQL Deploy Common
uses: Azure/sql-action@v2.3
with:
connection-string: "${{ secrets.AZURE_SQL_CONNECTION_STRING }}"
path: ${{ github.workspace }}/src/metadata.core/bin/Release/metadata.common.dacpac
action: 'publish'
arguments: '/v:DatabricksWSName="${{ secrets.DBWNAME }}" /v:DatabricksHost="${{ secrets.DATABRICKS_HOST }}" /v:DLSName="${{ secrets.DLSNAME }}" /v:Environment="Prod" /v:KeyVaultName="${{ secrets.KEYVAULTNAME }}" /v:RGName="${{ secrets.RGNAME }}" /v:SubscriptionID="${{ secrets.AZURE_SUBSCRIPTION_ID }}" '
- name: Azure SQL Deploy Control
uses: Azure/sql-action@v2.3
with:
connection-string: "${{ secrets.AZURE_SQL_CONNECTION_STRING }}"
path: ${{ github.workspace }}/src/metadata.core/bin/Release/metadata.control.dacpac
action: 'publish'
arguments: '/v:Environment="Prod" /v:RGName="${{ secrets.RGNAME }}" /v:SubscriptionID="${{ secrets.AZURE_SUBSCRIPTION_ID }}" /v:ADFName="${{ secrets.ADFNAME }}" /v:TenantID="${{ secrets.AZURE_TENANT_ID }}" '
- name: Azure SQL Deploy Ingest
uses: Azure/sql-action@v2.3
with:
connection-string: "${{ secrets.AZURE_SQL_CONNECTION_STRING }}"
path: ${{ github.workspace }}/src/metadata.core/bin/Release/metadata.ingest.dacpac
action: 'publish'
- name: Azure SQL Deploy Transform
uses: Azure/sql-action@v2.3
with:
connection-string: "${{ secrets.AZURE_SQL_CONNECTION_STRING }}"
path: ${{ github.workspace }}/src/metadata.core/bin/Release/metadata.transform.dacpac
action: 'publish'