Merge branch 'main' of https://github.com/uwon0625/nxNews #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: client-app Unit/E2E Tests + Deploy | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- 'client-app/**' | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
working-directory: ./client-app | |
run: | | |
rm -f package-lock.json | |
npm install | |
- name: Run unit tests | |
working-directory: ./client-app | |
run: npm run test -- --no-watch --browsers ChromeHeadless | |
- name: Install Playwright Browsers | |
working-directory: ./client-app | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
working-directory: ./client-app | |
run: npx playwright test | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: client-app/playwright-report/ | |
retention-days: 30 | |
deploy: | |
needs: test | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install and Build | |
working-directory: ./client-app | |
run: | | |
npm ci | |
npm run build --configuration=production | |
- name: Deploy to Azure Static Web Apps | |
uses: Azure/static-web-apps-deploy@v1 | |
with: | |
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
action: "upload" | |
app_location: "/client-app" | |
output_location: "dist/client-app/browser" | |
skip_app_build: false | |
env: | |
NODE_VERSION: '20' |