Skip to content
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.

Commit

Permalink
Travis CI -> GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
petrparolek authored and f3l1x committed May 1, 2021
1 parent 17fc5cb commit 0c79afd
Show file tree
Hide file tree
Showing 3 changed files with 165 additions and 45 deletions.
152 changes: 152 additions & 0 deletions .github/workflows/main.yaml
@@ -0,0 +1,152 @@
name: "build"

on:
pull_request:
paths-ignore:
- ".docs/**"
push:
branches:
- "*"
schedule:
- cron: "0 8 * * 1" # At 08:00 on Monday

env:
extensions: "json, xdebug"
cache-version: "1"
composer-version: "v1"
composer-install: "composer update --no-interaction --no-progress --no-suggest --prefer-dist --prefer-stable"

jobs:
tests:
name: "Tests"
runs-on: "${{ matrix.operating-system }}"

strategy:
matrix:
php-version: ["5.5", "5.6", "7.0"]
operating-system: ["ubuntu-latest"]
composer-args: [ "" ]
include:
- php-version: "7.0"
operating-system: "ubuntu-latest"
composer-args: "--prefer-lowest"
- php-version: "5.6"
operating-system: "ubuntu-latest"
composer-args: ""
fail-fast: false

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

- name: "Setup PHP cache environment"
id: "extcache"
uses: "shivammathur/cache-extensions@v1"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
key: "${{ env.cache-version }}"

- name: "Cache PHP extensions"
uses: "actions/cache@v2"
with:
path: "${{ steps.extcache.outputs.dir }}"
key: "${{ steps.extcache.outputs.key }}"
restore-keys: "${{ steps.extcache.outputs.key }}"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
tools: "composer:${{ env.composer-version }} "

- name: "Setup problem matchers for PHP"
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'

- name: "Get Composer cache directory"
id: "composercache"
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'

- name: "Cache PHP dependencies"
uses: "actions/cache@v2"
with:
path: "${{ steps.composercache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "${{ runner.os }}-composer-"

- name: "Install dependencies"
run: "${{ env.composer-install }} ${{ matrix.composer-args }}"

- name: "Setup problem matchers for PHPUnit"
run: 'echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"'

- name: "Tests"
run: "make tests"

tests-code-coverage:
name: "Tests with code coverage"
runs-on: "${{ matrix.operating-system }}"

strategy:
matrix:
php-version: ["7.1"]
operating-system: ["ubuntu-latest"]
fail-fast: false

if: "github.event_name == 'push'"

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

- name: "Setup PHP cache environment"
id: "extcache"
uses: "shivammathur/cache-extensions@v1"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
key: "${{ env.cache-version }}"

- name: "Cache PHP extensions"
uses: "actions/cache@v2"
with:
path: "${{ steps.extcache.outputs.dir }}"
key: "${{ steps.extcache.outputs.key }}"
restore-keys: "${{ steps.extcache.outputs.key }}"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
tools: "composer:${{ env.composer-version }} "

- name: "Setup problem matchers for PHP"
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'

- name: "Get Composer cache directory"
id: "composercache"
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'

- name: "Cache PHP dependencies"
uses: "actions/cache@v2"
with:
path: "${{ steps.composercache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "${{ runner.os }}-composer-"

- name: "Install dependencies"
run: "${{ env.composer-install }}"

- name: "Tests"
run: "make coverage-clover"

- name: "Coveralls.io"
env:
CI_NAME: github
CI: true
COVERALLS_REPO_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar
php php-coveralls.phar --verbose --config tests/.coveralls.yml
45 changes: 0 additions & 45 deletions .travis.yml

This file was deleted.

13 changes: 13 additions & 0 deletions Makefile
@@ -0,0 +1,13 @@
.PHONY: install qa cs csf phpstan tests coverage-clover coverage-html

install:
composer update

tests:
vendor/bin/tester -s -p php --colors 1 -c tests/php-unix.ini tests/cases

coverage-clover:
vendor/bin/tester -s -p php --colors 1 -c tests/php-unix.ini -d extension=xdebug.so --coverage ./coverage.xml --coverage-src ./src tests/cases

coverage-html:
vendor/bin/tester -s -p php --colors 1 -c tests/php-unix.ini -d extension=xdebug.so --coverage ./coverage.html --coverage-src ./src tests/cases

0 comments on commit 0c79afd

Please sign in to comment.