-
Notifications
You must be signed in to change notification settings - Fork 6
70 lines (63 loc) · 2.1 KB
/
tests-unit-php.yml
File metadata and controls
70 lines (63 loc) · 2.1 KB
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
name: Unit tests PHP
on:
workflow_call:
inputs:
PHP_VERSION:
description: PHP version with which the scripts are executed.
default: '8.2'
required: false
type: string
PHP_EXTENSIONS:
description: PHP extensions supported by shivammathur/setup-php to be installed or disabled.
default: ''
required: false
type: string
COMPOSER_ARGS:
description: Set of arguments passed to Composer.
default: '--prefer-dist'
required: false
type: string
PHPUNIT_ARGS:
description: Set of arguments passed to PHPUnit.
default: '--coverage-text'
required: false
type: string
secrets:
COMPOSER_AUTH_JSON:
description: Authentication for privately hosted packages and repositories as a JSON formatted object.
required: false
ENV_VARS:
description: Additional environment variables as a JSON formatted object.
required: false
jobs:
tests-unit-php:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up custom environment variables
env:
ENV_VARS: ${{ secrets.ENV_VARS }}
if: ${{ env.ENV_VARS }}
uses: actions/github-script@v7
with:
script: |
JSON
.parse(process.env.ENV_VARS)
.forEach(envVar => core.exportVariable(envVar.name, envVar.value));
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.PHP_VERSION }}
extensions: ${{ inputs.PHP_EXTENSIONS }}
- name: Set up problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install Composer dependencies
uses: ramsey/composer-install@v4
env:
COMPOSER_AUTH: '${{ secrets.COMPOSER_AUTH_JSON }}'
with:
composer-options: ${{ inputs.COMPOSER_ARGS }}
- name: Run PHPUnit
run: ./$(composer config bin-dir)/phpunit ${{ inputs.PHPUNIT_ARGS }}