122 lines
3.2 KiB
YAML
122 lines
3.2 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "*"
|
|
pull_request:
|
|
|
|
jobs:
|
|
build-npm:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: node:20-slim
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout.git@v4
|
|
- name: NPM install
|
|
run: npm install
|
|
- name: NPM run build
|
|
run: npm run build
|
|
- uses: https://gitea.com/actions/upload-artifact.git@v3
|
|
name: Upload resources
|
|
id: artifact-upload-step
|
|
with:
|
|
name: nodejs-artefacts
|
|
path: |
|
|
public/build/
|
|
|
|
tests:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: git.nanobyte.cz/ovlach-public/php-docker:php-fpm-dev-8.4.17-cad44e8
|
|
services:
|
|
postgresql-test:
|
|
image: postgres:17-alpine
|
|
env:
|
|
POSTGRES_DB: ecomail
|
|
POSTGRES_USER: laravel
|
|
POSTGRES_PASSWORD: laravel
|
|
options: >-
|
|
--health-cmd "pg_isready -U laravel -d ecomail"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
env:
|
|
APP_ENV: testing
|
|
APP_DEBUG: true
|
|
APP_KEY: base64:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
|
|
DB_CONNECTION: pgsql
|
|
DB_HOST: postgresql-test
|
|
DB_PORT: 5432
|
|
DB_DATABASE: ecomail
|
|
DB_USERNAME: laravel
|
|
DB_PASSWORD: laravel
|
|
DB_URL: pgsql://laravel:laravel@postgresql-test:5432/ecomail
|
|
CACHE_STORE: array
|
|
SESSION_DRIVER: array
|
|
QUEUE_CONNECTION: sync
|
|
MAIL_MAILER: array
|
|
|
|
needs:
|
|
- build-npm
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout.git@v4
|
|
|
|
- uses: https://gitea.com/actions/download-artifact.git@v3
|
|
id: artifact-download-step-resources
|
|
name: Download nodejs-artefacts
|
|
with:
|
|
name: nodejs-artefacts
|
|
path: public/build/
|
|
|
|
- name: Install dependencies
|
|
run: composer install --no-interaction --prefer-dist --no-progress
|
|
|
|
- name: Run migrations
|
|
run: php artisan migrate --force --no-interaction
|
|
|
|
- name: Run tests
|
|
run: php artisan test --compact
|
|
|
|
validate-composer:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: git.nanobyte.cz/ovlach-public/php-docker:php-fpm-dev-8.4.17-cad44e8
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout.git@v4
|
|
|
|
- name: Validate composer.json
|
|
run: composer validate --strict
|
|
|
|
phpcs:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: git.nanobyte.cz/ovlach-public/php-docker:php-fpm-dev-8.4.17-cad44e8
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout.git@v4
|
|
|
|
- name: Install dependencies
|
|
run: composer install --no-interaction --prefer-dist --no-progress
|
|
|
|
- name: Run PHPCS
|
|
run: vendor/bin/phpcs
|
|
|
|
phpstan:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: git.nanobyte.cz/ovlach-public/php-docker:php-fpm-dev-8.4.17-cad44e8
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout.git@v4
|
|
|
|
- name: Install dependencies
|
|
run: composer install --no-interaction --prefer-dist --no-progress
|
|
|
|
- name: Run PHPStan
|
|
run: vendor/bin/phpstan analyze --memory-limit=2G
|