-
-
Notifications
You must be signed in to change notification settings - Fork 3
78 lines (64 loc) · 2.52 KB
/
tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Run Tests
on:
push:
branches:
- gh-pages
- "**"
jobs:
test:
name: Test - PHP ${{ matrix.php }} - ${{ matrix.setup }}
runs-on: ubuntu-latest
env:
CC_TEST_REPORTER_ID: a706e45a0731ff71fe03470fefba2e1469a856018f131d0aee0be3f26ec4fc16
strategy:
matrix:
php: [7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4]
setup: [lowest, stable]
include:
- php: nightly
setup: stable
fail-fast: false
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer
coverage: ${{ matrix.php == 8.4 && matrix.setup && 'pcov' || 'none' }}
- name: Get composer cache directory
id: composer-cache
shell: bash
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache/Restore Composer
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: "php-${{ matrix.php }}-${{ matrix.setup }}-${{ matrix.os }}-${{ matrix.phpunit }}-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-${{ matrix.php }}-${{ matrix.setup }}-${{ matrix.os }}-${{ matrix.phpunit }}-${{ hashFiles('**/composer.json') }}"
- name: Set PHPUnit version
if: matrix.php >= 8.1
run: composer require "phpunit/phpunit:^8.5.41" --no-update
- name: Install Dependencies
run: composer update --prefer-dist --prefer-${{ matrix.setup }} --no-interaction --no-suggest
- name: Run Tests
run: vendor/bin/phpunit ${{ matrix.php == 8.4 && matrix.setup == 'stable' && "--coverage-clover=clover.xml --coverage-text --log-junit test-results.xml" || "" }}
- name: Upload Test Results
if: matrix.php == 8.4 && matrix.setup == 'stable'
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.php-version }}-phpunit-results"
path: test-results.xml
- name: Code Climate Test Reporter
if: matrix.php == 8.4 && matrix.setup == 'stable'
uses: aktions/codeclimate-test-reporter@v1
with:
codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
command: after-build -t clover
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
continue-on-error: true
- name: Coverage
if: matrix.php == 8.4 && matrix.setup == 'stable'
uses: codecov/codecov-action@v5