Skip to content

Commit

Permalink
Merge branch 'release'
Browse files Browse the repository at this point in the history
  • Loading branch information
StulE-ru committed Aug 17, 2023
2 parents 4353cb4 + a3054fc commit 0514d54
Show file tree
Hide file tree
Showing 38 changed files with 3,014 additions and 840 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true

[*.yaml]
[*.{yaml,yml}]
indent_size = 2

[*.xml]
Expand Down
16 changes: 15 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,23 @@ APP_DIR=.

PHP_VERSION=8.1

MYSQL_VERSION=8.1.0
MYSQL_ROOT_PASSWORD=1111
MYSQL_HOST=mysql # Service name from docker-compose file
MYSQL_DATABASE=example_db
MYSQL_USERNAME=example_username
MYSQL_PASSWORD=example_password
MYSQL_CHARSET=utf8mb4

POSTGRES_VERSION=15.4
POSTGRES_HOST=postgres # Service name from docker-compose file
POSTGRES_DATABASE=example_db
POSTGRES_PASSWORD=example_username
POSTGRES_USERNAME=example_password

MARIADB_VERSION=10.5.19
MARIADB_ROOT_PASSWORD=1111
MARIADB_HOST=db # Service name from docker-compose file
MARIADB_HOST=mariadb # Service name from docker-compose file
MARIADB_DATABASE=example_db
MARIADB_USERNAME=example_username
MARIADB_PASSWORD=example_password
Expand Down
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
/phpstan-baseline.neon export-ignore
/phpstan.neon export-ignore
/phpunit.xml export-ignore
/psalm-baseline.xml export-ignore
/psalm.xml export-ignore
22 changes: 15 additions & 7 deletions .github/docker/Dockerfile → .github/docker/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ ARG PHP_VERSION

FROM php:${PHP_VERSION}-fpm-alpine

ARG WORKDIR=/var/www/data
ARG WORKDIR=/var/www

# Install xdebug pacakge
# Install xdebug package
RUN apk add --no-cache --update --virtual buildDeps \
autoconf \
make \
Expand All @@ -15,18 +15,26 @@ RUN apk add --no-cache --update --virtual buildDeps \
&& docker-php-ext-enable xdebug \
&& apk del buildDeps

# Install PDO for PostgreSQL
RUN apk --no-cache update \
&& apk add --no-cache autoconf g++ make \
postgresql-dev \
\
&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
\
&& docker-php-ext-install pdo_pgsql

# Install PDO for MySQL/MariaDB
RUN docker-php-ext-install pdo_mysql

# Clear cache
RUN rm -rf /tmp/pear \
&& rm -rf /var/cache/apk/*

COPY .github/docker/php/docker.conf /usr/local/etc/php-fpm.d/docker.conf

COPY .github/docker/php/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint
# Install composer
COPY --from=composer /usr/bin/composer /usr/bin/composer

ENTRYPOINT ["docker-entrypoint"]
COPY .github/docker/php/docker.conf /usr/local/etc/php-fpm.d/docker.conf

USER www-data

Expand Down
8 changes: 0 additions & 8 deletions .github/docker/php/docker-entrypoint.sh

This file was deleted.

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

on:
push:
branches:
- 'release'
- 'hotfix'

permissions:
contents: write

jobs:
php-cs-fixer:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: [8.1]

name: PHP-CS-FIXER ${{ matrix.php }}

steps:
- name: Code checkout
uses: actions/checkout@v3

- name: Get cache directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php }}-
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, libxml, mbstring
coverage: none

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

- name: Start PHP CS Fixer
run: composer csfix

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: php-cs-fixer
126 changes: 126 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
#
# We know this is bullshit, but right now we think it does not matter.
#

name: Tests

on:
push:
branches:
- 'release'
- 'hotfix'

permissions:
contents: read

jobs:
php-stan:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: [8.1]

name: PHP-STAN ${{ matrix.php }}

steps:
- name: Code checkout
uses: actions/checkout@v3

- name: Get cache directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php }}-
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, libxml, mbstring
coverage: none

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

- name: Srart PHP STAN
run: composer stan

database-tests:
name: Tests Database
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php: [8.1]
steps:
- name: Code checkout
uses: actions/checkout@v3

- name: Copy .env
run: cp .env.example .env

- name: Start docker-compose
uses: isbang/[email protected]
with:
compose-file: "./docker-compose.yaml"

- name: Get cache directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php }}-
- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist

- name: Exec unit tests
run: sleep 20;docker compose exec php "composer" "tests"

php-salm:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: [8.1]

name: PHP-PSalm ${{ matrix.php }}

steps:
- name: Code checkout
uses: actions/checkout@v3

- name: Get cache directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php }}-
- name: Install dependencies
run: composer install --no-interaction --no-progress --no-suggest --prefer-dist

- name: Srart PHP PSalm
run: composer salm
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
/.idea
/.vscode

#
# Analyzers
#

*-report.*

#
# Vendor
#
Expand Down
38 changes: 17 additions & 21 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
<?php

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = (new Finder())
->in(__DIR__)
->exclude([
'vendor',
]);

return (new Config())
->setFinder($finder)
return (new PhpCsFixer\Config)
->setRiskyAllowed(true)
->setRules([
// Symfony rulesets

'@Symfony' => true,
'@Symfony:risky' => true,

// PSR12 rulesets

'@PSR12:risky' => true,
'@PSR12' => true,

// Alias

Expand Down Expand Up @@ -44,20 +42,18 @@
'spacing' => 'one',
],
'heredoc_to_nowdoc' => true,
'no_unreachable_default_argument_value' => true,
'no_useless_return' => true,
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => [
'class',
'const',
'function',
],
],
'ternary_to_null_coalescing' => true,
'yoda_style' => [
'equal' => false,
'identical' => false,
'less_and_greater' => false,
],
]);
])
->setFinder(
(new PhpCsFixer\Finder())
->in(__DIR__)
->exclude([
'vendor',
])
);
Loading

0 comments on commit 0514d54

Please sign in to comment.