Separates Test and Quality Workflows

This commit is contained in:
Refringe 2024-06-18 16:18:27 -04:00
parent fcf13792ef
commit bc03287949
Signed by: Refringe
SSH Key Fingerprint: SHA256:t865XsQpfTeqPRBMN2G6+N8wlDjkgUCZF3WGW6O9N/k
3 changed files with 70 additions and 65 deletions

3
.github/README.md vendored
View File

@ -2,7 +2,8 @@
<h1 align="center"><em>The Forge</em></h1>
<p align="center">
<a href="https://www.mozilla.org/en-US/MPL/2.0/"><img src="https://img.shields.io/badge/License-MPL_2.0-blue.svg" alt="License: MPL 2.0"></a>
<a href="https://github.com/sp-tarkov/forge/actions"><img src="https://github.com/sp-tarkov/forge/workflows/general/badge.svg" alt="Actions Status"></a>
<a href="https://github.com/sp-tarkov/forge/actions/workflows/quality.yaml"><img src="https://github.com/sp-tarkov/forge/actions/workflows/quality.yaml/badge.svg" alt="Quality Control Action Status"></a>
<a href="https://github.com/sp-tarkov/forge/actions/workflows/tests.yaml"><img src="https://github.com/sp-tarkov/forge/actions/workflows/tests.yaml/badge.svg" alt="Test Action Status"></a>
<a href="https://discord.com/invite/Xn9msqQZan"><img src="https://img.shields.io/badge/Chat-Discord-5865F2?logo=discord&logoColor=ffffff" alt="Discord Chat"></a>
<a href="https://www.patreon.com/sptarkov"><img src="https://img.shields.io/badge/Fund-Patreon-fe3c71?logo=patreon&logoColor=ffffff" alt="Patreon Fund"></a>
</p>

View File

@ -1,4 +1,4 @@
name: General Workflow
name: Quality
on: [ push, pull_request ]
@ -96,66 +96,3 @@ jobs:
commit_user_name: Pint Bot
skip_fetch: true
file_pattern: '*.php'
laravel-tests:
runs-on: ubuntu-24.04
services:
mysql:
image: mysql:8.3
env:
MYSQL_DATABASE: testing
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: password
ports:
- 33306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- 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: 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
- 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 "::set-output name=dir::$(npm config get cache)"
- name: Cache NPM Dependencies
uses: actions/cache@v4
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Install npm dependencies
run: npm ci
- name: Prepare Laravel Environment
run: |
php -r "file_exists('.env') || copy('.env.ci', '.env');"
php artisan key:generate
php artisan config:cache
php artisan route:cache
- name: Run Database Migrations
run: php artisan migrate
- name: Link Storage
run: php artisan storage:link
- name: Run Tests
run: php artisan test

67
.github/workflows/tests.yaml vendored Normal file
View File

@ -0,0 +1,67 @@
name: Tests
on: [ push, pull_request ]
jobs:
laravel-tests:
runs-on: ubuntu-24.04
services:
mysql:
image: mysql:8.3
env:
MYSQL_DATABASE: testing
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: password
ports:
- 33306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- 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: 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
- 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 "::set-output name=dir::$(npm config get cache)"
- name: Cache NPM Dependencies
uses: actions/cache@v4
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Install npm dependencies
run: npm ci
- name: Prepare Laravel Environment
run: |
php -r "file_exists('.env') || copy('.env.ci', '.env');"
php artisan key:generate
php artisan config:cache
php artisan route:cache
- name: Run Database Migrations
run: php artisan migrate
- name: Link Storage
run: php artisan storage:link
- name: Run Tests
run: php artisan test