Files

320 lines
12 KiB
YAML

name: Tests
on:
push:
branches:
- v5.x
pull_request:
branches:
- "**v5.x**"
permissions:
contents: read
pull-requests: read
concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-24.04 # https://github.com/actions/runner-images
outputs:
php: ${{ steps.filter.outputs.php }}
js: ${{ steps.filter.outputs.js }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
with:
persist-credentials: false
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # https://github.com/dorny/paths-filter/releases/tag/v4.0.1
id: filter
with:
filters: |
workflows: &workflows
- '.github/workflows/**'
php:
- *workflows
- 'app/**'
- 'config/**'
- 'database/**'
- 'resources/views/**'
- 'routes/**'
- 'tests/**'
- 'composer.json'
- 'composer.lock'
- 'phpstan.neon'
- 'phpunit.xml'
- 'pint.json'
- 'rector.php'
js:
- *workflows
- 'resources/css/**'
- 'resources/js/**'
- 'templates/**'
- '**/*.md'
- '*.ts'
- '*.yaml'
- '*.yml'
- '.editorconfig'
- '.prettierignore'
- 'bun.lock'
- 'package.json'
- 'pint.json'
- 'tsconfig.json'
composer-validate:
needs: changes
if: ${{ needs.changes.outputs.php == 'true' }}
runs-on: ubuntu-24.04 # https://github.com/actions/runner-images
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
with:
persist-credentials: false
- uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # https://github.com/shivammathur/setup-php/releases/tag/2.37.0
with:
php-version: "8.5.4" # https://github.com/php/php-src/releases/tag/php-8.5.4
- run: composer validate --check-lock --strict
composer-audit:
needs: [changes, composer-validate]
runs-on: ubuntu-24.04 # https://github.com/actions/runner-images
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
with:
persist-credentials: false
- uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # https://github.com/shivammathur/setup-php/releases/tag/2.37.0
with:
php-version: "8.5.4" # https://github.com/php/php-src/releases/tag/php-8.5.4
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # https://github.com/actions/cache/releases/tag/v5.0.4
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}
- if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --no-progress --no-interaction
- run: composer audit --locked --abandoned=fail
php-refactor:
needs: [changes, composer-validate]
if: ${{ needs.changes.outputs.php == 'true' }}
runs-on: ubuntu-24.04 # https://github.com/actions/runner-images
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
with:
persist-credentials: false
- uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # https://github.com/shivammathur/setup-php/releases/tag/2.37.0
with:
php-version: "8.5.4" # https://github.com/php/php-src/releases/tag/php-8.5.4
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # https://github.com/actions/cache/releases/tag/v5.0.4
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}
- if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --no-progress --no-interaction
- run: composer test:refactor
php-format:
needs: [changes, composer-validate]
if: ${{ needs.changes.outputs.php == 'true' }}
runs-on: ubuntu-24.04 # https://github.com/actions/runner-images
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
with:
persist-credentials: false
- uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # https://github.com/shivammathur/setup-php/releases/tag/2.37.0
with:
php-version: "8.5.4" # https://github.com/php/php-src/releases/tag/php-8.5.4
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # https://github.com/actions/cache/releases/tag/v5.0.4
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}
- if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --no-progress --no-interaction
- run: composer test:format
php-lint:
needs: [changes, composer-validate]
if: ${{ needs.changes.outputs.php == 'true' }}
runs-on: ubuntu-24.04 # https://github.com/actions/runner-images
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
with:
persist-credentials: false
- uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # https://github.com/shivammathur/setup-php/releases/tag/2.37.0
with:
php-version: "8.5.4" # https://github.com/php/php-src/releases/tag/php-8.5.4
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # https://github.com/actions/cache/releases/tag/v5.0.4
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}
- if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --no-progress --no-interaction
- run: composer lint
php-test:
needs: [changes, composer-validate]
if: ${{ needs.changes.outputs.php == 'true' }}
runs-on: ubuntu-24.04 # https://github.com/actions/runner-images
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
with:
persist-credentials: false
- uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # https://github.com/shivammathur/setup-php/releases/tag/2.37.0
with:
php-version: "8.5.4" # https://github.com/php/php-src/releases/tag/php-8.5.4
coverage: xdebug-3.5.1 # https://github.com/xdebug/xdebug/releases/tag/3.5.1
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # https://github.com/actions/cache/releases/tag/v5.0.4
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}
- if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --no-progress --no-interaction
- run: composer test
php-type-coverage:
needs: [changes, composer-validate]
if: ${{ needs.changes.outputs.php == 'true' }}
runs-on: ubuntu-24.04 # https://github.com/actions/runner-images
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
with:
persist-credentials: false
- uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # https://github.com/shivammathur/setup-php/releases/tag/2.37.0
with:
php-version: "8.5.4" # https://github.com/php/php-src/releases/tag/php-8.5.4
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # https://github.com/actions/cache/releases/tag/v5.0.4
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}
- if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --no-progress --no-interaction
- run: composer test:type-coverage
bun-audit:
needs: changes
if: ${{ needs.changes.outputs.js == 'true' }}
runs-on: ubuntu-24.04 # https://github.com/actions/runner-images
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
with:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # https://github.com/oven-sh/setup-bun/releases/tag/v2.2.0
with:
bun-version: 1.3.11 # https://github.com/oven-sh/bun/releases/tag/bun-v1.3.11
- run: bun audit --frozen-lockfile
js-format:
needs: changes
if: ${{ needs.changes.outputs.js == 'true' }}
runs-on: ubuntu-24.04 # https://github.com/actions/runner-images
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
with:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # https://github.com/oven-sh/setup-bun/releases/tag/v2.2.0
with:
bun-version: 1.3.11 # https://github.com/oven-sh/bun/releases/tag/bun-v1.3.11
- name: Cache node_modules
id: bun-cache
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # https://github.com/actions/cache/releases/tag/v5.0.4
with:
path: node_modules
key: bun-${{ hashFiles('bun.lock') }}
- if: steps.bun-cache.outputs.cache-hit != 'true'
run: bun install --frozen-lockfile
- run: bun run test:format
js-lint:
needs: changes
if: ${{ needs.changes.outputs.js == 'true' }}
runs-on: ubuntu-24.04 # https://github.com/actions/runner-images
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
with:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # https://github.com/oven-sh/setup-bun/releases/tag/v2.2.0
with:
bun-version: 1.3.11 # https://github.com/oven-sh/bun/releases/tag/bun-v1.3.11
- name: Cache node_modules
id: bun-cache
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # https://github.com/actions/cache/releases/tag/v5.0.4
with:
path: node_modules
key: bun-${{ hashFiles('bun.lock') }}
- if: steps.bun-cache.outputs.cache-hit != 'true'
run: bun install --frozen-lockfile
- run: bun run test:lint
js-check:
needs: changes
if: ${{ needs.changes.outputs.js == 'true' }}
runs-on: ubuntu-24.04 # https://github.com/actions/runner-images
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
with:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # https://github.com/oven-sh/setup-bun/releases/tag/v2.2.0
with:
bun-version: 1.3.11 # https://github.com/oven-sh/bun/releases/tag/bun-v1.3.11
- name: Cache node_modules
id: bun-cache
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # https://github.com/actions/cache/releases/tag/v5.0.4
with:
path: node_modules
key: bun-${{ hashFiles('bun.lock') }}
- if: steps.bun-cache.outputs.cache-hit != 'true'
run: bun install --frozen-lockfile
- run: bun run check