Skip to content

LOTUS: (#84)

LOTUS: (#84) #16

name: Test and deploy to Pages
on:
# Runs on pushes targeting the default branch and pull requests
push:
branches: ['main']
pull_request:
# Allows to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
jobs:
test:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:next-jammy
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node 20
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install --frozen-lockfile --immutable
- run: yarn lint
- run: yarn test
- name: Install Playwright browsers
run: yarn playwright install --with-deps
- name: Run Playwright tests
run: HOME=/root yarn playwright test
- name: Upload Playwright report
uses: actions/upload-artifact@v3
if: failure()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Build static page for deployment
run: yarn predeploy
- name: Upload artifact for deployment
uses: actions/upload-pages-artifact@v2
with:
path: ./dist
deploy:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: 'pages'
cancel-in-progress: false
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2