Skip to content

Commit af5230a

Browse files
authored
chore: Fix GitHub action and remove travis CI (#27)
1 parent d629305 commit af5230a

File tree

18 files changed

+99
-157
lines changed

18 files changed

+99
-157
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
version: 2
22
updates:
3-
- package-ecosystem: composer
4-
directory: "/"
5-
schedule:
6-
interval: daily
7-
time: "04:00"
8-
open-pull-requests-limit: 10
3+
- package-ecosystem: "composer"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
time: "04:00"
8+
open-pull-requests-limit: 10

.github/workflows/branch.yml

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,37 @@ jobs:
1515
runs-on: ubuntu-latest
1616

1717
steps:
18-
- uses: actions/checkout@v3
19-
20-
- name: Validate composer.json and composer.lock
21-
run: composer validate --strict
22-
23-
- name: Cache Composer packages
24-
id: composer-cache
25-
uses: actions/cache@v3
26-
with:
27-
path: vendor
28-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
29-
restore-keys: |
30-
${{ runner.os }}-php-
31-
32-
- name: Install dependencies
33-
run: composer install --prefer-dist --no-progress
34-
35-
- name: Run test suite
36-
run: composer run-script php-cs-fixer-check && composer run-script test
18+
- uses: actions/checkout@v3
19+
20+
- name: Set up PHP
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: '8.1'
24+
tools: composer:v2
25+
coverage: xdebug
26+
27+
- name: Validate composer.json and composer.lock
28+
run: composer validate --strict
29+
30+
- name: Cache Composer packages
31+
id: composer-cache
32+
uses: actions/cache@v3
33+
with:
34+
path: vendor
35+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
36+
restore-keys: |
37+
${{ runner.os }}-php-
38+
39+
- name: Install dependencies
40+
run: composer install --prefer-dist --no-progress
41+
42+
- name: Run test suite
43+
run: composer run-script php-cs-fixer-check && composer run-script test
44+
45+
- name: Upload coverage to Codecov
46+
uses: codecov/codecov-action@v4
47+
with:
48+
files: ./build/logs/clover.xml
49+
fail_ci_if_error: true
50+
env:
51+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.travis.yml

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

Makefile

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,20 @@ clean-dependencies: ## Clean dev dependencies
2727
# Not implemented
2828
.PHONY: clean-dependencies
2929

30-
build-php7: ## Build PHP7 container
30+
build: ## Build PHP7 container
3131
# Hint: force a rebuild by passing --no-cache
32-
@UID=$(UID) GID=$(GID) docker-compose build --no-cache php7
32+
@UID=$(UID) GID=$(GID) docker-compose build --no-cache php
3333
.PHONY: install-web
3434

3535
stop: ## Stop running containers
3636
@UID=$(UID) GID=$(GID) docker-compose stop
3737
.PHONY: stop
3838

39-
shell-php7: ## Start an interactive shell session for PHP7 container
39+
shell: ## Start an interactive shell session for PHP7 container
4040
# 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
41+
@UID=$(UID) GID=$(GID) docker-compose run --rm -w /var/www/html -e SHELL_VERBOSITY=1 php bash
4242
.PHONY: shell
4343

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-
5244
watch-logs: ## Open a tail on all the logs
5345
@UID=$(UID) GID=$(GID) docker-compose logs -f -t
5446
.PHONY: watch-logs

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
],
1313
"minimum-stability": "dev",
1414
"require": {
15-
"php": ">7.1.3",
15+
"php": ">=8.1",
1616
"ext-mbstring": "*",
1717
"ext-json": "*",
1818
"ext-simplexml": "*",
1919
"ext-dom": "*"
2020
},
2121
"require-dev": {
22-
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.0 || ^8.0",
23-
"friendsofphp/php-cs-fixer": "^2.19 || ^3.0"
22+
"phpunit/phpunit": "^9.0",
23+
"friendsofphp/php-cs-fixer": "^3.0"
2424
},
2525
"autoload": {
2626
"psr-4": {

docker-compose.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
version: '3'
2-
31
services:
4-
php7:
2+
php:
53
build:
64
context: ./docker/php/
7-
dockerfile: Dockerfile.php7
5+
dockerfile: Dockerfile.php8
86
volumes:
97
- .:/var/www/html
108
- ./docker/php/conf.d/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:7.4-fpm
1+
FROM php:8.1-fpm
22

33
ENV APP_DIR /var/www/html
44

@@ -8,9 +8,11 @@ RUN apt-get update && apt-get install -y \
88
git \
99
curl \
1010
zip \
11-
unzip
11+
unzip \
12+
&& rm -rf /var/lib/apt/lists/*
1213

13-
RUN pecl install xdebug-3.1.5 \
14+
# Install and enable Xdebug (compatible version will be chosen automatically)
15+
RUN pecl install xdebug \
1416
&& docker-php-ext-enable xdebug
1517

1618
# Get latest Composer
@@ -23,4 +25,4 @@ WORKDIR $APP_DIR
2325
COPY ./docker-entrypoint.sh /
2426
RUN chmod +x /docker-entrypoint.sh
2527

26-
CMD /docker-entrypoint.sh
28+
CMD ["/docker-entrypoint.sh"]

src/Contracts/ValidationRuleInterface.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ interface ValidationRuleInterface
99
/**
1010
* Determines if the validation rule passes. This is where we do the
1111
* actual validation. If the validation passes return true else false.
12-
*
13-
* @param mixed $value
1412
*/
1513
public function passes($value, array $parameters): bool;
1614

src/Converter/XmlConverter.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
namespace Oshomo\CsvUtils\Converter;
66

7-
use DOMDocument;
87
use Oshomo\CsvUtils\Contracts\ConverterHandlerInterface;
9-
use SimpleXMLElement;
108

119
class XmlConverter implements ConverterHandlerInterface
1210
{
@@ -35,15 +33,15 @@ public function __construct(string $recordElement = self::DEFAULT_RECORD_ELEMENT
3533
$this->recordElement = $recordElement;
3634
}
3735

38-
$this->data = new SimpleXMLElement('<?xml version="1.0"?><data value=""></data>');
36+
$this->data = new \SimpleXMLElement('<?xml version="1.0"?><data value=""></data>');
3937
}
4038

4139
public function getExtension(): string
4240
{
4341
return self::FILE_EXTENSION;
4442
}
4543

46-
protected function toXml(array $data, SimpleXMLElement $xmlData): void
44+
protected function toXml(array $data, \SimpleXMLElement $xmlData): void
4745
{
4846
foreach ($data as $key => $value) {
4947
if (is_numeric($key)) {
@@ -67,7 +65,7 @@ public function convert(array $data): ConverterHandlerInterface
6765

6866
public function write(string $filename): bool
6967
{
70-
$dom = new DOMDocument('1.0');
68+
$dom = new \DOMDocument('1.0');
7169

7270
$dom->preserveWhiteSpace = false;
7371

src/Helpers/FormatsMessages.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,14 @@ protected function ruleToLower(string $rule): ?string
6565

6666
/**
6767
* Replace all error message place-holders with actual values.
68-
*
69-
* @param mixed $value
7068
*/
7169
protected function makeReplacements(
7270
string $message,
7371
string $attribute,
7472
$value,
7573
ValidationRuleInterface $rule,
7674
array $parameters,
77-
int $lineNumber
75+
int $lineNumber,
7876
): string {
7977
$message = $this->replaceAttributePlaceholder($message, $attribute);
8078

@@ -97,7 +95,7 @@ protected function makeReplacements(
9795
protected function replaceParameterPlaceholder(
9896
string $message,
9997
array $allowedParameters,
100-
array $parameters
98+
array $parameters,
10199
): string {
102100
return str_replace($allowedParameters, $parameters, $message);
103101
}
@@ -112,8 +110,6 @@ protected function replaceAttributePlaceholder(string $message, string $attribut
112110

113111
/**
114112
* Replace the :value placeholder in the given message.
115-
*
116-
* @param mixed $value
117113
*/
118114
protected function replaceValuePlaceholder(string $message, $value): string
119115
{
@@ -122,8 +118,6 @@ protected function replaceValuePlaceholder(string $message, $value): string
122118

123119
/**
124120
* Replace the :line placeholder in the given message.
125-
*
126-
* @return mixed
127121
*/
128122
protected function replaceErrorLinePlaceholder(string $message, int $lineNumber)
129123
{

0 commit comments

Comments
 (0)