generated from inherelab/php-pkg-template
-
Notifications
You must be signed in to change notification settings - Fork 2
62 lines (53 loc) · 1.9 KB
/
php.yml
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
name: Unit-Tests
# https://docs.github.com/cn/actions/reference/workflow-syntax-for-github-actions
on:
pull_request:
paths:
- '**.php'
- 'composer.json'
- '**.yml'
push:
paths:
- '**.php'
- 'composer.json'
- '**.yml'
jobs:
test:
name: Test on php ${{ matrix.php}} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
php: [8.1, 8.2, 8.3]
os: [ubuntu-latest, macOS-latest] # windows-latest,
# include: # will not testing on php 7.2
# - os: 'ubuntu-latest'
# php: '7.2'
# phpunit: '8.5.13'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set ENV vars
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
run: |
echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
echo "RELEASE_NAME=$GITHUB_WORKFLOW" >> $GITHUB_ENV
- name: Display Env
run: env
# usage refer https://github.com/shivammathur/setup-php
- name: Setup PHP
timeout-minutes: 5
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php}}
tools: pecl, php-cs-fixer, phpunit:${{ matrix.phpunit }}
extensions: mbstring, dom, fileinfo, mysql, openssl, igbinary, redis # , swoole-4.4.19 #optional, setup extensions
ini-values: post_max_size=56M, short_open_tag=On #optional, setup php.ini configuration
coverage: none #optional, setup coverage driver: xdebug, none
- name: Install dependencies
run: composer update --no-progress
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md
- name: Run test suite
run: phpunit