Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 9 additions & 7 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
# Keep tests, CI and tooling out of the Composer dist.
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/.editorconfig export-ignore
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/pint.json export-ignore
/testbench.yaml export-ignore
/tests export-ignore
/.editorconfig export-ignore
/workbench export-ignore
/package.json export-ignore
/pnpm-lock.yaml export-ignore
/node_modules export-ignore
20 changes: 0 additions & 20 deletions .github/coverage.svg

This file was deleted.

92 changes: 0 additions & 92 deletions .github/workflows/run-tests.yml

This file was deleted.

239 changes: 239 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
name: tests

on:
push:
branches: [master, next-gen]
pull_request:
workflow_dispatch:

concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

env:
# the next-gen packages install from GitHub (VCS repositories)
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ github.token }}"}}'

jobs:
tests:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: ["8.4", "8.5"]
laravel: ["12.*", "13.*"]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: "12.*"
testbench: "10.*"
- laravel: "13.*"
testbench: "11.*"

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.stability }}

env:
COVERAGE: ${{ matrix.php == '8.4' && matrix.laravel == '13.*' && matrix.stability == 'prefer-stable' }}

steps:
- uses: actions/checkout@v5

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, pdo, sqlite, pdo_sqlite, zip, intl, gd, exif
coverage: ${{ env.COVERAGE == 'true' && 'xdebug' || 'none' }}

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer require "orchestra/testbench:${{ matrix.testbench }}" --dev --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: No javaabu/helpers or javaabu/settings v1 in production
run: |
if composer show --tree --no-dev | grep -E "javaabu/helpers|javaabu/settings (v)?1\."; then
echo "javaabu/helpers or javaabu/settings ^1 is a production dependency"
exit 1
fi

- name: Run tests
if: env.COVERAGE != 'true'
run: vendor/bin/phpunit

- name: Run tests with coverage
if: env.COVERAGE == 'true'
run: vendor/bin/phpunit --coverage-clover=clover.xml

- name: Upload coverage
if: env.COVERAGE == 'true'
uses: codecov/codecov-action@v5
with:
files: clover.xml
flags: php
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false

# Generate a whole admin into a Testbench app and run the generated code's own tests
- name: Generate into the integration app and run its tests
run: |
php workbench/build.php
vendor/bin/phpunit -c workbench/phpunit.generate.xml
vendor/bin/phpunit -c workbench/phpunit.xml
vendor/bin/pint --test --config pint.json build/app/app build/app/database/factories build/app/tests/Feature build/app/routes

databases:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
database: [mysql, mariadb, pgsql]

name: Schema on ${{ matrix.database }}

services:
mysql:
image: ${{ matrix.database == 'mysql' && 'mysql:8.4' || '' }}
env:
MYSQL_DATABASE: generators
MYSQL_ROOT_PASSWORD: secret
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
mariadb:
image: ${{ matrix.database == 'mariadb' && 'mariadb:11' || '' }}
env:
MARIADB_DATABASE: generators
MARIADB_ROOT_PASSWORD: secret
ports:
- 3307:3306
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=5
postgres:
image: ${{ matrix.database == 'pgsql' && 'postgres:17' || '' }}
env:
POSTGRES_DB: generators
POSTGRES_PASSWORD: secret
ports:
- 5432:5432
options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=5

steps:
- uses: actions/checkout@v5

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
extensions: mbstring, pdo, pdo_mysql, pdo_pgsql, sqlite, pdo_sqlite, zip, intl
coverage: none

- name: Install dependencies
run: composer update --prefer-dist --no-interaction

- name: Run tests
run: vendor/bin/phpunit
env:
DB_CONNECTION: ${{ matrix.database }}
DB_HOST: 127.0.0.1
DB_PORT: ${{ matrix.database == 'mysql' && '3306' || (matrix.database == 'mariadb' && '3307' || '5432') }}
DB_DATABASE: generators
DB_USERNAME: ${{ matrix.database == 'pgsql' && 'postgres' || 'root' }}
DB_PASSWORD: secret

without-translatable:
runs-on: ubuntu-latest

name: Without javaabu/translatable

steps:
- uses: actions/checkout@v5

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
extensions: mbstring, pdo, sqlite, pdo_sqlite, zip, intl, gd, exif
coverage: none

- name: Install dependencies without javaabu/translatable
run: |
composer remove --dev javaabu/translatable --no-interaction --no-update
composer update --prefer-dist --no-interaction

- name: Run tests
run: vendor/bin/phpunit

- name: Generate into the integration app and run its tests
run: |
php workbench/build.php
vendor/bin/phpunit -c workbench/phpunit.generate.xml
vendor/bin/phpunit -c workbench/phpunit.xml

react:
runs-on: ubuntu-latest

name: Generated React pages

steps:
- uses: actions/checkout@v5

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
extensions: mbstring, pdo, sqlite, pdo_sqlite, zip, intl, gd, exif
coverage: none

- name: Install Composer dependencies
run: composer update --prefer-dist --no-interaction

- uses: pnpm/action-setup@v4

# Keep the store out of pnpm's own node_modules/.bin, where @javaabu/forms'
# prepare build can't emit portable types (Javaabu/react-forms#20).
- name: Use a pnpm store outside node_modules
run: pnpm config set store-dir ~/.pnpm-store

- uses: actions/setup-node@v5
with:
node-version: 22
cache: pnpm

- name: Install npm dependencies
run: pnpm install --frozen-lockfile

- name: Generate into the integration app
run: |
php workbench/build.php
vendor/bin/phpunit -c workbench/phpunit.generate.xml

- name: Typecheck the generated pages
run: pnpm typecheck:app

- name: Check the generated pages' formatting
run: pnpm format:app

pint:
runs-on: ubuntu-latest

name: Pint

steps:
- uses: actions/checkout@v5

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
coverage: none

- name: Install dependencies
run: composer update --prefer-dist --no-interaction

- name: Check code style
run: vendor/bin/pint --test
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
build
/vendor
/node_modules
/build
/coverage
composer.lock
vendor
coverage
.phpunit.result.cache
.phpunit.cache
.php-cs-fixer.cache
.idea
.DS_Store
.env
clover.xml
Loading
Loading