Skip to content

Test PR with failing test #23

Test PR with failing test

Test PR with failing test #23

Workflow file for this run

name: Laravel
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
laravel-tests:
runs-on: ubuntu-latest
services:
postgres:
image: ankane/pgvector:latest
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: password
POSTGRES_DB: laravel_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
with:
php-version: '8.1'
extensions: pdo_pgsql
- uses: actions/checkout@v3
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Generate key
run: php artisan key:generate
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Install pgvector extension
run: PGPASSWORD=password psql -h localhost -U root -d laravel_test -c "CREATE EXTENSION IF NOT EXISTS vector;"
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install Front-End Dependencies with npm ci
run: npm ci
- name: Build Front-End Assets
run: npm run build
- name: Remove node_modules
run: rm -rf node_modules
- name: Execute tests (Unit and Feature tests) via PHPUnit
id: test_step
env:
DB_CONNECTION: pgsql
DB_HOST: localhost
DB_PORT: 5432
DB_DATABASE: laravel_test
DB_USERNAME: root
DB_PASSWORD: password
run: vendor/bin/pest
- name: Comment PR on Test Result
if: github.event_name == 'pull_request'
uses: actions/github-script@v5
with:
script: |
const testOutcome = '${{ steps.test_step.outcome }}';
const prNumber = context.issue.number;
const message = (testOutcome == 'success') ?
"✅ Tests passed!" :
`❌ Tests failed or were inconclusive. Outcome: ${testOutcome}. Check the logs for more details.`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: message
});
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}