Merge pull request #132 from marvin-wtt/marvin-wtt-patch-1 #326
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: | |
build-and-test: | |
runs-on: ubuntu-latest | |
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 setup for tests - not deployment | |
env: | |
APP_PORT: 3000 | |
APP_URL: http://localhost:9000 | |
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: [email protected] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build workspaces | |
run: npm run build --workspaces | |
- name: Migrate test database | |
run: npm run migrate --workspaces --if-present | |
- name: Test workspaces | |
run: npm run test --workspaces --if-present |