Update to newest version of github actions #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: [push, pull_request] | |
name: CI | |
jobs: | |
test: | |
name: PHP Linting and Tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: ['8.2', '8.3'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Install JavaScript dependencies | |
run: npm install | |
- name: Do webpack build | |
run: npm run prod | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: mcrypt sqlite3 | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir=$(php composer.phar config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install PHP dependencies | |
run: php composer.phar install --prefer-dist --no-interaction --no-suggest | |
- name: Set up application | |
run: | | |
cp .env.ci .env | |
rm .env.testing | |
php artisan key:generate | |
touch database/database.sqlite | |
chmod a+w database/database.sqlite | |
php artisan migrate | |
- name: Install Chrome | |
uses: browser-actions/setup-chrome@v1 | |
- name: Print Chrome version | |
run: chrome --version | |
- name: Install ChromeDriver | |
run: php artisan dusk:chrome-driver --detect | |
- name: Start application | |
run: | | |
php artisan serve & | |
sleep 2 # give the PHP server time to start | |
- name: Run tests | |
run: php artisan test |