]> BookStack Code Mirror - bookstack/blob - .github/workflows/phpunit.yml
f6c002c05098d1c1a9148e6bb54ddde46ef1fd2b
[bookstack] / .github / workflows / phpunit.yml
1 name: phpunit
2
3 on:
4   push:
5     branches:
6       - master
7       - release
8   pull_request:
9     branches:
10       - '*'
11       - '*/*'
12       - '!l10n_master'
13
14 jobs:
15   build:
16     runs-on: ubuntu-latest
17     strategy:
18       matrix:
19         php: [7.2, 7.3]
20     steps:
21     - uses: actions/checkout@v1
22
23     - name: Get Composer Cache Directory
24       id: composer-cache
25       run: |
26         echo "::set-output name=dir::$(composer config cache-files-dir)"
27
28     - name: Cache composer packages
29       uses: actions/cache@v1
30       with:
31         path: ${{ steps.composer-cache.outputs.dir }}
32         key: ${{ runner.os }}-composer-${{ matrix.php }}
33
34     - name: Setup Database
35       run: |
36         mysql -uroot -proot -e 'CREATE DATABASE IF NOT EXISTS `bookstack-test`;'
37         mysql -uroot -proot -e "CREATE USER 'bookstack-test'@'localhost' IDENTIFIED BY 'bookstack-test';"
38         mysql -uroot -proot -e "GRANT ALL ON \`bookstack-test\`.* TO 'bookstack-test'@'localhost';"
39         mysql -uroot -proot -e 'FLUSH PRIVILEGES;'
40
41     - name: Install composer dependencies & Test
42       run: composer install --prefer-dist --no-interaction --ansi
43
44     - name: Migrate and seed the database
45       run: |
46         php${{ matrix.php }} artisan migrate --force -n --database=mysql_testing
47         php${{ matrix.php }} artisan db:seed --force -n --class=DummyContentSeeder --database=mysql_testing
48
49     - name: phpunit
50       run: php${{ matrix.php }} ./vendor/bin/phpunit