dotnet-podcasts/.github/workflows/podcast-web.yml

79 lines
2.0 KiB
YAML
Raw Normal View History

2021-11-30 03:54:48 +08:00
name: Podcast Web CICD
on:
push:
branches: [main]
paths:
- "src/Web/**"
- ".github/workflows/podcast-web.yml"
2022-09-18 01:39:52 +08:00
- "deploy/Web/web.bicep"
2021-11-30 03:54:48 +08:00
pull_request:
branches: [main]
paths:
- "src/Web/**"
- ".github/workflows/podcast-web.yml"
2022-09-18 01:39:52 +08:00
- "deploy/Web/web.bicep"
2021-11-30 03:54:48 +08:00
workflow_dispatch:
jobs:
buildDeployStaging:
2022-12-07 22:28:10 +08:00
name: "Build and deploy to Staging environment"
2022-12-05 04:34:01 +08:00
if: "!contains(github.ref, 'refs/heads/main')"
2022-12-05 23:09:27 +08:00
uses: ./.github/workflows/template-web.yml
2022-12-06 00:51:54 +08:00
concurrency:
2022-12-06 00:56:29 +08:00
group: staging-web
2022-12-07 22:28:10 +08:00
cancel-in-progress: true
2022-12-05 23:17:52 +08:00
secrets: inherit
2022-12-05 23:09:27 +08:00
with:
environment: staging
buildDeployProd:
2022-12-07 22:28:10 +08:00
name: "Build and deploy main branch to Production environment"
2022-12-05 04:34:01 +08:00
if: contains(github.ref, 'refs/heads/main')
2022-12-05 23:09:27 +08:00
uses: ./.github/workflows/template-web.yml
2022-12-06 00:51:54 +08:00
concurrency:
2022-12-06 00:56:29 +08:00
group: prod-web
2022-12-07 22:28:10 +08:00
cancel-in-progress: true
2022-12-05 23:18:38 +08:00
secrets: inherit
2022-12-05 23:09:27 +08:00
with:
environment: prod
2022-09-16 23:02:00 +08:00
test:
2022-12-06 03:24:53 +08:00
needs: [buildDeployStaging, buildDeployProd]
2022-12-05 02:35:50 +08:00
if: ${{ always() }}
2022-09-16 23:02:00 +08:00
timeout-minutes: 60
runs-on: ubuntu-latest
container: mcr.microsoft.com/playwright:v1.27.1-focal
2022-09-16 23:02:00 +08:00
env:
2022-09-16 23:17:53 +08:00
BASEURL: https://${{secrets.WEBAPP_NAME}}.azurewebsites.net # sets value for URL to test
2022-09-16 23:02:00 +08:00
defaults:
run:
working-directory: src/Web/E2E
steps:
- uses: actions/checkout@v3
2022-09-16 23:14:55 +08:00
- uses: actions/setup-node@v2
with:
node-version: "14.x"
- name: Install dependencies
run: npm ci
2022-12-07 22:28:10 +08:00
2022-09-16 23:14:55 +08:00
- name: Run Playwright tests
run: |
2022-12-07 13:42:56 +08:00
npx playwright install msedge
2022-09-16 23:14:55 +08:00
HOME=/root npx playwright test
- name: Create test summary
uses: test-summary/action@dist
if: always()
with:
paths: src/Web/E2E/test-results/junit.xml
- name: Upload HTML report
uses: actions/upload-artifact@v2
if: always()
with:
name: playwright-report
path: src/Web/E2E/playwright-report/
retention-days: 30