Skip to content

Commit

Permalink
build: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi committed Jun 17, 2024
0 parents commit 6c03986
Show file tree
Hide file tree
Showing 41 changed files with 2,235 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "composer" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

on:
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
test:

runs-on: ${{ matrix.operating-system }}

strategy:
matrix:
operating-system: [ubuntu-latest]
php: [ '8.2', '8.3' ]
dep: [highest,lowest]

name: ${{ matrix.dep }} deps, PHP ${{ matrix.php }}, ${{ matrix.operating-system }}

steps:
- uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: intl
tools: flex

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dep }}
composer-options: --prefer-dist --no-progress --no-scripts

- name: Run psalm
run: vendor/bin/psalm
if: matrix.dep == 'highest' && matrix.symfony == '7.*'

- name: Run phpstan
run: vendor/bin/phpstan analyse
if: matrix.dep == 'highest' && matrix.symfony == '7.*'

- name: Validate monorepo
run: vendor/bin/monorepo-builder validate

- name: Run phpunit
run: |
vendor/bin/phpunit
64 changes: 64 additions & 0 deletions .github/workflows/split.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: 'Packages Split'

on:
workflow_dispatch: null
push:
branches:
- main
tags:
- '*'

env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}

jobs:
packages_split:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
name:
- collections-domain

steps:
- uses: actions/checkout@v2

# no tag
-
if: "!startsWith(github.ref, 'refs/tags/')"
uses: "danharrin/monorepo-split-github-action@v2.3.0"
with:
package_directory: 'packages/${{ matrix.name }}'

# ↓ into https://github.com/symplify/easy-coding-standard repository
repository_organization: 'rekalogika'
repository_name: '${{ matrix.name }}'

# [optional, with "github.com" as default]
repository_host: github.com

# ↓ the user signed under the split commit
user_name: "Priyadi Iman Nurcahyo"
user_email: "1102197+priyadi@users.noreply.github.com"

# with tag
-
if: "startsWith(github.ref, 'refs/tags/')"
uses: "danharrin/monorepo-split-github-action@v2.3.0"
with:
tag: ${GITHUB_REF#refs/tags/}

# ↓ split "packages/easy-coding-standard" directory
package_directory: 'packages/${{ matrix.name }}'

# ↓ into https://github.com/symplify/easy-coding-standard repository
repository_organization: 'rekalogika'
repository_name: '${{ matrix.name }}'

# [optional, with "github.com" as default]
repository_host: github.com

# ↓ the user signed under the split commit
user_name: "Priyadi Iman Nurcahyo"
user_email: "1102197+priyadi@users.noreply.github.com"
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
composer.lock
vendor
.phpunit.cache
var
tools
.php-cs-fixer.cache
.vscode
4 changes: 4 additions & 0 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-cs-fixer" version="^3.42.0" installed="3.42.0" location="./tools/php-cs-fixer" copy="false"/>
</phive>
44 changes: 44 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/packages')
->in(__DIR__ . '/tests')
;

$config = new PhpCsFixer\Config();
return $config->setRules([
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],

// imports
'fully_qualified_strict_types' => true,
'global_namespace_import' => [
'import_classes' => false,
'import_constants' => false,
'import_functions' => false,
],
'no_leading_import_slash' => true,
'no_unneeded_import_alias' => true,
'no_unused_imports' => true,
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => ['const', 'class', 'function']
],
'single_line_after_imports' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'declare_strict_types' => true,
'native_function_invocation' => ['include' => ['@compiler_optimized']],
'header_comment' => [
'header' => <<<EOF
This file is part of rekalogika/collections package.
(c) Priyadi Iman Nurcahyo <https://rekalogika.dev>
For the full copyright and license information, please view the LICENSE file
that was distributed with this source code.
EOF,
]
])
->setFinder($finder)
;
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 0.5.0

* build: initial commit
18 changes: 18 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Copyright (c) 2024-present Priyadi Iman Nurcahyo

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38 changes: 38 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
PHP=php
COMPOSER=composer

.PHONY: test
test: composer-dump phpstan psalm phpunit

.PHONY: composer-dump
composer-dump:
$(COMPOSER) dump-autoload

.PHONY: phpstan
phpstan:
$(PHP) vendor/bin/phpstan analyse

.PHONY: psalm
psalm:
$(PHP) vendor/bin/psalm

.PHONY: phpunit
phpunit:
$(eval c ?=)
$(PHP) vendor/bin/phpunit $(c)

.PHONY: php-cs-fixer
php-cs-fixer: tools/php-cs-fixer
$(PHP) $< fix --config=.php-cs-fixer.dist.php --verbose --allow-risky=yes

.PHONY: tools/php-cs-fixer
tools/php-cs-fixer:
phive install php-cs-fixer

.PHONY: clean
clean:
$(PHP) vendor/bin/psalm --clear-cache

.PHONY: merge
monorepo-merge:
$(PHP) vendor/bin/monorepo-builder merge
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Rekalogika Collections

TBD

## Documentation

TBD

## License

MIT
44 changes: 44 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "rekalogika/collections",
"description": "Improves the usage of Doctrine Collections in your applications.",
"license": "MIT",
"type": "library",
"authors": [
{
"name": "Priyadi Iman Nurcahyo",
"email": "priyadi@rekalogika.com"
}
],
"autoload": {
"psr-4": {
"Rekalogika\\Domain\\Collections\\": "packages/collections-domain/src/"
}
},
"autoload-dev": {
"psr-4": {
"Doctrine\\Tests\\Common\\Collections\\": "tests/DoctrineCollections/",
"Rekalogika\\Collections\\Tests\\": "tests/Collections/"
}
},
"require": {
"doctrine/collections": "^2.2.2 || ^2.3",
"php": "^8.2",
"rekalogika/rekapager-contracts": "^0.11",
"rekalogika/rekapager-doctrine-collections-adapter": "^0.11",
"rekalogika/rekapager-keyset-pagination": "^0.11"
},
"require-dev": {
"ekino/phpstan-banned-code": "^1.0",
"phpstan/phpstan": "^1.10.66 || ^1.11",
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpstan/phpstan-phpunit": "^1.3",
"phpunit/phpunit": "^10.1",
"psalm/plugin-phpunit": "^0.18.4",
"symfony/var-dumper": "^7.1",
"symplify/monorepo-builder": "^11.2.20 || ^11.3",
"vimeo/psalm": "^5.15"
},
"replace": {
"rekalogika/collections-domain": "self.version"
}
}
20 changes: 20 additions & 0 deletions monorepo-builder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

use Symplify\MonorepoBuilder\Config\MBConfig;
use Symplify\MonorepoBuilder\Release\ReleaseWorker\SetCurrentMutualDependenciesReleaseWorker;
use Symplify\MonorepoBuilder\Release\ReleaseWorker\UpdateBranchAliasReleaseWorker;
use Symplify\MonorepoBuilder\Release\ReleaseWorker\UpdateReplaceReleaseWorker;

return static function (MBConfig $mbConfig): void {
$mbConfig->packageDirectories([__DIR__ . '/packages']);
$mbConfig->defaultBranch('main');
$mbConfig->disableDefaultWorkers();

$mbConfig->workers([
UpdateReplaceReleaseWorker::class,
SetCurrentMutualDependenciesReleaseWorker::class,
UpdateBranchAliasReleaseWorker::class,
]);
};
18 changes: 18 additions & 0 deletions packages/collections-domain/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Copyright (c) 2024-present Priyadi Iman Nurcahyo

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11 changes: 11 additions & 0 deletions packages/collections-domain/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Rekalogika Collections Domain

TBD

## Documentation

TBD

## License

MIT
Loading

0 comments on commit 6c03986

Please sign in to comment.