Skip to content

Commit d547532

Browse files
committed
Switch to GitHub Actions
1 parent ed1c375 commit d547532

File tree

2 files changed

+72
-34
lines changed

2 files changed

+72
-34
lines changed

.github/workflows/tests.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ '**' ]
6+
pull_request:
7+
branches: [ '**' ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
17+
setup: ['lowest', 'stable', 'next']
18+
19+
name: PHP ${{ matrix.php }} - ${{ matrix.setup }}
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
tools: composer:v2
29+
30+
- name: Cache Composer packages
31+
id: composer-cache
32+
uses: actions/cache@v3
33+
with:
34+
path: vendor
35+
key: ${{ runner.os }}-${{ matrix.setup }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
36+
restore-keys: |
37+
${{ runner.os }}-${{ matrix.setup }}-php-${{ matrix.php }}-
38+
39+
- name: Install dependencies
40+
if: steps.composer-cache.outputs.cache-hit != 'true'
41+
run: |
42+
${{ matrix.php >= 8.1 && 'composer require --no-update phpunit/phpunit:^8.5.14 --no-interaction' || '' }}
43+
composer update --prefer-dist ${{ matrix.setup != 'next' && format('--prefer-{0}', matrix.setup) || '' }} --no-progress --no-suggest ${{ matrix.php >= 8.1 && '--ignore-platform-req=php' || '' }}
44+
45+
- name: Code Climate Test Reporter Preparation
46+
if: matrix.php == '7.4' && matrix.setup == 'stable'
47+
run: |
48+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter;
49+
chmod +x ./cc-test-reporter;
50+
./cc-test-reporter before-build;
51+
env:
52+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
53+
54+
- name: Run test suite
55+
run: |
56+
if [[ ${MATRIX_CONFIG} == "7.4-stable" ]]; then
57+
vendor/bin/phpunit --verbose --coverage-text --coverage-clover=clover.xml;
58+
else
59+
vendor/bin/phpunit --no-coverage;
60+
fi;
61+
env:
62+
MATRIX_CONFIG: ${{ matrix.php }}-${{ matrix.setup }}
63+
64+
- name: Code Climate Test Reporter
65+
if: ${{ matrix.php == '7.4' && matrix.setup == 'stable' && env.CC_TEST_REPORTER_ID != '' }}
66+
run: ./cc-test-reporter after-build --exit-code 0
67+
env:
68+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
69+
70+
- name: Coverage
71+
if: matrix.php == '7.4' && matrix.setup == 'stable'
72+
run: bash <(curl -s https://codecov.io/bash)

.travis.yml

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

0 commit comments

Comments
 (0)