Skip to content

feat: add automation, linting and improve DX #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 48 commits into
base: 2.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
2258e90
fix: .editorconfig
lotyp Mar 27, 2024
c8c6e57
feat: add .env file for local development and testing
lotyp Mar 27, 2024
35218e4
fix: production release should not contain development files
lotyp Mar 27, 2024
e963a39
feat: add pre-commit config file
lotyp Mar 27, 2024
fa62923
feat: add self-documenting Makefile and docker-compose for local dev …
lotyp Mar 27, 2024
cedd95e
docs: mention make commands in CONTRIBUTING.md
lotyp Mar 27, 2024
c3bdc70
feat!: bump minimal php version from 8.0 to 8.1
lotyp Mar 27, 2024
43b6b87
feat: add wayofdev/php-cs-fixer and roave/security-advisories
lotyp Mar 27, 2024
6e6a07c
feat: remove style-ci dependency
lotyp Mar 27, 2024
1a01cfb
chore: move CODE_OF_CONDUCT
lotyp Mar 27, 2024
397b07a
feat: add yamllint
lotyp Mar 27, 2024
8a7014f
chore: return back .styleci, as it bloats commits
lotyp Mar 27, 2024
2cbbff8
feat: add googleapis/release-please auto changelog generator configs
lotyp Mar 27, 2024
d8ae4ac
chore(feat/infra-dx-v2): release 3.0.0
lotyp Mar 27, 2024
9856508
docs: convert CHANGELOG.md to follow release-please format
lotyp Mar 27, 2024
ef9f758
feat: introduce .build directory to move various tool cache into one …
lotyp Mar 27, 2024
c4a6d3f
ci: add release-please github action
lotyp Mar 28, 2024
b7b65c5
ci: refactoring github actions
lotyp Mar 28, 2024
17aac80
style: lint composer.json using `composer normalize` command
lotyp Mar 28, 2024
d686f42
ci: fix target branch for new CI actions
lotyp Mar 28, 2024
66a618b
ci: run coverage against sqlite
lotyp Mar 28, 2024
5ff4a40
chore: trigger actions to check if composer cache works
lotyp Mar 28, 2024
99ca6a5
ci: add coding-standards job
lotyp Mar 28, 2024
ef18b28
ci: add static-analysis job
lotyp Mar 28, 2024
014fe00
ci: fix concurrency, set psalm format to github output
lotyp Mar 28, 2024
d4f889b
deps(composer): add psalm/plugin-phpunit dependency
lotyp Mar 28, 2024
3a70d7c
ci: add mutation-testing job
lotyp Mar 28, 2024
831fb04
ci: add action to test against pgsql
lotyp Mar 28, 2024
fa3c4d0
ci: fix version for php setup action
lotyp Mar 28, 2024
522cdca
fix: typo in gh-actions
lotyp Mar 28, 2024
7b555e8
ci: add postgres service as depdendency
lotyp Mar 28, 2024
edc3eb8
ci: run only postgres tests against pgsql integration
lotyp Mar 28, 2024
8ba7bcc
feat: add initial psalm baseline file
lotyp Mar 28, 2024
d421d64
ci: fix infection tests
lotyp Mar 28, 2024
93d2036
ci: fix mutation tests github action
lotyp Mar 28, 2024
ea07603
ci: add mysql integration action
lotyp Mar 28, 2024
822ca9b
chore: switch to latesst tag in mysql
lotyp Mar 28, 2024
1cf29cc
ci: fix mysql integration action
lotyp Mar 28, 2024
a428d00
ci: add sqlserver (mssql) action
lotyp Mar 28, 2024
2387dbb
ci: add pdo dependencies to php, increase sqlserver health-checks
lotyp Mar 28, 2024
7b5da77
ci: remove health-checks for sqlserver
lotyp Mar 28, 2024
d1c96e1
ci: fix password for SA account of mssql
lotyp Mar 28, 2024
6ec430e
feat: add security and dependency analysis
lotyp Mar 29, 2024
a5ad866
ci: coding standards improvements
lotyp Mar 29, 2024
1355dda
chore: remove unused classes
lotyp Mar 29, 2024
cdeceaa
fix: psalm errors
lotyp Mar 29, 2024
2d6b5b0
feat: make commit runs through docker now
lotyp Mar 31, 2024
bbeb2f2
chore: same pass for all dbs
lotyp Apr 1, 2024
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
2 changes: 2 additions & 0 deletions .build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
8 changes: 3 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false

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

[*.json]
indent_style = space
indent_size = 4
[Makefile]
indent_style = tab
21 changes: 21 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# https://docs.docker.com/compose/reference/envvars/#compose_project_name
# With custom namespace provided, it will be used to prefix all services
# in Docker network for current project
COMPOSE_PROJECT_NAME=cycle-database
APP_ENV=production

DB_CONNECTION=pgsql
DB_HOST=pgsql
DB_PORT=5432

DB_DATABASE=default
DB_USERNAME=root
DB_PASSWORD=Strong(!)Password

DB_SQLSERVER_FORWARD_PORT=11433
DB_MYSQL_FORWARD_PORT=13306
DB_PGSQL_FORWARD_PORT=15432

XDEBUG_MODE=coverage

GITHUB_TOKEN=ghp_
26 changes: 21 additions & 5 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
/.github export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/tests export-ignore
/.build export-ignore
/.github export-ignore
/.phive/ export-ignore
/tests export-ignore
.editorconfig export-ignore
.env.example export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php-cs-fixer.dist.php export-ignore
.pre-commit-config.yaml export-ignore
.scrutinizer.yml export-ignore
.styleci.yml export-ignore
.yamllint.yaml export-ignore
composer.lock export-ignore
composer-require-checker.json export-ignore
docker-compose.yaml export-ignore
infection.json.dist export-ignore
Makefile export-ignore
phpunit.xml export-ignore
psalm.xml export-ignore
psalm-baseline.xml export-ignore
72 changes: 72 additions & 0 deletions .github/.release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"release-type": "node",
"packages": {
".": {
"package-name": "database",
"changelog-path": "/CHANGELOG.md"
}
},
"include-component-in-tag": false,
"changelog-sections": [
{
"type": "feat",
"section": "Features",
"hidden": false
},
{
"type": "fix",
"section": "Bug Fixes",
"hidden": false
},
{
"type": "perf",
"section": "Performance Improvements",
"hidden": false
},
{
"type": "docs",
"section": "Documentation",
"hidden": false
},
{
"type": "chore",
"section": "Miscellaneous",
"hidden": false
},
{
"type": "style",
"section": "Styles",
"hidden": true
},
{
"type": "revert",
"section": "Reverts",
"hidden": true
},
{
"type": "deps",
"section": "Dependencies",
"hidden": false
},
{
"type": "refactor",
"section": "Code Refactoring",
"hidden": false
},
{
"type": "test",
"section": "Tests",
"hidden": true
},
{
"type": "build",
"section": "Build System",
"hidden": true
},
{
"type": "ci",
"section": "Continuous Integration",
"hidden": true
}
]
}
3 changes: 3 additions & 0 deletions .github/.release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "3.0.0"
}
File renamed without changes.
14 changes: 14 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---

# this file is for the labeler workflow job
# Documentation https://github.com/marketplace/actions/labeler

"type: documentation":
- changed-files:
- any-glob-to-any-file: [resources/*, .github/*, ./*.md]

"type: maintenance":
- changed-files:
- any-glob-to-any-file: [tests/**/*, .github/workflows/*]

...
23 changes: 23 additions & 0 deletions .github/workflows/apply-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---

# This workflow will triage pull requests and apply a label based on the
# paths that are modified in the pull request.
#
# To use this workflow, you will need to set up a .github/labeler.yml
# file with configuration. For more information, see:
# https://github.com/actions/labeler/blob/master/README.md

on: # yamllint disable-line rule:truthy
pull_request:

name: 🏷️ Add labels

jobs:
label:
uses: wayofdev/gh-actions/.github/workflows/apply-labels.yml@master
with:
os: ubuntu-latest
secrets:
token: ${{ secrets.GITHUB_TOKEN }}

...
124 changes: 57 additions & 67 deletions .github/workflows/ci-mssql.yml
Original file line number Diff line number Diff line change
@@ -1,88 +1,78 @@
on:
push:
---

on: # yamllint disable-line rule:truthy
pull_request:
branches:
- master
- '*.*'
- '*.*.*'
pull_request: null
- 2.x

name: ci-mssql
name: 🔍 Integration with SQLServer

jobs:
tests:
name: PHP ${{ matrix.php }}-mssql-${{ matrix.mssql }}

env:
key: cache

runs-on: ubuntu-latest

test-mssql:
timeout-minutes: 4
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
fail-fast: true
matrix:
include:
- php: '8.0'
extensions: pdo, pdo_sqlsrv
mssql: 'server:2017-latest'
- php: '8.0'
extensions: pdo, pdo_sqlsrv
mssql: 'server:2019-latest'
- php: '8.1'
extensions: pdo, pdo_sqlsrv
mssql: 'server:2019-latest'
- php: '8.2'
extensions: pdo, pdo_sqlsrv
mssql: 'server:2019-latest'
- php: '8.3'
extensions: pdo, pdo_sqlsrv
mssql: 'server:2019-latest'
os:
- 'ubuntu-latest'
php-version:
- '8.2'
dependencies:
- locked
mssql-version:
- latest

services:
mssql:
image: mcr.microsoft.com/mssql/${{ matrix.mssql }}
env:
SA_PASSWORD: SSpaSS__1
ACCEPT_EULA: Y
MSSQL_PID: Developer
ports:
- 11433:1433
options: --name=mssql --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'SSpaSS__1' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=3
image: mcr.microsoft.com/mssql/server:2019-latest
env:
ACCEPT_EULA: 'Y'
SA_PASSWORD: 'SSpaSS__1'
ports:
- 11433:1433

steps:
- name: Checkout
uses: actions/checkout@v2
- name: 📦 Check out the codebase
uses: actions/checkout@v4.1.1

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
- name: 🛠️ Setup PHP
uses: shivammathur/setup-php@2.30.1
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.extensions }}
ini-values: date.timezone='UTC'
tools: composer:v2, pecl
php-version: ${{ matrix.php-version }}
extensions: mbstring, pdo, pdo_sqlite, pdo_sqlsrv, json
ini-values: error_reporting=E_ALL
coverage: none

- name: Determine composer cache directory on Linux
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
- name: 🛠️ Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Cache dependencies installed with composer
uses: actions/cache@v2
- name: 🤖 Validate composer.json and composer.lock
run: composer validate --ansi --strict

- name: 🔍 Get composer cache directory
uses: wayofdev/gh-actions/actions/composer/get-cache-directory@master

- name: ♻️ Restore cached dependencies installed with composer
uses: actions/[email protected]
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php }}-composer-
key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}
restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-

- name: Update composer
run: composer self-update
- name: 🗑️ Remove PHP platform configuration
if: "matrix.dependencies != 'locked'"
run: composer config platform.php --ansi --unset

- name: Install dependencies with composer
if: matrix.php != '8.3'
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
- name: 📥 Install "${{ matrix.dependencies }}" dependencies
uses: wayofdev/gh-actions/actions/composer/install@master
with:
dependencies: ${{ matrix.dependencies }}

- name: Install dependencies with composer php 8.3
if: matrix.php == '8.3'
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
- name: 🧪 Run unit tests with phpunit
run: php vendor/bin/phpunit --colors=always --testsuite=Unit

- name: Run tests with phpunit without coverage
env:
DB: sqlserver
run: vendor/bin/phpunit --group driver-sqlserver --colors=always
- name: 🧪 Run integration tests with phpunit
run: php vendor/bin/phpunit --colors=always --testsuite=DBAL --group driver-sqlserver
Loading