Skip to content

Update dependencies #121

Update dependencies

Update dependencies #121

Workflow file for this run

name: 'Preflight Tests'
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:latest
env:
MYSQL_DATABASE: laravel_starter
MYSQL_ROOT_PASSWORD: laravel_starter
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: 🗂 Checkout Code
uses: actions/checkout@v4
- name: 🧩 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: 📦 Install PNPM
run: npm i pnpm -g
- name: 🗃 Cache node_modules Directory
uses: actions/cache@v4
id: node_modules-cache
with:
path: node_modules
key: ${{ runner.OS }}-node_modules-cache-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}
- name: 🚀 Install NPM Packages
if: steps.node_modules-cache.outputs.cache-hit != 'true'
run: pnpm i
- name: 🏗 Build Frontend with Vite
run: pnpm build
- name: 🗃 Setup Cache Environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: 8.2
extensions: bcmath
key: php_extensions_cache
- name: 🗃 Cache Extensions
uses: actions/cache@v4
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}
- name: 🐘 Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: bcmath
- name: 🗄 Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: 🗃 Cache Composer Dependencies
uses: actions/cache@v4
id: actions-cache
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: 🗂 Cache PHP Dependencies
uses: actions/cache@v4
id: vendor-cache
with:
path: vendor
key: ${{ runner.OS }}-vendor-${{ hashFiles('**/composer.lock') }}
- name: 📋 Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: 📦 Install Composer Dependencies
# if: steps.vendor-cache.outputs.cache-hit != 'true'
run: composer install --no-interaction --prefer-dist
- name: 🔑 Generate App Key
run: php artisan key:generate
- name: 🔧 Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: 🔄 Run Migrations
env:
DB_CONNECTION: mysql
DB_DATABASE: laravel_starter
DB_PORT: 3306
DB_USER: root
DB_HOST: 127.0.0.1
DB_PASSWORD: laravel_starter
run: php artisan migrate:fresh --seed
- name: 🧪 Execute tests (Unit and Feature tests) via PHPUnit
env:
DB_CONNECTION: mysql
DB_DATABASE: laravel_starter
DB_PORT: 3306
DB_USER: root
DB_HOST: 127.0.0.1
DB_PASSWORD: laravel_starter
run: vendor/bin/phpunit --testdox