|
62 | 62 | - name: Load fixtures |
63 | 63 | run: | |
64 | 64 | docker compose run --rm phpfpm composer fixtures |
| 65 | +
|
| 66 | + # The jobs above migrate an empty database. A deployment migrates a database |
| 67 | + # that already holds rows, so a migration that cannot cope with existing |
| 68 | + # data passes those jobs unnoticed. This job builds the database as it looks |
| 69 | + # before the pull request, fixtures included, and then applies the pull |
| 70 | + # request's migrations on top of it. |
| 71 | + migrate-populated-database: |
| 72 | + name: Run migrations on a populated database |
| 73 | + runs-on: ubuntu-latest |
| 74 | + # This workflow also runs on pushes to main and develop, where there is |
| 75 | + # no pull request to read a base branch from: the checkout steps below |
| 76 | + # would get an empty revision and fail. A push has no base to compare |
| 77 | + # against, so skip the job rather than guess one. |
| 78 | + if: github.event_name == 'pull_request' |
| 79 | + |
| 80 | + steps: |
| 81 | + - uses: actions/checkout@v6 |
| 82 | + with: |
| 83 | + fetch-depth: 0 |
| 84 | + |
| 85 | + - name: Create docker network |
| 86 | + run: | |
| 87 | + docker network create frontend |
| 88 | +
|
| 89 | + - name: Check out the base branch |
| 90 | + run: | |
| 91 | + git checkout ${{ github.event.pull_request.base.sha }} |
| 92 | +
|
| 93 | + - name: Run Composer Install |
| 94 | + run: | |
| 95 | + docker compose run --rm phpfpm composer install --no-interaction |
| 96 | +
|
| 97 | + - name: Run Doctrine Migrations |
| 98 | + run: | |
| 99 | + docker compose run --rm phpfpm bin/console doctrine:migrations:migrate --no-interaction |
| 100 | +
|
| 101 | + - name: Load fixtures |
| 102 | + run: | |
| 103 | + docker compose run --rm phpfpm composer fixtures |
| 104 | +
|
| 105 | + - name: Check out the pull request |
| 106 | + run: | |
| 107 | + git checkout ${{ github.event.pull_request.head.sha }} |
| 108 | +
|
| 109 | + - name: Run Composer Install |
| 110 | + run: | |
| 111 | + docker compose run --rm phpfpm composer install --no-interaction |
| 112 | +
|
| 113 | + - name: Run Doctrine Migrations on the populated database |
| 114 | + run: | |
| 115 | + docker compose run --rm phpfpm bin/console doctrine:migrations:migrate --no-interaction |
0 commit comments