Feat/e2e #10
Workflow file for this run
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: Build and Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
jobs: | |
test-backend: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.draft == false | |
strategy: | |
matrix: | |
version: [ 20, 22 ] | |
services: | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_DATABASE: test_db | |
MYSQL_ROOT_PASSWORD: admin123 | |
options: >- | |
--health-cmd "mysqladmin ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 3 | |
ports: | |
- 3306:3306 | |
env: | |
APP_PORT: 3000 | |
APP_URL: http://localhost:3000 | |
APP_NAME: Test App | |
DATABASE_URL: mysql://root:admin123@localhost:3306/test_db | |
TMP_DIR: tests/tmp/storage/tmp/ | |
UPLOAD_DIR: tests/tmp/storage/uploads/ | |
STORAGE_LOCATION: local | |
JWT_SECRET: aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpP | |
SMTP_HOST: localhost | |
SMTP_PORT: 587 | |
SMTP_USERNAME: user | |
SMTP_PASSWORD: password | |
EMAIL_FROM: noreply@yourapp.com | |
EMAIL_REPLY_TO: noreply@yourapp.com | |
EMAIL_ADMIN: admin@yourapp.com | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.version }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Build common | |
run: npm run build --workspace common | |
- name: Build backend | |
run: npm run build -workspace backend | |
- name: Migrate test database | |
run: npm run migrate --workspace backend | |
- name: Test workspaces | |
run: npm run test --workspace backend | |
test-frontend: | |
runs-on: ubuntu-24.04 | |
if: github.event.pull_request.draft == false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build common | |
run: npm run build --workspace common | |
- name: Test workspaces | |
run: npm run test --workspace frontend | |
test-e2e: | |
runs-on: ubuntu-24.04 | |
if: github.event.pull_request.draft == false | |
services: | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_DATABASE: test_db | |
MYSQL_ROOT_PASSWORD: admin123 | |
options: >- | |
--health-cmd "mysqladmin ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 3 | |
ports: | |
- 3306:3306 | |
env: | |
APP_PORT: 3001 | |
APP_URL: http://localhost:3001 | |
APP_NAME: Test App | |
DATABASE_URL: mysql://root:admin123@localhost:3306/test_db | |
TMP_DIR: tests/tmp/storage/tmp/ | |
UPLOAD_DIR: tests/tmp/storage/uploads/ | |
STORAGE_LOCATION: local | |
JWT_SECRET: aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpP | |
SMTP_HOST: localhost | |
SMTP_PORT: 587 | |
SMTP_USERNAME: user | |
SMTP_PASSWORD: password | |
EMAIL_FROM: noreply@yourapp.com | |
EMAIL_REPLY_TO: noreply@yourapp.com | |
EMAIL_ADMIN: admin@yourapp.com | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Cypress run | |
uses: cypress-io/github-action@v6 | |
with: | |
project: ./e2e | |
build: npm run build-and-migrate | |
start: npm run production -w backend | |
browser: chrome |