mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-13 04:30:41 -05:00
85 lines
2.3 KiB
YAML
85 lines
2.3 KiB
YAML
name: Tests
|
|
|
|
on: [ push, pull_request ]
|
|
|
|
jobs:
|
|
laravel-tests:
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
mysql:
|
|
image: mysql:8.3
|
|
env:
|
|
MYSQL_DATABASE: testing
|
|
MYSQL_USER: user
|
|
MYSQL_PASSWORD: password
|
|
MYSQL_ROOT_PASSWORD: password
|
|
ports:
|
|
- 33306:3306
|
|
|
|
steps:
|
|
- name: Ready MySQL connection
|
|
run: |
|
|
apt-get update && apt-get install -qy libmcrypt-dev default-mysql-client
|
|
mysql --version
|
|
mysql --host mysql --port 3306 -uuser -ppassword -e "SHOW DATABASES"
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '8.3'
|
|
extensions: mbstring, dom, fileinfo
|
|
coverage: none
|
|
|
|
- name: Get Composer Cache Directory
|
|
id: composer-cache
|
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Cache composer 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 Composer Dependencies
|
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
|
|
|
- name: Get NPM Cache Directory
|
|
id: npm-cache
|
|
run: echo "NPM_CACHE_DIR=$(npm config get cache)" >> $GITHUB_ENV
|
|
|
|
- name: Cache NPM Dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ env.NPM_CACHE_DIR }}
|
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: ${{ runner.os }}-node-
|
|
|
|
- name: Install npm dependencies
|
|
run: npm ci
|
|
|
|
- name: Build Front-end Assets
|
|
run: npm run build
|
|
|
|
- name: Prepare Laravel Environment
|
|
run: |
|
|
php -r "file_exists('.env') || copy('.env.ci', '.env');"
|
|
php artisan key:generate
|
|
php artisan optimize
|
|
|
|
- name: Run Database Migrations
|
|
run: php artisan migrate
|
|
|
|
- name: Link Storage
|
|
run: php artisan storage:link
|
|
|
|
- name: Run Tests
|
|
run: php artisan test
|
|
|
|
- name: Display Laravel Log
|
|
if: failure()
|
|
run: cat storage/logs/laravel.log
|