Skip to content

Commit 4e4155e

Browse files
authored
Merge pull request #115 from widmogrod/feature/github-action
Replace Travis CI with GitHub Actions and make PHP8.3 minimum requirement
2 parents e87398e + f8a9b22 commit 4e4155e

File tree

120 files changed

+3567
-2127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+3567
-2127
lines changed

.github/workflows/ci.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: PHP Test and Coverage
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
php: [ 8.3, 8.4 ]
14+
include:
15+
- php: 8.4
16+
coverage: yes
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v3
20+
21+
- name: Setup PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: ${{ matrix.php }}
25+
extensions: mbstring, xml
26+
coverage: ${{ matrix.coverage == 'yes' }}
27+
28+
- name: Cache dependencies
29+
uses: actions/cache@v3
30+
with:
31+
path: ~/.composer/cache
32+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
33+
restore-keys: ${{ runner.os }}-composer-
34+
35+
- name: Install dependencies
36+
run: composer install --prefer-source
37+
38+
- name: Prepare test coverage (if applicable)
39+
if: ${{ matrix.coverage == 'yes' }}
40+
run: |
41+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
42+
chmod +x ./cc-test-reporter
43+
./cc-test-reporter before-build
44+
45+
- name: Run tests without coverage
46+
if: ${{ matrix.coverage != 'yes' }}
47+
run: composer test
48+
49+
- name: Run tests with coverage
50+
if: ${{ matrix.coverage == 'yes' }}
51+
run: composer testc
52+
env:
53+
XDEBUG_MODE: coverage
54+
55+
- name: Code checks
56+
if: ${{ matrix.coverage == 'yes' }}
57+
run: composer check-code
58+
env:
59+
XDEBUG_MODE: coverage
60+
PHP_CS_FIXER_IGNORE_ENV: true
61+
62+
- name: Upload test coverage (if applicable)
63+
if: ${{ matrix.coverage == 'yes' }}
64+
run: ./cc-test-reporter after-build --coverage-input-type clover --exit-code 0
65+
env:
66+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
vendor/
22
.idea
33
.php_cs.cache
4+
.phpunit.cache

.php_cs renamed to .php-cs-fixer.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
25
$finder = PhpCsFixer\Finder::create()
36
->exclude('vendor')
47
->in(__DIR__);
5-
return PhpCsFixer\Config::create()
8+
9+
return (new PhpCsFixer\Config())
610
->setUsingCache(true)
711
->setRules([
812
'@PSR2' => true,
@@ -14,7 +18,7 @@
1418
'indentation_type' => true,
1519
'blank_line_after_namespace' => true,
1620
'line_ending' => true,
17-
'lowercase_constants' => true,
21+
'constant_case' => ['case' => 'lower'], // Replaces lowercase_constants
1822
'lowercase_keywords' => true,
1923
'no_closing_tag' => true,
2024
'single_line_after_imports' => true,
@@ -23,16 +27,15 @@
2327
'whitespace_after_comma_in_array' => true,
2428
'blank_line_after_opening_tag' => true,
2529
'no_empty_statement' => true,
26-
'no_extra_consecutive_blank_lines' => true,
30+
'no_extra_blank_lines' => true, // Replaces no_extra_consecutive_blank_lines
2731
'function_typehint_space' => true,
2832
'no_leading_namespace_whitespace' => true,
2933
'no_blank_lines_after_class_opening' => true,
3034
'no_blank_lines_after_phpdoc' => true,
3135
'phpdoc_scalar' => true,
3236
'phpdoc_types' => true,
3337
'no_leading_import_slash' => true,
34-
'no_extra_consecutive_blank_lines' => ['use'],
35-
'blank_line_before_return' => true,
38+
'blank_line_before_statement' => ['statements' => ['return']], // Replaces blank_line_before_return
3639
'self_accessor' => false,
3740
'no_short_bool_cast' => true,
3841
'no_trailing_comma_in_singleline_array' => true,

.travis.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# PHP Functional
2-
[![Build Status](https://travis-ci.org/widmogrod/php-functional.svg)](https://travis-ci.org/widmogrod/php-functional)
2+
![Build Status](https://github.com/widmogrod/php-functional/actions/workflows/ci.yml/badge.svg)
33
[![Test Coverage](https://api.codeclimate.com/v1/badges/895bddc952aefca0d82a/test_coverage)](https://codeclimate.com/github/widmogrod/php-functional/test_coverage)
44
[![Maintainability](https://api.codeclimate.com/v1/badges/895bddc952aefca0d82a/maintainability)](https://codeclimate.com/github/widmogrod/php-functional/maintainability)
55
## Introduction

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
"name": "widmogrod/php-functional",
33
"description": "Functors, Applicative and Monads are fascinating concept. Purpose of this library is to explore them in OOP PHP world.",
44
"require": {
5-
"php": "^7.1|^8.0",
5+
"php": ">=8.3",
66
"functional-php/fantasy-land": "^1"
77
},
88
"require-dev": {
9-
"phpunit/phpunit": "^6",
10-
"friendsofphp/php-cs-fixer": "^2",
11-
"giorgiosironi/eris": "^0.9"
9+
"phpunit/phpunit": "^11.5.1",
10+
"friendsofphp/php-cs-fixer": "^v3.65.0",
11+
"giorgiosironi/eris": "^1.0.0"
1212
},
1313
"license": "MIT",
1414
"authors": [

0 commit comments

Comments
 (0)