-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (70 loc) · 2.73 KB
/
run-acceptance-tests.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
name: Deploy Function
on:
workflow_call:
inputs:
environment:
required: true
type: string
project_name:
required: true
type: string
keyvault_prefix:
required: true
type: string
app_name:
required: true
type: string
test_project_name:
required: true
type: string
project_type:
required: true
type: string
jobs:
run-acceptance-tests:
name: Run Acceptance Tests
runs-on: ubuntu-22.04
environment: ${{ inputs.environment }}
env:
KEYVAULT: ${{ vars.AZURE_RESOURCE_PREFIX }}-kv-fh-general
RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_PREFIX }}-familyhubs
API_APP_NAME: ${{ vars.AZURE_RESOURCE_PREFIX }}-${{ inputs.app_name }}
APP_FIREWALL_NAME: acceptance-tests
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Setup .NET ${{ vars.DOTNET_VERSION }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ vars.DOTNET_VERSION }}
- name: Azure CLI Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Get Workflow Runner IP
id: runner-ip
uses: ./.github/actions/get-runner-ip-address
- name: Add IP Address to App Firewall
shell: pwsh
run: |-
az webapp config access-restriction add -g ${{ env.RESOURCE_GROUP }} -n ${{ env.API_APP_NAME }} --rule-name ${{ env.APP_FIREWALL_NAME }} --action Allow --ip-address ${{ steps.runner-ip.outputs.ip_address }} --priority 50
- name: Test Settings Variable Substitution
id: substitution
uses: ./.github/actions/variable-substitution
with:
keyvault_name: ${{ env.KEYVAULT }}
keyvault_prefix: ${{ inputs.keyvault_prefix }}
files: '${{ github.workspace }}/src/${{ inputs.project_type }}/${{ inputs.project_name }}/acceptance-tests/${{ inputs.test_project_name }}/appsettings.json'
configure: 'Tests'
- name: Run Acceptance Tests
shell: bash
run: dotnet test "${{ github.workspace }}/src/${{ inputs.project_type }}/${{ inputs.project_name }}/acceptance-tests/${{ inputs.test_project_name }}/${{ inputs.test_project_name }}.csproj" --logger "html;logfilename=testResults.html"
- name: Remove IP Address from App Firewall
if: always()
shell: pwsh
run: |-
az webapp config access-restriction remove -g ${{ env.RESOURCE_GROUP }} -n ${{ env.API_APP_NAME }} --rule-name ${{ env.APP_FIREWALL_NAME }}