Skip to content

Commit 153e84d

Browse files
authored
Merge pull request #170 from Slamdunk/github_actions
Move to Github Actions: add PHP 8.0 and 8.1 to CI
2 parents 0e93534 + 6ed901b commit 153e84d

File tree

5 files changed

+124
-59
lines changed

5 files changed

+124
-59
lines changed

.github/workflows/ci.yaml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: "Continuous Integration"
2+
3+
on:
4+
- pull_request
5+
- push
6+
7+
jobs:
8+
composer-json-lint:
9+
name: "Lint composer.json"
10+
11+
runs-on: "ubuntu-latest"
12+
13+
strategy:
14+
matrix:
15+
php-version:
16+
- "8.1"
17+
18+
steps:
19+
- name: "Checkout"
20+
uses: "actions/checkout@v2"
21+
22+
- name: "Install PHP"
23+
uses: "shivammathur/setup-php@v2"
24+
with:
25+
coverage: "none"
26+
php-version: "${{ matrix.php-version }}"
27+
tools: composer-normalize
28+
29+
- name: "Get composer cache directory"
30+
id: composercache
31+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
32+
33+
- name: "Cache dependencies"
34+
uses: actions/cache@v2
35+
with:
36+
path: ${{ steps.composercache.outputs.dir }}
37+
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.json') }}
38+
restore-keys: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-
39+
40+
- name: "Install dependencies"
41+
run: "composer update --no-interaction --no-progress"
42+
43+
- name: "Validate composer.json"
44+
run: "composer validate --strict"
45+
46+
- name: "Normalize composer.json"
47+
run: "composer-normalize --dry-run"
48+
49+
tests:
50+
name: "Tests"
51+
52+
runs-on: "ubuntu-latest"
53+
54+
strategy:
55+
matrix:
56+
php-version:
57+
- "7.1"
58+
- "7.2"
59+
- "7.3"
60+
- "7.4"
61+
- "8.0"
62+
- "8.1"
63+
dependencies:
64+
- "lowest"
65+
- "highest"
66+
67+
steps:
68+
- name: "Checkout"
69+
uses: "actions/checkout@v2"
70+
71+
- name: "Install PHP"
72+
uses: "shivammathur/setup-php@v2"
73+
with:
74+
coverage: "pcov"
75+
php-version: "${{ matrix.php-version }}"
76+
ini-values: zend.assertions=1
77+
78+
- name: "Get composer cache directory"
79+
id: composercache
80+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
81+
82+
- name: "Cache dependencies"
83+
uses: actions/cache@v2
84+
with:
85+
path: ${{ steps.composercache.outputs.dir }}
86+
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.json') }}
87+
restore-keys: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-
88+
89+
- name: "Install lowest dependencies"
90+
if: ${{ matrix.dependencies == 'lowest' }}
91+
run: "composer update --no-interaction --no-progress --prefer-lowest"
92+
93+
- name: "Install highest dependencies"
94+
if: ${{ matrix.dependencies == 'highest' }}
95+
run: "composer update --no-interaction --no-progress"
96+
97+
- name: "Run tests"
98+
timeout-minutes: 3
99+
run: "vendor/bin/phpunit --coverage-clover build/logs/clover.xml"
100+
101+
- name: "Coveralls"
102+
if: ${{ matrix.php-version == '8.1' && matrix.dependencies == 'highest' }}
103+
run: |
104+
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.5.2/php-coveralls.phar
105+
php coveralls.phar -v

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/composer.phar
22
/composer.lock
33
/vendor/*
4+
.phpunit.result.cache

.travis.yml

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

composer.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
{
22
"name": "myclabs/deep-copy",
3-
"type": "library",
43
"description": "Create deep copies (clones) of your objects",
5-
"keywords": ["clone", "copy", "duplicate", "object", "object graph"],
64
"license": "MIT",
7-
5+
"type": "library",
6+
"keywords": [
7+
"clone",
8+
"copy",
9+
"duplicate",
10+
"object",
11+
"object graph"
12+
],
13+
"require": {
14+
"php": "^7.1 || ^8.0"
15+
},
16+
"require-dev": {
17+
"doctrine/collections": "^1.6",
18+
"doctrine/common": "^2.13",
19+
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5"
20+
},
821
"autoload": {
922
"psr-4": {
1023
"DeepCopy\\": "src/DeepCopy/"
@@ -19,19 +32,6 @@
1932
"DeepCopyTest\\": "tests/DeepCopyTest/"
2033
}
2134
},
22-
23-
"require": {
24-
"php": "^7.1 || ^8.0"
25-
},
26-
"require-dev": {
27-
"doctrine/collections": "^1.0",
28-
"doctrine/common": "^2.6",
29-
"phpunit/phpunit": "^7.1"
30-
},
31-
"replace": {
32-
"myclabs/deep-copy": "self.version"
33-
},
34-
3535
"config": {
3636
"sort-packages": true
3737
}

tests/DeepCopyTest/Reflection/ReflectionHelperTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace DeepCopyTest\Reflection;
44

5+
use DeepCopy\Exception\PropertyException;
56
use DeepCopy\Reflection\ReflectionHelper;
67
use PHPUnit\Framework\TestCase;
78
use ReflectionClass;
@@ -60,13 +61,11 @@ public function provideProperties()
6061
];
6162
}
6263

63-
/**
64-
* @expectedException \DeepCopy\Exception\PropertyException
65-
*/
6664
public function test_it_cannot_retrieve_a_non_existent_prperty()
6765
{
6866
$object = new ReflectionHelperTestChild();
6967

68+
$this->expectException(PropertyException::class);
7069
ReflectionHelper::getProperty($object, 'non existent property');
7170
}
7271
}

0 commit comments

Comments
 (0)