Skip to content

Commit

Permalink
Replace Travis with GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Dec 9, 2020
1 parent 4cbb074 commit 1f483c0
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ insert_final_newline = true
indent_style = tab
indent_size = 4

[.travis.yml]
[*.yml]
indent_style = space
indent_size = 2
48 changes: 48 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: test

on:
pull_request:

jobs:
phpunit:
name: phpunit
runs-on: ubuntu-18.04
strategy:
matrix:
php-version:
- "7.1"
# - "7.2"
# - "7.3"
# - "7.4"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: xdebug
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
~/.composer/cache
vendor
key: "php-${{ matrix.php-version }}"
restore-keys: "php-${{ matrix.php-version }}"

- name: Install dependencies
run: composer install --no-interaction --no-progress --no-suggest

- name: Run PHPUnit
run: make test-coveralls

- name: Upload code coverage
if: ${{ matrix.php-version == '7.1' }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=build/logs/clover.xml -v
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

8 changes: 2 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,5 @@ RUN apk add --no-cache make && \

ENV COMPOSER_ALLOW_SUPERUSER 1

RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer && \
curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig && \
php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }" && \
php /tmp/composer-setup.php && \
mv composer.phar /usr/local/bin/composer && \
composer global require hirak/prestissimo --no-interaction --no-progress
RUN curl -s https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer | php -- --quiet && \
mv composer.phar /usr/local/bin/composer
21 changes: 4 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

PACKAGE_NAME = icanboogie/inflector
PACKAGE_VERSION = 2.0
PHPUNIT_VERSION = phpunit-7.5.phar
PHPUNIT_FILENAME = build/$(PHPUNIT_VERSION)
PHPUNIT = php $(PHPUNIT_FILENAME)
PHPUNIT = vendor/bin/phpunit

# do not edit the following lines

Expand All @@ -17,27 +15,16 @@ vendor:
update:
@COMPOSER_ROOT_VERSION=$(PACKAGE_VERSION) composer update

autoload: vendor
@composer dump-autoload

test-dependencies: vendor $(PHPUNIT_FILENAME)

$(PHPUNIT_FILENAME):
mkdir -p build
wget https://phar.phpunit.de/$(PHPUNIT_VERSION) -O $(PHPUNIT_FILENAME)

test: test-dependencies
test: vendor
@$(PHPUNIT)

test-coverage: test-dependencies
test-coverage: vendor
@mkdir -p build/coverage
@$(PHPUNIT) --coverage-html build/coverage

test-coveralls: test-dependencies
test-coveralls: vendor
@mkdir -p build/logs
COMPOSER_ROOT_VERSION=$(PACKAGE_VERSION) composer require satooshi/php-coveralls
@$(PHPUNIT) --coverage-clover build/logs/clover.xml
php vendor/bin/php-coveralls -v

test-container:
@docker-compose run --rm tests sh
Expand Down
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Inflector

[![Release](https://img.shields.io/packagist/v/ICanBoogie/Inflector.svg)](https://packagist.org/packages/icanboogie/inflector)
[![Build Status](https://img.shields.io/travis/ICanBoogie/Inflector/master.svg)](http://travis-ci.org/ICanBoogie/Inflector)
[![Code Quality](https://img.shields.io/scrutinizer/g/ICanBoogie/Inflector/master.svg)](https://scrutinizer-ci.com/g/ICanBoogie/Inflector)
[![Code Coverage](https://img.shields.io/coveralls/ICanBoogie/Inflector/master.svg)](https://coveralls.io/r/ICanBoogie/Inflector)
[![Packagist](https://img.shields.io/packagist/dm/icanboogie/inflector.svg?maxAge=2592000)](https://packagist.org/packages/icanboogie/inflector)
Expand Down Expand Up @@ -62,7 +61,7 @@ $inflector->camelize('active_model');
$inflector->camelize('active_model', Inflector::DOWNCASE_FIRST_LETTER);
// 'activeModel'

$inflector->camelize('active_model/errors');
$inflector->camelize('active_model/errors');
// 'ActiveModel\Errors'

$inflector->camelize('active_model/errors', Inflector::DOWNCASE_FIRST_LETTER);
Expand Down Expand Up @@ -132,7 +131,7 @@ echo pluralize('üçgen', 'tr'); // "üçgenler"

### Acknowledgements

Most of the code and documentation was adapted from [Ruby On Rails](http://rubyonrails.org/)'s
Most of the code and documentation was adapted from [Ruby On Rails](http://rubyonrails.org/)'s
[Inflector](http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html) and
[David Celis](https://github.com/davidcelis)' [inflections](https://github.com/davidcelis/inflections).

Expand Down Expand Up @@ -213,15 +212,11 @@ The package directory can later by cleaned with the `make clean` command.

## Testing

The test suite is ran with the `make test` command. [Composer](http://getcomposer.org/) is
automatically installed as well as all the dependencies required to run the suite. The package
directory can later be cleaned with the `make clean` command. It is recommended to run `make test`
in the test container created with `make test-container`.
The test suite is run with the `make test` command. [Composer](http://getcomposer.org/) is
automatically installed as well as all the dependencies required to run the suite. It is recommended
to run `make test` in the test container created with `make test-container`.

The package is continuously tested by [Travis CI](http://about.travis-ci.org/).

[![Build Status](https://img.shields.io/travis/ICanBoogie/Inflector/master.svg)](https://travis-ci.org/ICanBoogie/Inflector)
[![Code Coverage](https://img.shields.io/coveralls/ICanBoogie/Inflector/master.svg)](https://coveralls.io/r/ICanBoogie/Inflector)
The package is continuously tested with [GitHub Actions](https://github.com/ICanBoogie/Inflector/actions/).



Expand Down
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@
"autoload": {
"classmap": [ "lib/" ],
"files": [ "lib/helpers.php" ]
},
"require-dev": {
"phpunit/phpunit": "^7.5"
}
}

0 comments on commit 1f483c0

Please sign in to comment.