-
Notifications
You must be signed in to change notification settings - Fork 57
198 lines (168 loc) · 6.66 KB
/
build-release.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: Build and Release
on:
create:
pull_request:
branches: [ main, release/* ]
paths:
- '**.cs'
- '**.csproj'
- 'tests/integration/**'
workflow_dispatch:
inputs:
tags:
description: 'Flag as workflow dispatch'
required: true
type: boolean
env:
DOTNET_VERSION: '6.x.x' # The .NET SDK version to use
REPO: "function-app/adb-to-purview/src/"
TEST: "function-app/adb-to-purview/tests/unit-tests"
jobs:
meta:
name: Meta Information
runs-on: ubuntu-latest
steps:
- name: Metadata about this action
run: |
echo "Github Event Name: ${{ github.event_name }}"
echo "Github Ref: ${{ github.ref }}"
echo "Github Ref Type: ${{ github.ref_type }}"
echo "Github Tags: ${{ inputs.tags }}"
build:
if: |
github.event_name == 'pull_request' ||
(github.event_name == 'create' && github.ref_type == 'tag') ||
${{github.event_name == 'create' && inputs.tags}}
name: build-${{matrix.os}}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install dependencies
run: dotnet restore ${{ env.REPO }}
- name: Build
run: dotnet build ${{ env.REPO }} --configuration Release --no-restore
- name: Test
run: dotnet test ${{ env.TEST }}
- name: Publish
run: dotnet publish ${{ env.REPO }}
- name: Confirm Mappings Match
run: python tests/deployment/test_arm_mapping_matches_json.py
- name: Display structure of downloaded files
run: |
mkdir ~/artifact
Compress-Archive -Path D:/a/Purview-ADB-Lineage-Solution-Accelerator/Purview-ADB-Lineage-Solution-Accelerator/function-app/adb-to-purview/src/bin/Debug/net6.0/publish/* -DestinationPath ~/artifact/FunctionZip.zip
- name: Upload Function Zip Build Artifact
uses: actions/upload-artifact@v3
with:
name: FunctionZip
path: ~/artifact/FunctionZip.zip
- name: Create One Line OlToPurviewMappings
run: |
mkdir ~/artifact-mappings
python ./deployment/util/mappings-remove-spaces.py ./deployment/infra/OlToPurviewMappings.json > ~/artifact-mappings/one-line-mappings.json
ls ~/artifact-mappings
- name: Upload One Line OlToPurviewMappings Build Artifact
uses: actions/upload-artifact@v3
with:
name: Mappings
path: ~/artifact-mappings/one-line-mappings.json
runIntegrationTests:
name: Test on Integration Tests
needs: [build]
runs-on: ubuntu-latest
environment:
name: Integration
steps:
- uses: actions/checkout@v3
# Deploy the Function to integration environment
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: FunctionZip
path: ./artifacts
- name: Deploy Azure Function to Integration Env
uses: Azure/functions-action@v1.4.6
with:
app-name: ${{ secrets.INT_FUNC_NAME }}
package: ./artifacts/FunctionZip.zip
publish-profile: ${{ secrets.INT_PUBLISH_PROFILE }}
- name: Azure Login
uses: azure/#@v1
with:
creds: ${{ secrets.INT_AZ_CLI_CREDENTIALS }}
- name: Compare and Update App Settings on Deployed Function
uses: azure/CLI@v1
with:
azcliversion: 2.34.1
inlineScript: |
chmod +x $GITHUB_WORKSPACE/tests/deployment/compare-app-settings.py
python3 $GITHUB_WORKSPACE/tests/deployment/compare-app-settings.py ${{ secrets.INT_FUNC_NAME }} ${{ secrets.INT_RG_NAME }}
# TODO: Deploy / Update Spark jobs
# Start up Synapse Pool and Execute Tests
- name: Start Integration Synapse SQL Pool
run: source tests/integration/manage-sql-pool.sh start ${{ secrets.INT_SUBSCRIPTION_ID }} ${{ secrets.INT_SYNAPSE_SQLPOOL_RG_NAME }} ${{ secrets.INT_SYNAPSE_WKSP_NAME }} ${{ secrets.INT_SYNAPSE_SQLPOOL_NAME }}
env:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
- name: Install Python Requirements and Databricks CLI
run: pip install pyapacheatlas==0.12.0 azure-identity databricks-cli
- name: Configure Databricks CLI
run: |
echo "[DEFAULT]
host = https://${{ secrets.INT_DATABRICKS_WKSP_ID }}.azuredatabricks.net
token = ${{ secrets.INT_DATABRICKS_ACCESS_TOKEN }}" > ./config.ini
export DATABRICKS_CONFIG_FILE=./config.ini
- name: Confirm Databricks CLI is configured
run: databricks clusters spark-versions
env:
DATABRICKS_CONFIG_FILE: ./config.ini
- name: Cleanup Integration Environment
run: python ./tests/integration/runner.py --cleanup --dontwait None None None
env:
PURVIEW_INTEGRATION_TARGET: ${{ secrets.INT_PURVIEW_NAME }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
DATABRICKS_CONFIG_FILE: ./config.ini
- name: Run Integration Tests
run: source ./tests/integration/run-test.sh ALL ${{ secrets.INT_DATABRICKS_WKSP_ID }}
env:
PURVIEW_INTEGRATION_TARGET: ${{ secrets.INT_PURVIEW_NAME }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
DATABRICKS_CONFIG_FILE: ./config.ini
- name: Stop Integration Synapse SQL Pool
run: source tests/integration/manage-sql-pool.sh stop ${{ secrets.INT_SUBSCRIPTION_ID }} ${{ secrets.INT_SYNAPSE_SQLPOOL_RG_NAME }} ${{ secrets.INT_SYNAPSE_WKSP_NAME }} ${{ secrets.INT_SYNAPSE_SQLPOOL_NAME }}
env:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
createRelease:
name: Create Release
if: ${{ github.event_name == 'create' && github.ref_type == 'tag' }}
needs: [runIntegrationTests]
runs-on: ubuntu-latest
environment:
name: ReleaseEnvironment
steps:
- uses: actions/checkout@v3
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: FunctionZip
path: ~/artifacts
- name: Create Release
uses: ncipollo/release-action@v1
if: github.ref_type == 'tag'
with:
artifacts: ~/artifacts/FunctionZip.zip
token: ${{ secrets.GITHUB_TOKEN }}