I have been using a GitHub Actions workflow for a while now:
name: Laravel
on: [push]
jobs:
laravel-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
run: |
rm -rf vendor
composer install
- name: Generate key
run: php artisan key:generate
- name: Link Storage
run: php artisan storage:link
- name: Create Database
run: |
mkdir -p database
touch database/database.sqlite
- name: Execute tests (Unit and Feature tests) via PHPUnit
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: vendor/bin/phpunit --stop-on-failure
It worked until 8.0 came out, then composer exploded with a bunch of errors that this and that package, which I update regularly, are not compatible with 8.0.
Anywho, I need to set this to use 7.4 for now.
I understand the:
with:
php-version: '7.4'
and I know I can use a matrix, but where am I calling the whole "use this php version" with in this script to make the tests run against 7.4?
Use the setup-php
action:
name: Laravel
on: [push]
jobs:
laravel-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
[...]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With