Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
eclipxe13 committed Oct 18, 2024
0 parents commit a28fa00
Show file tree
Hide file tree
Showing 70 changed files with 4,523 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*
!bin/
!docs/
!src/
!composer.json
!Dockerfile
!Docker.README.md
!LICENSE
!README.md
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf

[**.{yml,yml.dist,neon,neon.dist}]
indent_size = 2

[**.{php,xml,yml,json,dist}]
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[**.md]
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = true
24 changes: 24 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Auto detect text files and perform LF normalization
* text=auto

# Do not put this files on a distribution package (by .gitignore)
/tools/ export-ignore
/vendor/ export-ignore
/composer.lock export-ignore

# Do not put this files on a distribution package
/.github/ export-ignore
/.phive/ export-ignore
/build/ export-ignore
/tests/ export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php-cs-fixer.dist.php export-ignore
/box.json.dist export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/rector.php export-ignore

# Do not count these files on github code language
/tests/_files/** linguist-detectable=false
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# see https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
/.github/* @phpcfdi/core-maintainers
124 changes: 124 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: build
on:
workflow_dispatch:
pull_request:
branches: [ "main" ]
push:
branches: [ "main" ]
schedule:
- cron: '0 16 * * 0' # sunday 16:00

# Actions
# shivammathur/setup-php@v2 https://github.com/marketplace/actions/setup-php-action

jobs:

composer-normalize:
name: Composer normalization
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: none
tools: composer-normalize
env:
fail-fast: true
- name: Composer normalize
run: composer-normalize

phpcs:
name: Code style (phpcs)
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: none
tools: cs2pr, phpcs
env:
fail-fast: true
- name: Code style (phpcs)
run: phpcs -q --report=checkstyle | cs2pr

php-cs-fixer:
name: Code style (php-cs-fixer)
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: none
tools: cs2pr, php-cs-fixer
env:
fail-fast: true
- name: Code style (php-cs-fixer)
run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr

phpstan:
name: Code analysis (phpstan)
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: none
tools: composer:v2, phpstan
env:
fail-fast: true
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: "${{ steps.composer-cache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "${{ runner.os }}-composer-"
- name: Install project dependencies
run: composer upgrade --no-interaction --no-progress --prefer-dist
- name: PHPStan
run: phpstan analyse --no-progress --verbose

tests:
name: Tests on PHP ${{ matrix.php-version }}
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version: ['8.2', '8.3']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none
tools: composer:v2
env:
fail-fast: true
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: "${{ steps.composer-cache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "${{ runner.os }}-composer-"
- name: Install project dependencies
run: composer upgrade --no-interaction --no-progress --prefer-dist
- name: Tests (phpunit)
run: vendor/bin/phpunit --testdox
35 changes: 35 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: docker
on:
workflow_dispatch:
release:
types: [ "published" ]

jobs:
docker:
name: Docker image
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set application version
run: sed -i "s#@box_git_version@#${{ github.ref_name }}#" bin/*.php
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: "${{ github.repository_owner }}/descarga-masiva"
tags: "type=semver,pattern={{version}}"
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
47 changes: 47 additions & 0 deletions .github/workflows/phar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: phar
on:
workflow_dispatch:
release:
types: [ "published" ]

# Actions
# shivammathur/setup-php@v2 https://github.com/marketplace/actions/setup-php-action
# softprops/action-gh-release@v2 https://github.com/softprops/action-gh-release

jobs:
phar:
name: Create PHAR
runs-on: "ubuntu-latest"
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2' # use lower compatible version
coverage: none
tools: composer:v2, box
env:
fail-fast: true
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: "${{ steps.composer-cache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "${{ runner.os }}-composer-"
- name: Install project dependencies
run: composer upgrade --no-interaction --no-progress --prefer-dist --no-dev
- name: Compile PHAR
run: box compile --verbose
- name: Show PHAR information
run: box info build/descarga-masiva.phar --list
- name: Publish release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.version }}
files: build/descarga-masiva.phar
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# do not include this files on git
/tools/
/vendor/
/composer.lock
9 changes: 9 additions & 0 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpcs" version="^3.10.3" installed="3.10.3" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^3.10.3" installed="3.10.3" location="./tools/phpcbf" copy="false"/>
<phar name="php-cs-fixer" version="^3.64.0" installed="3.64.0" location="./tools/php-cs-fixer" copy="false"/>
<phar name="phpstan" version="^1.12.6" installed="1.12.6" location="./tools/phpstan" copy="false"/>
<phar name="box-project/box" version="^4.6.1" installed="4.6.2" location="./tools/box" copy="false"/>
<phar name="composer-normalize" version="^2.44.0" installed="2.44.0" location="./tools/composer-normalize" copy="false"/>
</phive>
52 changes: 52 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

/**
* @noinspection PhpUndefinedClassInspection
* @noinspection PhpUndefinedNamespaceInspection
* @see https://cs.symfony.com/doc/ruleSets/
* @see https://cs.symfony.com/doc/rules/
*/

declare(strict_types=1);

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setCacheFile(__DIR__ . '/build/php-cs-fixer.cache')
->setRules([
'@PSR12' => true,
'@PSR12:risky' => true,
'@PHP71Migration:risky' => true,
'@PHP73Migration' => true,
// symfony
'class_attributes_separation' => true,
'whitespace_after_comma_in_array' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'type_declaration_spaces' => true,
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['arrays']],
'no_blank_lines_after_phpdoc' => true,
'object_operator_without_whitespace' => true,
'binary_operator_spaces' => true,
'phpdoc_scalar' => true,
'no_trailing_comma_in_singleline' => true,
'single_quote' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_unused_imports' => true,
'yoda_style' => ['equal' => true, 'identical' => true, 'less_and_greater' => null],
'standardize_not_equals' => true,
'concat_space' => ['spacing' => 'one'],
'linebreak_after_opening_tag' => true,
// symfony:risky
'no_alias_functions' => true,
'self_accessor' => true,
// contrib
'not_operator_with_successor_space' => true,
'ordered_imports' => ['imports_order' => ['class', 'function', 'const']], // @PSR12 sort_algorithm: none
])
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__)
->append([__FILE__])
->exclude(['tools', 'vendor', 'build', 'tests/_files'])
)
;
Loading

0 comments on commit a28fa00

Please sign in to comment.