-
Notifications
You must be signed in to change notification settings - Fork 84
75 lines (62 loc) · 2.65 KB
/
build.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
63
64
65
66
67
68
69
70
71
72
73
74
75
name: "Build"
# original source: https://github.com/php-pm/php-pm/blob/master/.github/workflows/continuous-integration.yml
on:
pull_request:
push:
jobs:
build:
name: "Build"
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
deps:
- "normal"
include:
- deps: "low"
php-version: "7.4"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 0
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "pcntl"
tools: "cs2pr"
# this is needed in order to remove the pcntl_ restrictions on the php-cgi SAPI
ini-values: "disable_functions="
- name: "Cache dependencies installed with composer"
uses: "actions/cache@v3"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"
- name: "Install dependencies with composer"
run: "composer update --no-interaction --no-progress --no-suggest --prefer-dist"
if: "${{ matrix.deps == 'normal' }}"
- name: "Install lowest possible dependencies with composer"
run: "composer update --no-interaction --no-progress --no-suggest --prefer-dist --prefer-lowest"
if: "${{ matrix.deps == 'low' }}"
# # Ignore CS for PHP8 until https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/4702 is merged
# - name: "Run git-phpcs (for pull request)"
# if: "${{ github.event_name == 'pull_request' && matrix.php-version != '8.0' }}"
# run: |
# CHANGED_PHP_FILES=$(git diff origin/$GITHUB_BASE_REF --name-only --diff-filter=ACMRTUXB | grep -E "\.php$" || [[ $? == 1 ]])
# php vendor/bin/php-cs-fixer fix --config=.php_cs.php --dry-run --diff -v -- $CHANGED_PHP_FILES
# - name: "Run git-phpcs (for push)"
# if: "${{ github.event_name != 'pull_request' && matrix.php-version != '8.0' }}"
# run: |
# CHANGED_PHP_FILES=$(git diff --name-only --diff-filter=ACMRTUXB HEAD~..HEAD | grep -E "\.php$" || [[ $? == 1 ]])
# php vendor/bin/php-cs-fixer fix --config=.php_cs.php --dry-run --diff -v -- $CHANGED_PHP_FILES
# - name: "Run a static analysis with phpstan/phpstan"
# run: "php vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr"
# - name: "Run PHPUnit"
# run: "vendor/bin/phpunit"