-
Notifications
You must be signed in to change notification settings - Fork 20
84 lines (76 loc) · 2.24 KB
/
main.deployment.yaml
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
name: deploy-main-site
concurrency: test-company
on:
pull_request:
branches: [main]
push:
branches: [main]
env:
AZURE_RESOURCEGROUP_NAME: BicepTest-RG
ENVIRONMENT_TYPE: Test
TEST_LOCATION: deploy/webapp.tests.ps1
permissions:
id-token: write
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Bicep linter
run: az bicep build --file deploy/main.bicep
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: azure/login@v1
name: Sign in to Azure
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- uses: azure/arm-deploy@v1
name: Run preflight validation
with:
deploymentName: ${{ github.run_number }}
resourceGroupName: ${{ env.AZURE_RESOURCEGROUP_NAME }}
template: ./deploy/main.bicep
parameters: environmentType=${{ env.ENVIRONMENT_TYPE }}
deploymentMode: Validate
deploy:
runs-on: ubuntu-latest
needs: [lint, validate]
outputs:
appServiceAppHostName: ${{ steps.deploy.outputs.appServiceAppHostName }}
steps:
- uses: actions/checkout@v3
- uses: azure/login@v1
name: Sign in to Azure
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
enable-AzPSSession: true
- uses: azure/arm-deploy@v1
id: deploy
name: Deploy resources
with:
failOnStdErr: false
deploymentName: ${{ github.run_number }}
resourceGroupName: ${{ env.AZURE_RESOURCEGROUP_NAME }}
template: ./deploy/main.bicep
parameters: environmentType=${{ env.ENVIRONMENT_TYPE }}
smoke-test:
runs-on: ubuntu-latest
needs: deploy
steps:
- uses: actions/checkout@v3
- run: |
$container = New-PesterContainer `
-Path '${{ env.TEST_LOCATION }}' `
-Data @{ HostNameUrl = '${{needs.deploy.outputs.appServiceAppHostName}}' }
Invoke-Pester `
-Container $container `
-CI
name: Run smoke tests
shell: pwsh