Frontend question/meraj #104
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: Migrations | |
on: | |
push: | |
branches: [main, develop] | |
pull_request: | |
branches: [main, develop] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8 | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: test | |
ports: | |
- 33306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- uses: actions/checkout@v3 # Update to version 3 of actions/checkout | |
- name: Verify DB connection | |
env: | |
PORT: 33306 | |
run: | | |
while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do | |
sleep 1 | |
done | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18.x | |
- run: yarn | |
env: | |
CI: true | |
- name: Run DB Migrations | |
run: yarn workspace server db:setup | |
env: | |
MYSQL_HOST: '127.0.0.1' | |
MYSQL_PORT: 33306 | |
MYSQL_USER: 'root' | |
MYSQL_PASSWORD: 'password' | |
MYSQL_DATABASE: 'test' | |
- name: Run DB Migrations Rollback | |
run: yarn workspace server db:clean | |
env: | |
MYSQL_HOST: '127.0.0.1' | |
MYSQL_PORT: 33306 | |
MYSQL_USER: 'root' | |
MYSQL_PASSWORD: 'password' | |
MYSQL_DATABASE: 'test' |