mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-05-04 18:08:46 +03:00
68 lines
1.9 KiB
YAML
68 lines
1.9 KiB
YAML
name: test-php
|
|
|
|
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: node:24-bullseye
|
|
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, gmp
|
|
|
|
- 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: Migrate and seed the database
|
|
env:
|
|
DB_HOST: mysql
|
|
run: |
|
|
php${{ matrix.php }} artisan migrate --force -n --database=mysql_testing
|
|
php${{ matrix.php }} artisan db:seed --force -n --class=DummyContentSeeder --database=mysql_testing
|
|
|
|
- name: Run PHP tests
|
|
env:
|
|
DB_HOST: mysql
|
|
run: php${{ matrix.php }} ./vendor/bin/phpunit
|