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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,14 @@
/.scrutinizer.yml export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.github export-ignore
/pint.json export-ignore
/AGENTS.md export-ignore
/CLAUDE.md export-ignore
/package.json export-ignore
/pnpm-lock.yaml export-ignore
/tsconfig.json export-ignore
/vitest.config.ts export-ignore
/eslint.config.js export-ignore
/.prettierrc.json export-ignore
/.prettierignore export-ignore
20 changes: 0 additions & 20 deletions .github/coverage.svg

This file was deleted.

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

This file was deleted.

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

on:
push:
branches:
- main
- next-gen
pull_request:

# Unreleased javaabu/* dependencies come from VCS repositories; the job's own
# token keeps Composer within GitHub's API limits
env:
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:
- name: Checkout code
uses: actions/checkout@v5

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

- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"

- name: Cache Composer downloads
uses: actions/cache@v6
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ github.job }}-${{ strategy.job-index }}-${{ hashFiles('composer.json', 'composer.lock') }}
restore-keys: |
composer-${{ runner.os }}-${{ github.job }}-${{ strategy.job-index }}-
composer-${{ runner.os }}-${{ github.job }}-

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

- name: Execute tests
run: vendor/bin/phpunit ${{ env.COVERAGE == 'true' && '--coverage-clover=clover.xml' || '' }}

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

pint:
runs-on: ubuntu-latest

name: Pint

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

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

- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"

- name: Cache Composer downloads
uses: actions/cache@v6
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ github.job }}-${{ strategy.job-index }}-${{ hashFiles('composer.json', 'composer.lock') }}
restore-keys: |
composer-${{ runner.os }}-${{ github.job }}-${{ strategy.job-index }}-
composer-${{ runner.os }}-${{ github.job }}-

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

- name: Check code style
run: vendor/bin/pint --test

- name: No javaabu/settings or javaabu/helpers in production dependencies
run: |
if composer show --tree --no-dev | grep -E 'javaabu/(settings|helpers)'; then
echo "javaabu/translatable must not require javaabu/settings or javaabu/helpers (see #11)"
exit 1
fi

without-helpers:
runs-on: ubuntu-latest

name: Tests without javaabu/helpers

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv, intl
coverage: none

- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"

- name: Cache Composer downloads
uses: actions/cache@v6
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ github.job }}-${{ strategy.job-index }}-${{ hashFiles('composer.json', 'composer.lock') }}
restore-keys: |
composer-${{ runner.os }}-${{ github.job }}-${{ strategy.job-index }}-
composer-${{ runner.os }}-${{ github.job }}-

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

- name: Check javaabu/helpers isn't installed
run: "! composer show javaabu/helpers"

- name: Execute tests
run: vendor/bin/phpunit --exclude-group helpers

immutable-dates:
runs-on: ubuntu-latest

name: Tests with CarbonImmutable

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv, intl
coverage: none

- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"

- name: Cache Composer downloads
uses: actions/cache@v6
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ github.job }}-${{ strategy.job-index }}-${{ hashFiles('composer.json', 'composer.lock') }}
restore-keys: |
composer-${{ runner.os }}-${{ github.job }}-${{ strategy.job-index }}-
composer-${{ runner.os }}-${{ github.job }}-

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

# Laravel's starter kits call Date::use(CarbonImmutable::class) (#12)
- name: Execute tests with Date::use(CarbonImmutable::class)
run: vendor/bin/phpunit
env:
TRANSLATABLE_IMMUTABLE_DATES: 1

js:
runs-on: ubuntu-latest

name: React components

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

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node
uses: actions/setup-node@v5
with:
node-version: 22
package-manager-cache: false

# The default store is inside a node_modules folder, which breaks the declaration
# build of @javaabu/forms (installed from git and built on install)
- name: Install dependencies
run: pnpm install --frozen-lockfile --store-dir "$RUNNER_TEMP/pnpm-store"

- name: Lint
run: pnpm lint

- name: Check formatting
run: pnpm format:check

- name: Type check
run: pnpm typecheck

- name: Execute tests
run: pnpm test:coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: coverage/clover.xml
flags: js
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ build
composer.lock
vendor
coverage
clover.xml
node_modules
.phpunit.result.cache
.phpunit.cache
.php-cs-fixer.cache
.idea
35 changes: 0 additions & 35 deletions .php_cs.dist.php

This file was deleted.

3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vendor
node_modules
coverage
Loading
Loading