mirror of
https://github.com/ivuorinen/.github.git
synced 2026-02-08 14:45:07 +00:00
66 lines
1.8 KiB
YAML
66 lines
1.8 KiB
YAML
---
|
|
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
|
name: Laravel Setup and Composer test
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: read
|
|
statuses: read
|
|
|
|
jobs:
|
|
laravel-tests:
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
contents: write
|
|
packages: read
|
|
statuses: write
|
|
|
|
steps:
|
|
- uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2
|
|
with:
|
|
php-version: "8.3"
|
|
|
|
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
|
|
|
- name: "Check file existence"
|
|
id: check_files
|
|
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3
|
|
with:
|
|
files: "package.json, artisan"
|
|
|
|
- name: Copy .env
|
|
if: steps.check_files.outputs.files_exists == 'true'
|
|
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
|
|
|
- name: Install Dependencies
|
|
if: steps.check_files.outputs.files_exists == 'true'
|
|
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
|
|
|
|
- name: Generate key
|
|
if: steps.check_files.outputs.files_exists == 'true'
|
|
run: php artisan key:generate
|
|
|
|
- name: Directory Permissions
|
|
if: steps.check_files.outputs.files_exists == 'true'
|
|
run: chmod -R 777 storage bootstrap/cache
|
|
|
|
- name: Create Database
|
|
if: steps.check_files.outputs.files_exists == 'true'
|
|
run: |
|
|
mkdir -p database
|
|
touch database/database.sqlite
|
|
|
|
- name: Execute composer test (Unit and Feature tests)
|
|
if: steps.check_files.outputs.files_exists == 'true'
|
|
env:
|
|
DB_CONNECTION: sqlite
|
|
DB_DATABASE: database/database.sqlite
|
|
run: composer test
|