-
Notifications
You must be signed in to change notification settings - Fork 3
96 lines (85 loc) · 3.66 KB
/
build-deploy-csharp-testfunction.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
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Build and release Csharp test function
on:
push:
branches: [ "master" ]
paths:
- /src/Azure/Csharp/**
workflow_dispatch:
jobs:
buildTestWindows:
name: Build Test Function
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Publish
run: dotnet publish --runtime "win-x64" ./src/Azure/Csharp/CloudRepublic.BenchMark.SampleFunction/CloudRepublic.BenchMark.SampleFunction.csproj --output ./outputs/test --configuration "RELEASE"
- name: Debugging info
run: ls ./outputs/test
- name: Zip outputs
shell: pwsh
working-directory: ${{ github.workspace }}/outputs/test
run: Compress-Archive .\* ${{ github.workspace }}/windows.zip
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3.1.1
with:
name: windows
path: ./windows.zip
buildTestLinux:
name: Build Test Function
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Install zip
uses: montudor/action-zip@v1
- name: Restore dependencies
run: dotnet restore
- name: Publish
run: dotnet publish --runtime "linux-x64" ./src/Azure/Csharp/CloudRepublic.BenchMark.SampleFunction/CloudRepublic.BenchMark.SampleFunction.csproj --output ./outputs/test --configuration "RELEASE"
- name: Debugging info
run: ls ./outputs/test
- name: Zip outputs
working-directory: ${{ github.workspace }}/outputs/test
run: zip -qq -r ${{ github.workspace }}/linux.zip .
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3.1.1
with:
name: linux
path: ./linux.zip
deploy:
name: Deploy application
runs-on: ubuntu-latest
needs: [buildTestWindows, buildTestLinux]
steps:
# Checkout code
- uses: actions/checkout@v3
# Log into Azure
- name: login to azure cli
run: az login --service-principal -u ${{ secrets.AZURE_APPID }} -p ${{ secrets.AZURE_APPSECRET }} --tenant ${{ secrets.AZURE_TENANT }}
- name: deploy bicep
run: az stack group create --subscription "${{ secrets.AZURE_SUBSCRIPTION }}" --resource-group "${{ secrets.AZURE_RG }}" --template-file ./src/Azure/Csharp/CloudRepublic.BenchMark.SampleFunction/deployment.bicep --parameters prefix=${{ secrets.DEPLOYMENT_PREFIX }} --name csharp --deny-settings-mode None --delete-resources true --deny-settings-excluded-principals ${{ secrets.AZURE_OBJECTID }}
- name: Download Test Artifact Windows
uses: actions/download-artifact@v3.0.1
with:
name: windows
path: ./outputs/test/windows
- name: Download Test Artifact Linux
uses: actions/download-artifact@v3.0.1
with:
name: linux
path: ./outputs/test/linux
- name: Deploy linux test
run: az functionapp deployment source config-zip --subscription "${{ secrets.AZURE_SUBSCRIPTION }}" --resource-group "${{ secrets.AZURE_RG }}" --src "./outputs/test/linux/linux.zip" --name "${{ secrets.DEPLOYMENT_PREFIX }}csharplin"
- name: Deploy windows test
run: az functionapp deployment source config-zip --subscription "${{ secrets.AZURE_SUBSCRIPTION }}" --resource-group "${{ secrets.AZURE_RG }}" --src "./outputs/test/windows/windows.zip" --name "${{ secrets.DEPLOYMENT_PREFIX }}csharpwin"