Skip to content

Commit

Permalink
Update test.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed Sep 23, 2023
1 parent ffd299f commit 7a9ecfe
Showing 1 changed file with 47 additions and 10 deletions.
57 changes: 47 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,57 @@
name: Test
name: Test Application

on:
push:
branches:
- 'dist'
workflow_dispatch

jobs:
test:
name: Test
name: Test Application
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
steps:
- name: Install Wget
run: sudo apt install wget
- name: Download install
run: wget https://raw.githubusercontent.com/freescout-helpdesk/freescout/dist/tools/install.sh
- name: chmod installer
run: chmod u+x install.sh
- name: Run installer
run: sudo ./install.sh
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mysql, mbstring, xml, imap, zip, gd, curl, intl, json

- name: Get composer cache directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer packages
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php }}
restore-keys: ${{ runner.os }}-composer-

- name: Start MySQL
run: |
sudo systemctl start mysql
- name: Setup database
run: |
mysql -uroot -proot -e 'CREATE DATABASE IF NOT EXISTS `freescout-test`;'
mysql -uroot -proot -e "CREATE USER 'freescout-test'@'localhost' IDENTIFIED WITH mysql_native_password BY 'freescout-test';"
mysql -uroot -proot -e "GRANT ALL ON \`freescout-test\`.* TO 'freescout-test'@'localhost';"
mysql -uroot -proot -e 'FLUSH PRIVILEGES;'
- name: Install composer dependencies
run: composer install --ignore-platform-reqs --no-interaction --ansi

- name: Migrate and seed the database
run: |
php${{ matrix.php }} artisan migrate --force -n --database=mysql_testing
php${{ matrix.php }} artisan db:seed --force -n --database=mysql_testing
- name: Run PHP tests
run: php${{ matrix.php }} ./vendor/bin/phpunit

0 comments on commit 7a9ecfe

Please sign in to comment.