Skip to content

Commit

Permalink
Merge pull request #10 from nick-potts/test_runner
Browse files Browse the repository at this point in the history
Add GitHub Test runner
  • Loading branch information
levydsa authored Jan 21, 2025
2 parents 4cb1f76 + f73dbff commit 87d2fc4
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 1 deletion.
60 changes: 60 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: run-tests

on:
push:
paths:
- "**.php"
- ".github/workflows/run_tests.yml"
- "phpunit.xml.dist"
- "composer.json"
- "composer.lock"
pull_request:
branches: [main]

jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.4, 8.3]
laravel: [11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 11.*
testbench: ^9.0
carbon: ^2.63

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run Turso Local Database
run: docker compose up -d

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: List Installed Dependencies
run: composer show -D

- name: Execute tests
run: vendor/bin/pest --ci
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services:
turso:
platform: linux/amd64
container_name: turso
restart: unless-stopped
image: "richan/turso-dev:latest"
environment:
- TURSO_DB_FILE=/var/lib/turso/turso.sqlite
ports:
- "8081:8080"
2 changes: 1 addition & 1 deletion tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ function clearDirectory(): void

function shouldSkipTests()
{
return true;
return false;
}

0 comments on commit 87d2fc4

Please sign in to comment.