The project's test strategy is backend + e2e only, so drop the Vitest setup that had been added for the crop math: the imageCrop.test.ts suite, vitest.config.ts, the dependency and test:unit script, the CI step, and the test:all reference. The crop math is exercised through the Pest browser test.
135 lines
3.3 KiB
YAML
135 lines
3.3 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches: [main, develop]
|
|
pull_request:
|
|
branches: [main, develop]
|
|
|
|
env:
|
|
DB_CONNECTION: pgsql
|
|
DB_DATABASE: trypost_test
|
|
DB_USERNAME: postgres
|
|
DB_PASSWORD: password
|
|
BROADCAST_CONNECTION: "null"
|
|
CACHE_STORE: array
|
|
QUEUE_CONNECTION: sync
|
|
SESSION_DRIVER: array
|
|
|
|
jobs:
|
|
backend:
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: password
|
|
POSTGRES_DB: trypost_test
|
|
ports:
|
|
- 5432/tcp
|
|
options: >-
|
|
--health-cmd="pg_isready"
|
|
--health-interval=10s
|
|
--health-timeout=5s
|
|
--health-retries=3
|
|
|
|
redis:
|
|
image: redis:7
|
|
ports:
|
|
- 6379/tcp
|
|
options: >-
|
|
--health-cmd="redis-cli ping"
|
|
--health-interval=10s
|
|
--health-timeout=5s
|
|
--health-retries=3
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Setup test environment
|
|
uses: ./.github/actions/setup-laravel
|
|
with:
|
|
db-port: ${{ job.services.postgres.ports['5432'] }}
|
|
redis-port: ${{ job.services.redis.ports['6379'] }}
|
|
|
|
- name: Run backend tests
|
|
env:
|
|
DB_PORT: ${{ job.services.postgres.ports['5432'] }}
|
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
|
run: php artisan test --compact --parallel
|
|
|
|
e2e:
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
shard: [1, 2]
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: password
|
|
POSTGRES_DB: trypost_test
|
|
ports:
|
|
- 5432/tcp
|
|
options: >-
|
|
--health-cmd="pg_isready"
|
|
--health-interval=10s
|
|
--health-timeout=5s
|
|
--health-retries=3
|
|
|
|
redis:
|
|
image: redis:7
|
|
ports:
|
|
- 6379/tcp
|
|
options: >-
|
|
--health-cmd="redis-cli ping"
|
|
--health-interval=10s
|
|
--health-timeout=5s
|
|
--health-retries=3
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Setup test environment
|
|
uses: ./.github/actions/setup-laravel
|
|
with:
|
|
node: 'true'
|
|
db-port: ${{ job.services.postgres.ports['5432'] }}
|
|
redis-port: ${{ job.services.redis.ports['6379'] }}
|
|
|
|
- name: Build assets
|
|
run: npm run build
|
|
|
|
- name: Install Playwright browsers
|
|
run: npx playwright install --with-deps chromium
|
|
|
|
- name: Run browser tests
|
|
env:
|
|
DB_PORT: ${{ job.services.postgres.ports['5432'] }}
|
|
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
|
|
run: php artisan test tests/Browser --compact --shard=${{ matrix.shard }}/2
|
|
|
|
- name: Upload Playwright artifacts
|
|
if: failure()
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: playwright-artifacts-${{ matrix.shard }}
|
|
path: tests/Browser/Screenshots
|
|
if-no-files-found: ignore
|
|
retention-days: 7
|
|
|
|
e2e-gate:
|
|
if: always()
|
|
needs: e2e
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Require all e2e shards to pass
|
|
run: '[ "${{ needs.e2e.result }}" = "success" ] || exit 1'
|