mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-05-04 18:08:46 +03:00
74 lines
2.3 KiB
YAML
74 lines
2.3 KiB
YAML
name: test-migrations
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
paths:
|
|
- '**.php'
|
|
- 'composer.*'
|
|
pull_request:
|
|
paths:
|
|
- '**.php'
|
|
- 'composer.*'
|
|
|
|
jobs:
|
|
build:
|
|
if: ${{ github.ref != 'refs/heads/l10n_development' }}
|
|
runs-on: docker
|
|
container:
|
|
image: docker.io/library/node:24-trixie
|
|
strategy:
|
|
matrix:
|
|
php: ['8.2', '8.3', '8.4', '8.5']
|
|
services:
|
|
mysql:
|
|
image: docker.io/library/mariadb:12.2.2-noble
|
|
env:
|
|
MARIADB_USER: bookstack-test
|
|
MARIADB_PASSWORD: bookstack-test
|
|
MARIADB_DATABASE: bookstack-test
|
|
MARIADB_ROOT_PASSWORD: password
|
|
steps:
|
|
- uses: https://code.forgejo.org/actions/checkout@v6
|
|
|
|
- name: Setup PHP
|
|
uses: https://github.com/shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php }}
|
|
extensions: gd, mbstring, json, curl, xml, mysql, ldap
|
|
|
|
- name: Get Composer Cache Directory
|
|
id: composer-cache
|
|
run: |
|
|
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Cache composer packages
|
|
uses: https://code.forgejo.org/actions/cache@v5
|
|
with:
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-composer-${{ matrix.php }}
|
|
restore-keys: ${{ runner.os }}-composer-
|
|
|
|
- name: Install composer dependencies
|
|
run: composer install --prefer-dist --no-interaction --ansi
|
|
env:
|
|
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.GH_TOKEN }}"}}'
|
|
|
|
- name: Start migration test
|
|
env:
|
|
TEST_DATABASE_URL: 'mysql://bookstack-test:bookstack-test@mysql/bookstack-test'
|
|
run: |
|
|
php${{ matrix.php }} artisan migrate --force -n --database=mysql_testing
|
|
|
|
- name: Start migration:rollback test
|
|
env:
|
|
TEST_DATABASE_URL: 'mysql://bookstack-test:bookstack-test@mysql/bookstack-test'
|
|
run: |
|
|
php${{ matrix.php }} artisan migrate:rollback --force -n --database=mysql_testing
|
|
|
|
- name: Start migration rerun test
|
|
env:
|
|
TEST_DATABASE_URL: 'mysql://bookstack-test:bookstack-test@mysql/bookstack-test'
|
|
run: |
|
|
php${{ matrix.php }} artisan migrate --force -n --database=mysql_testing
|