Files
portfolio/.github/workflows/deploy-test.yml

63 lines
1.5 KiB
YAML

name: Unit Test
on:
push:
branches-ignore:
- main
- master
jobs:
build-test:
runs-on: ubuntu-latest
environment: recette
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: latest
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies and build
run: |
pnpm install --frozen-lockfile
pnpm run build
env:
VITE_GITHUB_TOKEN: ${{ secrets.VITE_GITHUB_TOKEN }}
VITE_EMAILJS_SERVICE_ID: ${{ secrets.VITE_EMAILJS_SERVICE_ID }}
VITE_EMAILJS_TEMPLATE_ID: ${{ secrets.VITE_EMAILJS_TEMPLATE_ID }}
VITE_EMAILJS_USER_ID: ${{ secrets.VITE_EMAILJS_USER_ID }}
- name: Install Cypress binary
run: pnpx cypress install
- name: Install http-server
run: pnpm add -D http-server
- name: Start HTTP server
run: pnpx http-server ./dist -p 8080 &
env:
CI: true
- name: Run Cypress tests and Browserslist
run: pnpm run test
env:
CYPRESS_baseUrl: http://localhost:8080
- name: Upload Cypress screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: cypress-screenshots
path: cypress/screenshots