181 lines
5.1 KiB
YAML
181 lines
5.1 KiB
YAML
name: Frontend tests
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches: ["main"]
|
|
paths:
|
|
- frontend/**
|
|
- tracker/**
|
|
pull_request:
|
|
branches: ["dev", "main"]
|
|
paths:
|
|
- frontend/**
|
|
- tracker/**
|
|
|
|
env:
|
|
API: ${{ secrets.E2E_API_ORIGIN }}
|
|
ASSETS: ${{ secrets.E2E_ASSETS_ORIGIN }}
|
|
APIEDP: ${{ secrets.E2E_EDP_ORIGIN }}
|
|
CY_ACC: ${{ secrets.CYPRESS_ACCOUNT }}
|
|
CY_PASS: ${{ secrets.CYPRESS_PASSWORD }}
|
|
FOSS_PROJECT_KEY: ${{ secrets.FOSS_PROJECT_KEY }}
|
|
FOSS_INGEST: ${{ secrets.FOSS_INGEST }}
|
|
|
|
jobs:
|
|
build-and-test:
|
|
runs-on: macos-latest
|
|
name: Build and test Tracker plus Replayer
|
|
strategy:
|
|
matrix:
|
|
node-version: [18.x]
|
|
steps:
|
|
- uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: latest
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 9
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
# Cache pnpm node modules for Tracker
|
|
- name: Cache tracker node_modules
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: tracker/tracker/node_modules
|
|
key: ${{ runner.OS }}-test_tracker_build-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
test_tracker_build-{{ runner.OS }}-build-
|
|
test_tracker_build-{{ runner.OS }}-
|
|
|
|
# Install dependencies for Tracker
|
|
- name: Setup Testing packages for Tracker
|
|
run: |
|
|
cd tracker/tracker
|
|
pnpm install
|
|
|
|
- name: Build tracker inst
|
|
run: |
|
|
cd tracker/tracker
|
|
bun run build
|
|
|
|
# Cache pnpm node_modules for Testing UI
|
|
- name: Cache testing UI node modules
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: tracker/tracker-testing-playground/node_modules
|
|
key: ${{ runner.OS }}-build-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.OS }}-build-
|
|
${{ runner.OS }}-
|
|
|
|
# Install dependencies for Testing UI
|
|
- name: Setup Testing packages for Testing UI
|
|
run: |
|
|
cd tracker/tracker-testing-playground
|
|
pnpm install
|
|
|
|
# Cache pnpm node_modules for Frontend
|
|
- name: Cache frontend node_modules
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: frontend/node_modules
|
|
key: ${{ runner.OS }}-build-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.OS }}-build-
|
|
${{ runner.OS }}-
|
|
|
|
# Set up environment for Frontend
|
|
- name: Setup env
|
|
run: |
|
|
cd frontend
|
|
echo "NODE_ENV=development" >> .env
|
|
echo "SOURCEMAP=true" >> .env
|
|
echo "ORIGIN=$API" >> .env
|
|
echo "ASSETS_HOST=$ASSETS" >> .env
|
|
echo "API_EDP=$APIEDP" >> .env
|
|
echo "SENTRY_ENABLED=false" >> .env
|
|
echo "SENTRY_URL=''" >> .env
|
|
echo "CAPTCHA_ENABLED=false" >> .env
|
|
echo "CAPTCHA_SITE_KEY='asdad'" >> .env
|
|
echo "MINIO_ENDPOINT=''" >> .env
|
|
echo "MINIO_PORT=''" >> .env
|
|
echo "MINIO_USE_SSL=''" >> .env
|
|
echo "MINIO_ACCESS_KEY=''" >> .env
|
|
echo "MINIO_SECRET_KEY=''" >> .env
|
|
echo "VERSION='1.15.0'" >> .env
|
|
echo "TRACKER_VERSION='10.0.0'" >> .env
|
|
echo "COMMIT_HASH='dev'" >> .env
|
|
echo "{ \"account\": \"$CY_ACC\", \"password\": \"$CY_PASS\" }" >> cypress.env.json
|
|
|
|
# Install dependencies for Frontend
|
|
- name: Setup packages
|
|
run: |
|
|
cd frontend
|
|
pnpm install
|
|
|
|
# Run unit tests for Frontend
|
|
- name: Run unit tests
|
|
run: |
|
|
cd frontend
|
|
pnpm test:ci
|
|
|
|
# Upload coverage reports to Codecov
|
|
- name: Upload coverage reports to Codecov
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
flags: ui
|
|
name: ui
|
|
|
|
# Run Testing frontend with pnpm
|
|
- name: Run testing frontend
|
|
run: |
|
|
cd tracker/tracker-testing-playground
|
|
pnpm start &> testing.log &
|
|
echo "Started"
|
|
npm i -g wait-on
|
|
echo "Got wait on"
|
|
sleep 30
|
|
cat testing.log
|
|
npx wait-on http://localhost:3000
|
|
echo "Done"
|
|
timeout-minutes: 4
|
|
|
|
# Run frontend with pnpm
|
|
- name: Run Frontend
|
|
run: |
|
|
cd frontend
|
|
bun start &> frontend.log &
|
|
echo "Started"
|
|
sleep 30
|
|
cat frontend.log
|
|
npx wait-on http://0.0.0.0:3333
|
|
echo "Done"
|
|
timeout-minutes: 4
|
|
|
|
# Run visual tests with pnpm
|
|
- name: (Chrome) Run visual tests
|
|
run: |
|
|
cd frontend
|
|
pnpm cy:test
|
|
timeout-minutes: 5
|
|
|
|
# Upload Debug Info if tests fail
|
|
- name: Upload Debug
|
|
if: ${{ failure() }}
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: "Snapshots"
|
|
path: |
|
|
frontend/cypress/videos
|
|
frontend/cypress/snapshots/replayer.cy.ts
|
|
frontend/cypress/screenshots
|
|
frontend/cypress/snapshots/generalStability.cy.ts
|