Skip to content

Commit 22d5311

Browse files
authored
Merge pull request #512 from DeveloperMarius/github-actions
GitHub actions
2 parents 42633ec + 0892f5b commit 22d5311

File tree

3 files changed

+66
-2
lines changed

3 files changed

+66
-2
lines changed

.github/workflows/ci.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build-test:
7+
runs-on: ${{ matrix.os }}
8+
9+
env:
10+
PHP_EXTENSIONS: json
11+
PHP_INI_VALUES: assert.exception=1, zend.assertions=1
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os:
17+
- ubuntu-latest
18+
- windows-latest
19+
php-version:
20+
- 7.1
21+
- 7.4
22+
phpunit-version:
23+
- 7.5.20
24+
dependencies:
25+
- lowest
26+
- highest
27+
name: PHPUnit Tests
28+
steps:
29+
- name: Configure git to avoid issues with line endings
30+
if: matrix.os == 'windows-latest'
31+
run: git config --global core.autocrlf false
32+
- name: Checkout
33+
uses: actions/checkout@v2
34+
- name: Setup PHP
35+
uses: shivammathur/setup-php@v2
36+
with:
37+
php-version: ${{ matrix.php-version }}
38+
tools: composer:v5, phpunit:${{ matrix.phpunit-versions }}
39+
coverage: xdebug
40+
extensions: ${{ env.PHP_EXTENSIONS }}
41+
ini-values: ${{ env.PHP_INI_VALUES }}
42+
- name: Get composer cache directory
43+
id: composer-cache
44+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
45+
- name: Cache dependencies
46+
uses: actions/cache@v2
47+
with:
48+
path: ${{ steps.composer-cache.outputs.dir }}
49+
key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
50+
restore-keys: |
51+
php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
52+
- name: Install lowest dependencies with composer
53+
if: matrix.dependencies == 'lowest'
54+
run: composer update --no-ansi --no-interaction --no-progress --prefer-lowest
55+
- name: Install highest dependencies with composer
56+
if: matrix.dependencies == 'highest'
57+
run: composer update --no-ansi --no-interaction --no-progress
58+
- name: Run tests with phpunit
59+
run: composer test

composer.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,14 @@
3131
"ext-json": "*"
3232
},
3333
"require-dev": {
34-
"phpunit/phpunit": "^8.0",
34+
"phpunit/phpunit": "^7",
3535
"mockery/mockery": "^1"
3636
},
37+
"scripts": {
38+
"test": [
39+
"phpunit tests"
40+
]
41+
},
3742
"autoload": {
3843
"psr-4": {
3944
"Pecee\\": "src/Pecee/"

phpunit.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
<directory suffix=".php">src</directory>
2222
</include>
2323
</coverage>
24-
</phpunit>
24+
</phpunit>

0 commit comments

Comments
 (0)