Skip to content

Commit ebabddf

Browse files
committed
Dockerized for easy testing
1 parent d1c082c commit ebabddf

14 files changed

+155
-30
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ sample.json
66
sample.xml
77
valid_test.json
88
valid_test.xml
9+
.phpunit.result.cache

.php-cs-fixer.dist.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->exclude([
5+
'vendor',
6+
])
7+
->in(__DIR__)
8+
;
9+
10+
$config = new PhpCsFixer\Config();
11+
12+
return $config->setRiskyAllowed(true)
13+
->setRules([
14+
'@Symfony' => true,
15+
'concat_space' => ['spacing' => 'one'],
16+
'ordered_imports' => ['sort_algorithm' => 'alpha'],
17+
])
18+
->setFinder($finder)
19+
->setUsingCache(false);
20+

.php_cs.dist

Lines changed: 0 additions & 18 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ install:
1414
- composer install --no-interaction
1515

1616
script:
17-
- composer lint
1817
- composer test
1918

2019
after_success:

Makefile

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
UID ?= $(shell id -u)
2+
GID ?= $(shell id -g)
3+
4+
help:
5+
@echo "\e[32m Usage make [target] "
6+
@echo
7+
@echo "\e[1m targets:"
8+
@egrep '^(.+)\:\ ##\ (.+)' ${MAKEFILE_LIST} | column -t -c 2 -s ':#'
9+
10+
clean: ## Clean everything
11+
clean: clean-docker clean-logs clean-cache clean-dependencies
12+
.PHONY: clean
13+
14+
clean-docker: ## Remove images, volumes, containers
15+
# Not implemented
16+
.PHONY: clean-docker
17+
18+
clean-logs: ## Clean all log files
19+
# Not implemented
20+
.PHONY: clean-logs
21+
22+
clean-cache: ## Clean local caches
23+
# Not implemented
24+
.PHONY: clean-cache
25+
26+
clean-dependencies: ## Clean dev dependencies
27+
# Not implemented
28+
.PHONY: clean-dependencies
29+
30+
build-php7: ## Build PHP7 container
31+
# Hint: force a rebuild by passing --no-cache
32+
@UID=$(UID) GID=$(GID) docker-compose build --no-cache php7
33+
.PHONY: install-web
34+
35+
stop: ## Stop running containers
36+
@UID=$(UID) GID=$(GID) docker-compose stop
37+
.PHONY: stop
38+
39+
shell-php7: ## Start an interactive shell session for PHP7 container
40+
# Hint: adjust UID and GID to 0 if you want to use the shell as root
41+
@UID=$(UID) GID=$(GID) docker-compose run --rm -w /var/www/html -e SHELL_VERBOSITY=1 php7 bash
42+
.PHONY: shell
43+
44+
test: ## Run all unit tests
45+
test: php7-tests
46+
.PHONY: test
47+
48+
test-php7: ## Run php unit tests
49+
# Not implemented
50+
.PHONY: php7-tests
51+
52+
watch-logs: ## Open a tail on all the logs
53+
@UID=$(UID) GID=$(GID) docker-compose logs -f -t
54+
.PHONY: watch-logs
55+
56+
.DEFAULT_GOAL := help

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Build Status](https://travis-ci.org/hoshomoh/CSVUtils.svg?branch=master)](https://travis-ci.org/hoshomoh/CSVUtils)
1+
[![Build Status](https://travis-ci.com/hoshomoh/CSVUtils.svg?branch=master)](https://travis-ci.org/hoshomoh/CSVUtils)
22
[![codecov](https://codecov.io/gh/hoshomoh/CSVUtils/branch/master/graph/badge.svg)](https://codecov.io/gh/hoshomoh/CSVUtils)
33

44
# CSVUtils

composer.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"ext-dom": "*"
2020
},
2121
"require-dev": {
22-
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.0",
23-
"friendsofphp/php-cs-fixer": "^2.13@dev"
22+
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.0 || ^8.0",
23+
"friendsofphp/php-cs-fixer": "^2.19"
2424
},
2525
"autoload": {
2626
"psr-4": {
@@ -34,16 +34,17 @@
3434
},
3535
"scripts": {
3636
"phpunit": "phpunit",
37-
"php-cs-fixer-check": "php-cs-fixer fix --config=.php_cs.dist -v --dry-run --stop-on-violation --using-cache=no",
38-
"php-cs-fixer": "php-cs-fixer fix --config=.php_cs.dist -v --using-cache=no",
39-
"lint": [
37+
"php-cs-fixer-check": "php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --dry-run --stop-on-violation --using-cache=no",
38+
"php-cs-fixer": "php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --using-cache=no",
39+
"fix-lint": [
40+
"@php-cs-fixer"
41+
],
42+
"test-setup": [
43+
"php -v",
4044
"@php-cs-fixer-check"
4145
],
4246
"test": [
4347
"@phpunit"
44-
],
45-
"fix-lint": [
46-
"@php-cs-fixer"
4748
]
4849
}
4950
}

docker-compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '3'
2+
3+
services:
4+
php7:
5+
build:
6+
context: ./docker/php/
7+
dockerfile: Dockerfile.php7
8+
volumes:
9+
- .:/var/www/html
10+
- ./docker/php/conf.d/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
11+
- ./docker/php/conf.d/error_reporting.ini:/usr/local/etc/php/conf.d/error_reporting.ini
12+
command: develop

docker/php/Dockerfile.php7

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM php:7.4-fpm
2+
3+
ENV APP_DIR /var/www/html
4+
5+
# Install system dependencies
6+
RUN apt-get update && apt-get install -y \
7+
build-essential \
8+
git \
9+
curl \
10+
zip \
11+
unzip
12+
13+
RUN pecl install xdebug \
14+
&& docker-php-ext-enable xdebug
15+
16+
# Get latest Composer
17+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
18+
19+
# Set working directory
20+
WORKDIR $APP_DIR
21+
22+
# Add the start script and change the permissions
23+
COPY ./docker-entrypoint.sh /
24+
RUN chmod +x /docker-entrypoint.sh
25+
26+
CMD /docker-entrypoint.sh

docker/php/conf.d/error_reporting.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
error_reporting=E_ALL

0 commit comments

Comments
 (0)