Run cypress happy path test #1845
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: Run cypress happy path test | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [enqueued] | |
branches: | |
- integration | |
merge_group: | |
jobs: | |
cypress-tests: | |
name: Cypress E2E Tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_DB: "pg-litefarm" | |
POSTGRES_USER: "postgres" | |
POSTGRES_PASSWORD: "postgres" | |
# POSTGRES_HOST: localhost | |
# POSTGRES_HOST: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 5s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
volumes: | |
- ./initdb.d:/docker-entrypoint-initdb.d | |
- postgres-data:/var/lib/postgresql/data | |
strategy: | |
matrix: | |
node-version: [18.16.1] | |
env: | |
JWT_SECRET: This_will_(really)_work | |
JWT_INVITE_SECRET: Any_arbitrary_string_will_do | |
JWT_RESET_SECRET: Production_is_secured_with_a_long_random_string | |
JWT_FARM_SECRET: Here_we_can_use_friendly_explanations | |
JWT_SCHEDULER_SECRET: Another_token_was_needed_for_the_scheduler | |
GOOGLE_API_KEY: ${{secrets.VITE_GOOGLE_MAPS_API_KEY}} | |
VITE_GOOGLE_MAPS_API_KEY: ${{secrets.VITE_GOOGLE_MAPS_API_KEY}} | |
VITE_WEATHER_API_KEY: ${{secrets.VITE_WEATHER_API_KEY}} | |
NODE_ENV: development | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Run API in background | |
working-directory: packages/api | |
run: | | |
npm ci && cd ../shared && npm ci | |
cd ../api && npm run migrate:dev:db | |
npm run start & | |
env: | |
PORT: 5000 | |
DEV_DATABASE_HOST: localhost | |
DEV_DATABASE: pg-litefarm | |
DEV_DATABASE_USER: postgres | |
DEV_DATABASE_PASSWORD: postgres | |
NODE_ENV: development | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: latest | |
- name: Run Webapp | |
working-directory: packages/webapp | |
run: | | |
pnpm install --config.auto-install-peers=true --no-frozen-lockfile --force | |
pnpm dev & | |
env: | |
VITE_ENV: development | |
VITE_GOOGLE_OAUTH_CLIENT_ID: ${{secrets.VITE_GOOGLE_OAUTH_CLIENT_ID}} | |
VITE_DO_BUCKET_NAME: litefarm | |
NODE_ENV: development | |
VITE_API_URL: http://localhost:5000 | |
CYPRESS_COVERAGE: true | |
- name: Run E2E test (English) | |
env: | |
CYPRESS_RECORD_KEY: ${{secrets.CYPRESS_RECORD_KEY}} | |
CYPRESS_USER: 0 | |
uses: cypress-io/github-action@v6 | |
with: | |
working-directory: packages/end-to-end | |
headed: true | |
browser: chrome | |
record: true | |
parallel: false | |
group: "UI - Chrome" | |
ci-build-id: ${{ github.run_id }} | |
- name: Archive backend logs | |
uses: actions/upload-artifact@v3 | |
with: | |
name: logs | |
path: packages/api/logs |