mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-13 04:30:41 -05:00
144 lines
3.8 KiB
YAML
144 lines
3.8 KiB
YAML
|
name: Forge CI
|
||
|
on: push
|
||
|
|
||
|
jobs:
|
||
|
laravel-tests:
|
||
|
runs-on: ubuntu-latest
|
||
|
|
||
|
services:
|
||
|
mysql:
|
||
|
image: mysql:latest
|
||
|
env:
|
||
|
MYSQL_ROOT_PASSWORD: mysql
|
||
|
MYSQL_DATABASE: test
|
||
|
MYSQL_USER: mysql
|
||
|
MYSQL_PASSWORD: mysql
|
||
|
ports:
|
||
|
- 3306:3306
|
||
|
options: >-
|
||
|
--health-cmd="mysqladmin ping --silent"
|
||
|
--health-interval=10s
|
||
|
--health-timeout=5s
|
||
|
--health-retries=5
|
||
|
|
||
|
steps:
|
||
|
- uses: actions/checkout@v4
|
||
|
|
||
|
- name: Setup Node.js
|
||
|
uses: actions/setup-node@v4
|
||
|
with:
|
||
|
node-version: '20.x'
|
||
|
|
||
|
- name: Cache NPM
|
||
|
uses: actions/cache@v3
|
||
|
with:
|
||
|
path: ~/.npm
|
||
|
key: ${{ runner.os }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
|
||
|
restore-keys: |
|
||
|
${{ runner.os }}-npm-cache-
|
||
|
|
||
|
- name: Install NPM Packages
|
||
|
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: Get Composer Cache Directory
|
||
|
id: composer-cache
|
||
|
run: echo "composer_cache_dir=$(composer config cache-files-dir)" >> $GITHUB_ENV
|
||
|
|
||
|
- name: Cache Composer Dependencies
|
||
|
uses: actions/cache@v3
|
||
|
with:
|
||
|
path: ${{ env.composer_cache_dir }}
|
||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||
|
restore-keys: |
|
||
|
${{ runner.os }}-composer-
|
||
|
|
||
|
- name: Install Composer Dependencies
|
||
|
run: composer install -n --prefer-dist
|
||
|
|
||
|
- name: Prepare Laravel Application
|
||
|
run: |
|
||
|
cp .env.ci .env
|
||
|
php artisan key:generate
|
||
|
|
||
|
- name: Set Application Cache Directory Permissions
|
||
|
run: chmod -R 777 storage bootstrap/cache
|
||
|
|
||
|
- name: Run Database Migrations
|
||
|
env:
|
||
|
DB_CONNECTION: mysql
|
||
|
DB_DATABASE: test
|
||
|
DB_PORT: 3306
|
||
|
DB_USERNAME: mysql
|
||
|
DB_PASSWORD: mysql
|
||
|
run: php artisan migrate
|
||
|
|
||
|
- name: Execute Unit and Feature Tests
|
||
|
env:
|
||
|
DB_CONNECTION: mysql
|
||
|
DB_DATABASE: test
|
||
|
DB_PORT: 3306
|
||
|
DB_USERNAME: mysql
|
||
|
DB_PASSWORD: mysql
|
||
|
run: vendor/bin/pest
|
||
|
|
||
|
- name: Upload App Logs
|
||
|
if: failure()
|
||
|
uses: actions/upload-artifact@v2
|
||
|
with:
|
||
|
name: app
|
||
|
path: storage/logs
|
||
|
|
||
|
security-check:
|
||
|
runs-on: ubuntu-latest
|
||
|
|
||
|
steps:
|
||
|
- name: Checkout Code
|
||
|
uses: actions/checkout@v4
|
||
|
|
||
|
- name: Security Checker
|
||
|
uses: symfonycorp/security-checker-action@v5
|
||
|
|
||
|
larastan:
|
||
|
runs-on: ubuntu-latest
|
||
|
|
||
|
steps:
|
||
|
- name: Checkout Code
|
||
|
uses: actions/checkout@v4
|
||
|
|
||
|
- 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: Get Composer Cache Directory
|
||
|
id: composer-cache
|
||
|
run: echo "composer_cache_dir=$(composer config cache-files-dir)" >> $GITHUB_ENV
|
||
|
|
||
|
- name: Cache Composer Dependencies
|
||
|
uses: actions/cache@v3
|
||
|
with:
|
||
|
path: ${{ env.composer_cache_dir }}
|
||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||
|
restore-keys: |
|
||
|
${{ runner.os }}-composer-
|
||
|
|
||
|
- name: Install Composer Dependencies
|
||
|
run: composer install -n --no-dev --prefer-dist
|
||
|
|
||
|
- name: Execute Code Static Analysis with Larastan
|
||
|
run: |
|
||
|
composer require --dev nunomaduro/larastan
|
||
|
vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress
|