Skip to content

Commit

Permalink
Replaced Travis automated testing with Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
shudd3r committed Mar 4, 2021
1 parent 84cce29 commit 95f1b39
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 39 deletions.
110 changes: 110 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: build
on: [push, pull_request]

jobs:
full-build:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ["7.4"]
env:
extensions: pcov, dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter
key: cache-v2
steps:
- name: "Checkout"
uses: actions/checkout@v2
- name: "Setup PHP extensions cache environment"
id: cache-env
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}
- name: "Cache PHP extensions"
uses: actions/cache@v2
with:
path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }}
restore-keys: ${{ steps.cache-env.outputs.key }}
- name: "Install PHP with extensions"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: pcov
extensions: ${{ env.extensions }}
ini-values: assert.exception=1, zend.assertions=1
- name: "Validate composer.json"
run: composer validate
- name: "Set composer cache directory"
id: composer-cache-full-build
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Setup composer cache"
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache-full-build.outputs.dir }}
key: ${{ runner.os }}-composer-full-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-full-
- name: "Install highest dependencies"
run: composer update --no-interaction --no-ansi --no-progress --no-suggest --prefer-stable
- name: "Coding standard Php-CS-Fixer checks"
run: vendor/bin/php-cs-fixer --dry-run -v --config=cs-fixer.php.dist --path-mode=intersection fix src tests
- name: "Coding standard CodeSniffer checks"
run: |
vendor/bin/phpcs --extensions=php --standard=vendor/polymorphine/dev/phpcs.xml src
vendor/bin/phpcs --extensions=php --standard=vendor/polymorphine/dev/phpcs.xml tests
- name: "Run PhpUnit tests with coverage"
run: |
mkdir -p build/logs
vendor/bin/phpunit --coverage-clover build/logs/clover.xml
- name: "Send coverage report to coveralls.io"
run: vendor/bin/php-coveralls -v
env:
COVERALLS_RUN_LOCALLY: 1
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

lowest-build:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ["7.4"]
env:
extensions: dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter
key: cache-v2
steps:
- name: "Checkout"
uses: actions/checkout@v2
- name: "Setup PHP extensions cache environment"
id: cache-env
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}
- name: "Cache PHP extensions"
uses: actions/cache@v2
with:
path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }}
restore-keys: ${{ steps.cache-env.outputs.key }}
- name: "Install PHP with extensions"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
extensions: ${{ env.extensions }}
ini-values: assert.exception=1, zend.assertions=1
- name: "Set composer cache directory"
id: composer-cache-lowest-build
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Setup composer cache"
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache-lowest-build.outputs.dir }}
key: ${{ runner.os }}-composer-low-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-low-
- name: "Install lowest dependencies"
run: composer update --no-interaction --no-ansi --no-progress --no-suggest --prefer-stable --prefer-lowest
- name: "Run PhpUnit tests (no coverage)"
run: vendor/bin/phpunit --no-coverage
38 changes: 0 additions & 38 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Polymorphine/Container
[![Latest Stable Version](https://poser.pugx.org/polymorphine/container/version)](https://packagist.org/packages/polymorphine/container)
[![Build status](https://travis-ci.org/polymorphine/container.svg?branch=develop)](https://travis-ci.org/polymorphine/container)
[![Build status](https://github.com/polymorphine/container/workflows/build/badge.svg)](https://github.com/polymorphine/container/actions)
[![Coverage status](https://coveralls.io/repos/github/polymorphine/container/badge.svg?branch=develop)](https://coveralls.io/github/polymorphine/container?branch=develop)
[![PHP version](https://img.shields.io/packagist/php-v/polymorphine/container.svg)](https://packagist.org/packages/polymorphine/container)
[![LICENSE](https://img.shields.io/github/license/polymorphine/container.svg?color=blue)](LICENSE)
Expand Down

0 comments on commit 95f1b39

Please sign in to comment.