Skip to content
Closed
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
123 changes: 123 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "Continuous Integration"

on:
- "pull_request"
- "push"

jobs:
continuous-integratio:
name: "Continuous Integration"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.2"
- "7.3"

dependencies:
- "highest"

steps:
- name: "Checkout"
uses: "actions/checkout@v2.0.0"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@1.7.4"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1.0.3"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install dependencies with composer in generator/ directory"
run: "composer install --no-interaction"
working-directory: "generator"

- name: "Install dependencies with composer in root directory"
run: "composer install --no-interaction"

- name: "Cache PHP documentation checked out with svn"
uses: "actions/cache@v1.0.3"
with:
path: "generator/doc/doc-en"
key: "php-documentation"

- name: "Check out PHP documentation with svn"
run: |
if [ ! -d "doc-en/en" ]; then
svn co https://svn.php.net/repository/phpdoc/modules/doc-en doc-en
else
cd doc-en

svn update

if [ $? -ne 0 ];
then
cd ..

rm -rf doc-en

svn co https://svn.php.net/repository/phpdoc/modules/doc-en doc-en
fi
fi
working-directory: "generator/doc"

- name: "Run tests with phpunit/phpunit in generator/ directory"
run: "vendor/bin/phpunit"
working-directory: "generator"

- name: "Run coding standard checks with squizlabs/php_codesniffer in generator/ directory"
run: "composer cs-check"
working-directory: "generator"

- name: "Run static code analysis with phpstan/phpstan in generator/ directory"
run: "composer phpstan"
working-directory: "generator"

- name: "Dump autoloader with composer in root directory"
run: "composer dump-autoload"

- name: "Run coding standard checks with squizlabs/php_codesniffer in root directory"
run: "composer cs-check"

- name: "Run static code analysis with phpstan/phpstan in root directory"
run: "composer phpstan"

- name: "Regenerate files"
run: "./safe.php generate"
working-directory: "generator"

- name: "Check if regenerated files are different"
run: |
if output=$(git status --porcelain) && [ -z "$output" ]; then
# all is good
echo "Generated files are the same as committed file: OK"
else
# Uncommitted changes
echo "Generated files are different from commited files. Please run './safe.php generate' command and commit the results."
echo "Detected changes:"
git status
git diff
echo "Generated files are different from commited files. Please run './safe.php generate' command and commit the results."
exit 1;
fi

- name: "Check if refactoring can be done with rector/rector:~0.5.0"
run: "composer install && composer rector && composer test"
working-directory: "generator/tests/rector/0.5"

- name: "Check if refactoring can be done with rector/rector:~0.6.0"
run: "composer install && composer rector && composer test"
working-directory: "generator/tests/rector/0.6"

- name: "Upload test coverage to coveralls"
run: "vendor/bin/php-coveralls -v --root_dir=./generator"
68 changes: 0 additions & 68 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![Total Downloads](https://poser.pugx.org/thecodingmachine/safe/downloads.svg)](https://packagist.org/packages/thecodingmachine/safe)
[![Latest Unstable Version](https://poser.pugx.org/thecodingmachine/safe/v/unstable.svg)](https://packagist.org/packages/thecodingmachine/safe)
[![License](https://poser.pugx.org/thecodingmachine/safe/license.svg)](https://packagist.org/packages/thecodingmachine/safe)
[![Build Status](https://travis-ci.org/thecodingmachine/safe.svg?branch=master)](https://travis-ci.org/thecodingmachine/safe)
[![Continuous Integration](https://github.com/thecodingmachine/safe/workflows/Continuous%20Integration/badge.svg)](https://github.com/thecodingmachine/safe/actions)
[![Coverage Status](https://coveralls.io/repos/thecodingmachine/safe/badge.svg?branch=master&service=github)](https://coveralls.io/github/thecodingmachine/safe?branch=master)

Safe PHP
Expand Down Expand Up @@ -59,7 +59,7 @@ $content = file_get_contents('foobar.json');
$foobar = json_decode($content);
```

All PHP functions that can return `false` on error are part of Safe.
All PHP functions that can return `false` on error are part of Safe.
In addition, Safe also provide 2 'Safe' classes: `Safe\DateTime` and `Safe\DateTimeImmutable` whose methods will throw exceptions instead of returning false.

## PHPStan integration
Expand Down Expand Up @@ -159,8 +159,8 @@ try {

Safe is loading 1000+ functions from ~85 files on each request. Yet, the performance impact of this loading is quite low.

In case you worry, using Safe will "cost" you ~700µs on each request. The [performance section](performance/README.md)
contains more information regarding the way we tested the performance impact of Safe.
In case you worry, using Safe will "cost" you ~700µs on each request. The [performance section](performance/README.md)
contains more information regarding the way we tested the performance impact of Safe.

## Learn more

Expand Down