Skip to content

Commit ffb01ab

Browse files
authored
Merge pull request #44 from keboola/adamvyborny-handle-null-column
Handle null column & migrate to GH actions
2 parents efd0fae + 4955520 commit ffb01ab

27 files changed

+786
-142
lines changed

.codeclimate.yml

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

.github/workflows/push.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: 'GitHub Actions'
2+
'on':
3+
- push
4+
concurrency: 'ci-${{ github.ref }}'
5+
env:
6+
APP_IMAGE: keboola-php-csv
7+
DOCKERHUB_USER: '${{ secrets.DOCKERHUB_USER }}'
8+
DOCKERHUB_TOKEN: '${{ secrets.DOCKERHUB_TOKEN }}'
9+
jobs:
10+
tests:
11+
runs-on: ubuntu-latest
12+
steps:
13+
-
14+
name: 'Check out the repo'
15+
uses: actions/checkout@v2
16+
-
17+
name: 'Docker login'
18+
if: env.DOCKERHUB_TOKEN
19+
run: 'docker login --username "$DOCKERHUB_USER" --password "$DOCKERHUB_TOKEN"'
20+
-
21+
name: 'Build image'
22+
run: 'docker build -t $APP_IMAGE .'
23+
-
24+
name: 'Run tests'
25+
run: 'docker run ${{env.APP_IMAGE}} composer ci'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ composer.phar
77
vendor
88
*.kdev4
99
.kdev4
10+
.phpunit.result.cache

.travis.yml

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

Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM php:7.4
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
ARG COMPOSER_FLAGS="--prefer-dist --no-interaction"
5+
6+
ENV COMPOSER_ALLOW_SUPERUSER 1
7+
ENV COMPOSER_PROCESS_TIMEOUT 3600
8+
9+
WORKDIR /code/
10+
11+
COPY composer-install.sh /tmp/composer-install.sh
12+
13+
RUN apt-get update -q \
14+
&& apt-get install unzip git wget -y --no-install-recommends \
15+
&& rm -rf /var/lib/apt/lists/* \
16+
&& /tmp/composer-install.sh \
17+
&& rm /tmp/composer-install.sh \
18+
&& mv composer.phar /usr/local/bin/composer
19+
20+
## Composer - deps always cached unless changed
21+
# First copy only composer files
22+
COPY composer.* /code/
23+
# Download dependencies, but don't run scripts or init autoloaders as the app is missing
24+
RUN composer install $COMPOSER_FLAGS --no-scripts --no-autoloader
25+
# copy rest of the app
26+
COPY . /code/
27+
# run normal composer - all deps are cached already
28+
RUN composer install $COMPOSER_FLAGS
29+
30+
CMD bash

README.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
# Keboola CSV reader/writer [![Build Status](https://travis-ci.com/keboola/php-csv.svg?branch=master)](https://travis-ci.com/keboola/php-csv)
2-
1+
# Keboola CSV reader/writer
32
[![Latest Stable Version](https://poser.pugx.org/keboola/csv/v/stable.svg)](https://packagist.org/packages/keboola/csv)
43
[![License](https://poser.pugx.org/keboola/csv/license.svg)](https://packagist.org/packages/keboola/csv)
54
[![Total Downloads](https://poser.pugx.org/keboola/csv/downloads.svg)](https://packagist.org/packages/keboola/csv)
6-
[![Maintainability](https://api.codeclimate.com/v1/badges/869a0ab5c1d228279ab0/maintainability)](https://codeclimate.com/github/keboola/php-csv/maintainability)
7-
[![Test Coverage](https://api.codeclimate.com/v1/badges/869a0ab5c1d228279ab0/test_coverage)](https://codeclimate.com/github/keboola/php-csv/test_coverage)
85

96
The library provides a simple reader and writer for CSV files according to [RFC4180](https://tools.ietf.org/html/rfc4180).
107
The library is licensed under the [MIT](https://github.com/keboola/php-csv/blob/master/LICENSE) license. The library provides
@@ -120,3 +117,21 @@ require 'vendor/autoload.php';
120117
```
121118

122119
Read more in [Composer documentation](http://getcomposer.org/doc/01-basic-usage.md)
120+
121+
122+
## Development
123+
124+
Clone this repository and init the workspace with following command:
125+
126+
```
127+
git clone https://github.com/keboola/php-csv.git
128+
cd php-csv
129+
docker-compose build
130+
docker-compose run --rm dev composer install --no-scripts
131+
```
132+
133+
Run the test suite using this command:
134+
135+
```
136+
docker-compose run --rm dev composer tests
137+
```

composer-install.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)"
4+
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
5+
ACTUAL_SIGNATURE="$(php -r "echo hash_file('SHA384', 'composer-setup.php');")"
6+
7+
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
8+
then
9+
>&2 echo 'ERROR: Invalid installer signature'
10+
rm composer-setup.php
11+
exit 1
12+
fi
13+
14+
php composer-setup.php --quiet
15+
RESULT=$?
16+
rm composer-setup.php
17+
exit $RESULT

composer.json

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,35 @@
2525
}
2626
},
2727
"require": {
28-
"php": ">=5.6"
28+
"php": ">=7.4"
2929
},
3030
"require-dev": {
31-
"phpunit/phpunit": "^5.7",
32-
"squizlabs/php_codesniffer": "^3.2",
33-
"ext-json": "*"
31+
"ext-json": "*",
32+
"keboola/coding-standard": "^13.0",
33+
"php-parallel-lint/php-parallel-lint": "^1.3",
34+
"phpstan/phpstan": "^1.4",
35+
"phpunit/phpunit": ">=7.5"
36+
},
37+
"scripts": {
38+
"phpstan": "phpstan analyse ./src ./tests --level=max --no-progress -c phpstan.neon",
39+
"phpcs": "phpcs -n --ignore=vendor --extensions=php .",
40+
"phpcbf": "phpcbf -n --ignore=vendor --extensions=php .",
41+
"phplint": "parallel-lint -j 10 --exclude vendor .",
42+
"tests": "phpunit",
43+
"build": [
44+
"@phplint",
45+
"@phpcs",
46+
"@phpstan",
47+
"@tests"
48+
],
49+
"ci": [
50+
"@composer validate --strict",
51+
"@build"
52+
]
53+
},
54+
"config": {
55+
"allow-plugins": {
56+
"dealerdirect/phpcodesniffer-composer-installer": true
57+
}
3458
}
3559
}

docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: "3"
2+
3+
services:
4+
5+
dev:
6+
build: .
7+
tty: true
8+
volumes:
9+
- ./:/code
10+
working_dir: /code

phpcs.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Project">
3+
<rule ref="vendor/keboola/coding-standard/src/ruleset.xml"/>
4+
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint">
5+
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint"/>
6+
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification"/>
7+
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingAnyTypeHint"/>
8+
</rule>
9+
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
10+
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint"/>
11+
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification"/>
12+
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint"/>
13+
</rule>
14+
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
15+
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint"/>
16+
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification"/>
17+
</rule>
18+
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility">
19+
<exclude name="SlevomatCodingStandard.Classes.ClassConstantVisibility.MissingConstantVisibility"/>
20+
</rule>
21+
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
22+
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing"/>
23+
</rule>
24+
</ruleset>

0 commit comments

Comments
 (0)