Skip to content

Commit

Permalink
🎉 first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
GautierDele committed Oct 24, 2024
0 parents commit 1075173
Show file tree
Hide file tree
Showing 9 changed files with 182 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/packagist-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Packagist Deploy

on:
release:
types: [created]

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4
- uses: mnavarrocarter/[email protected]
with:
username: "GautierDele"
api_token: ${{ secrets.PACKAGIST_TOKEN }}
48 changes: 48 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php-version: [ '8.3', '8.4' ]

name: Tests on PHP ${{ matrix.php-version }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none

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

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php-version }}-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer i --prefer-dist --no-progress

- name: Run test suite
run: vendor/bin/phpunit
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/vendor
composer.lock
.phpunit*
.idea
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM php:latest

RUN apt update
RUN apt install unzip curl -y

RUN curl -sS https://getcomposer.org/installer -o /usr/local/composer-setup.php

RUN php /usr/local/composer-setup.php --install-dir=/usr/local/bin --filename=composer

RUN rm /usr/local/composer-setup.php
44 changes: 44 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "xefi/faker-php-files",
"type": "library",
"description": "Faker extension to generate files",
"keywords": [
"faker",
"file",
"image"
],
"license": "MIT",
"authors": [
{
"name": "Gautier Deleglise"
}
],
"require": {
"php": "^8.3",
"psr/container": "^2.0",
"xefi/faker-php": "^0"
},
"require-dev": {
"phpunit/phpunit": "^11"
},
"autoload": {
"psr-4": {
"Xefi\\Faker\\Files\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Xefi\\Faker\\Files\\Tests\\": "tests/"
}
},
"config": {
"sort-packages": true
},
"extra": {
"faker": {
"providers": [
"Xefi\\Faker\\Files\\FakerFilesServiceProvider"
]
}
}
}
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
php:
build: .
image: php:latest
volumes:
- ./:/var/www/html
working_dir: /var/www/html
tty: true
22 changes: 22 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
backupStaticProperties="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>src</directory>
</include>
</source>
<php>
</php>
</phpunit>
10 changes: 10 additions & 0 deletions src/Extensions/ImagesExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Xefi\Faker\Files\Extensions;

class ImagesExtension
{
public function image() {

}
}
16 changes: 16 additions & 0 deletions src/FakerFilesServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
namespace Xefi\Faker\Files;

use Xefi\Faker\Files\Extensions\ImagesExtension;
use Xefi\Faker\Providers\Provider;

class FakerFilesServiceProvider extends Provider
{
public function boot(): void
{
$this->extensions([
ImagesExtension::class
]);
}

}

0 comments on commit 1075173

Please sign in to comment.