From 361d79a8efd44e3c387cf34d1265a51c9e388373 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Thu, 5 Nov 2020 12:58:01 +0000 Subject: [PATCH] Added CI workflow for testing migrations - initializes the DB, rolls back to v3.0 and then forward to the latest again --- .github/workflows/test.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6858669a11..dbc26dd6be 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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/'))