mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-13 04:30:41 -05:00
117 lines
3.1 KiB
YAML
117 lines
3.1 KiB
YAML
name: Laravel Pest Tests
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
- develop
|
|
|
|
jobs:
|
|
laravel-tests:
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
mysql:
|
|
image: mysql:8.3
|
|
env:
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
|
MYSQL_DATABASE: test
|
|
ports:
|
|
- 33306: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: 20
|
|
|
|
- name: Cache node_modules Directory
|
|
uses: actions/cache@v4
|
|
id: node_modules-cache
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.OS }}-build-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Install NPM Packages
|
|
if: steps.node_modules-cache.outputs.cache-hit != 'true'
|
|
run: npm ci
|
|
|
|
- name: Build Frontend
|
|
run: npm run build
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '8.3'
|
|
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
|
|
coverage: none
|
|
|
|
- name: Configure Laravel Nova Authentication
|
|
shell: bash
|
|
env:
|
|
NOVA_USERNAME: ${{ secrets.NOVA_USERNAME }}
|
|
NOVA_LICENSE_KEY: ${{ secrets.NOVA_LICENSE_KEY }}
|
|
run: |
|
|
composer config http-basic.nova.laravel.com "$NOVA_USERNAME" "$NOVA_LICENSE_KEY"
|
|
|
|
- name: Get Composer Cache Directory
|
|
id: composer-cache
|
|
run: |
|
|
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
|
|
|
- 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 }}-build-${{ hashFiles('**/composer.lock') }}
|
|
|
|
- name: Copy .env
|
|
run: php -r "file_exists('.env') || copy('.env.ci', '.env');"
|
|
|
|
- name: Install Dependencies
|
|
if: steps.vendor-cache.outputs.cache-hit != 'true'
|
|
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
|
|
|
|
- name: Update Dependencies with latest stable
|
|
run: composer update --prefer-stable
|
|
|
|
- name: Generate 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: test
|
|
DB_PORT: 33306
|
|
DB_USER: root
|
|
run: php artisan migrate
|
|
|
|
- name: Execute Unit & Feature Tests
|
|
env:
|
|
DB_CONNECTION: mysql
|
|
DB_DATABASE: test
|
|
DB_PORT: 33306
|
|
DB_USER: root
|
|
run: ./vendor/bin/pest
|