Skip to content

Get Build Working #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: chore_actions
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
vendor
*.cache
composer.lock
tools/php-cs-fixer/composer.lock
.git
.idea
Dockerfile
1 change: 0 additions & 1 deletion .github/workflows/CI.yaml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: CI

on: [push]

jobs:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Sclable XML Lint - Changelog
============================

0.5.0
-----

* Add support for PHP 8.1
* Drop support for PHP 7.3
* Chores: remove Travis integration

0.4.0
-----

Expand Down
46 changes: 46 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
ARG PHP_VERSION
FROM php:${PHP_VERSION}-cli-alpine AS dependencies
ARG PHP_CS_FIXER
RUN apk add --update --no-cache zip unzip php-zip
COPY --from=composer /usr/bin/composer /usr/bin/composer
RUN addgroup -S php && adduser -S php -G php \
&& mkdir -p /usr/src/xml-lint \
&& chown php:php -R /usr/src/xml-lint
WORKDIR /usr/src/xml-lint
COPY --chown=php:php . ./
USER php
RUN composer install --prefer-dist -o -a -n --no-progress \
&& \
if [[ -n "${PHP_CS_FIXER}" ]]; then \
composer install --working-dir=tools/php-cs-fixer --prefer-dist -o -a -n --no-progress; \
fi

FROM php:${PHP_VERSION}-cli-alpine AS test
ARG PHP_CS_FIXER
RUN addgroup -S php && adduser -S php -G php \
&& mkdir -p /usr/src/xml-lint \
&& chown php:php -R /usr/src/xml-lint

WORKDIR /usr/src/xml-lint
COPY --from=dependencies --chown=php:php /usr/src/xml-lint ./
USER php

RUN if [[ -n "${PHP_CS_FIXER}" ]]; then \
php tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run -v; \
fi
RUN php vendor/bin/phpunit
RUN php vendor/bin/behat

FROM dependencies AS build_production
WORKDIR /usr/src/xml-lint

RUN rm -rf tools/ tests/ \
&& composer install --prefer-dist -o -a -n --no-progress --no-dev

FROM php:${PHP_VERSION}-cli-alpine AS production
WORKDIR /usr/src/xml-lint
COPY --from=build_production /usr/src/xml-lint ./
RUN ln -s /usr/src/xml-lint/bin/xmllint /usr/bin/xml-lint
WORKDIR /usr/src
ENTRYPOINT ["php", "/usr/src/xml-lint/bin/xmllint"]
CMD ["--help"]
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,40 @@ To lint a directory and all its subdirectories:
* `-s` skip the xsd validation


Development
-----------

### Run tests

```shell
# check code style
php tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run -v

# run tests
php vendor/bin/phpunit
php vendor/bin/behat
```

Using docker:

```shell
# Example
docker build -t xml-lint:php-8.1 --build-arg=PHP_VERSION="8.1" .

# PHP_VERSION: choose between 7.4, 8.0 and 8.1
docker build -t xml-lint:php-7.4 --build-arg=PHP_VERSION="7.4" .
docker build -t xml-lint:php-8.0 --build-arg=PHP_VERSION="8.0" .
docker build -t xml-lint:php-8.1 --build-arg=PHP_VERSION="8.1" .

# Run with code style check
docker build -t xml-lint:php-7.4 --build-arg=PHP_VERSION="7.4" --build-arg=PHP_CS_FIXER=true .

# Use this image to run xml-lint:
cd tests/functional/_testdata
docker run -it --rm -v "$PWD":/var/src -w /var/src xml-lint:php-7.4 -r -v -- ./
```


Changelog
---------

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
],
"bin": ["bin/xmllint"],
"require": {
"php": "7.3.*|7.4.*|8.0.*",
"symfony/console": "3.4.*|4.4.*|5.*",
"symfony/finder": "3.4.*|4.4.*|5.*",
"php": "~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0",
"ext-dom": "*",
"ext-libxml": "*",
"ext-dom": "*"
"symfony/console": "^3.4 || ^4.4 || ^5 || ^6",
"symfony/finder": "^3.4 || ^4.4 || ^5 || ^6"
},
"require-dev": {
"behat/behat": "^3.0",
Expand Down
6 changes: 3 additions & 3 deletions src/php/console/application/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down Expand Up @@ -42,7 +42,7 @@ public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
/**
* {@inheritdoc}
*/
protected function getDefaultCommands()
protected function getDefaultCommands(): array
{
parent::getDefaultCommands();

Expand All @@ -57,7 +57,7 @@ protected function getDefaultCommands()
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function run(InputInterface $input = null, OutputInterface $output = null)
public function run(InputInterface $input = null, OutputInterface $output = null): int
{
if (null === $input) {
// rewrite the input for single command usage
Expand Down
4 changes: 2 additions & 2 deletions src/php/console/command/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -26,7 +26,7 @@ class Command extends BaseCommand
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function getSynopsis($short = false)
public function getSynopsis($short = false): string
{
$key = $short ? 'short' : 'long';

Expand Down
6 changes: 3 additions & 3 deletions src/php/console/command/HelpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down Expand Up @@ -60,12 +60,12 @@ protected function configure()
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->setCommand(
$this->getApplication()->find(LintCommand::COMMAND_NAME)
);

parent::execute($input, $output);
return parent::execute($input, $output);
}
}
2 changes: 1 addition & 1 deletion src/php/console/command/LintCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/php/data/FileReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/php/data/ValidationProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/php/validator/LintValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/php/validator/ValidationCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/php/validator/ValidationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/php/validator/ValidationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/php/validator/XsdValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion src/php/validator/helper/LibXmlErrorFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/contexts/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/bootstrap.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/check-coverage.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data/FileReportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data/ValidationProblemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/validator/LintValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/validator/ValidationCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/validator/ValidationFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/validator/XsdValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/validator/helper/LibXmlErrorFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of the Sclable Xml Lint Package.
*
* @copyright (c) 2020 Sclable Business Solutions GmbH
* @copyright (c) 2022 Sclable Business Solutions GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down