Skip to content

Merge pull request #183 from ElYusubov/development #184

Merge pull request #183 from ElYusubov/development

Merge pull request #183 from ElYusubov/development #184

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