0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-04 02:01:58 -05:00

Added CI workflow for testing migrations

- initializes the DB, rolls back to v3.0 and then forward to the latest again
This commit is contained in:
Daniel Lockyer 2020-11-05 12:58:01 +00:00
parent 0ce8e3171b
commit 361d79a8ef

View file

@ -28,6 +28,41 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
migrations:
runs-on: ubuntu-18.04
if: github.event_name == 'push' || (github.event_name == 'pull_request' && !startsWith(github.head_ref, 'renovate/'))
strategy:
matrix:
DB: ['sqlite3', 'mysql']
env:
database__client: ${{ matrix.DB }}
database__connection__host: 127.0.0.1
database__connection__user: root
database__connection__password: root
database__connection__database: ghost_testing
name: Migrations - ${{ matrix.DB }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.10.0'
- name: Shutdown MySQL
run: sudo service mysql stop
if: matrix.DB == 'mysql'
- uses: mirromutth/mysql-action@v1.1
if: matrix.DB == 'mysql'
with:
mysql version: '5.7'
mysql database: 'ghost_testing'
mysql root password: 'root'
- run: yarn
- run: yarn knex-migrator init
- run: yarn knex-migrator rollback --v 3.0 --force
- run: yarn knex-migrator migrate --force
test:
runs-on: ubuntu-18.04
if: github.event_name == 'push' || (github.event_name == 'pull_request' && !startsWith(github.head_ref, 'renovate/'))