-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (92 loc) · 3.39 KB
/
ci.yml
File metadata and controls
100 lines (92 loc) · 3.39 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: CI
# Unified workflow replacing code-analysis.yml + main-tests.yml.
#
# Strategy:
# - PHP 7.4 on Linux runs `flow qa` (full QA: phpstan + phpcs + phpmd + phpcpd
# + parallel-lint + phpcbf + phpunit + composer-audit). Canonical version.
# - PHP 8.1 / 8.5 on Linux only run the tests slice via `flow ci-tests
# --exclude-jobs=phpunit-windows` (phpunit main suite + phpunit-git). Static
# analysis tools do not depend on the runtime, so no gain from running
# them on every PHP version.
# - Windows runners (PHP 7.4 / 8.5) run only `job phpunit-windows`.
#
# The matrix is driven by a single `cmd` field so the workflow steps stay
# identical across all rows.
on:
push:
branches-ignore: [ rc** ]
pull_request:
branches-ignore: [ master ]
jobs:
ci:
name: ${{ matrix.label }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
php: '7.4'
label: 'QA + Tests (PHP 7.4)'
cmd: 'flow qa'
- os: ubuntu-latest
php: '8.1'
label: 'Tests (PHP 8.1)'
cmd: 'flow ci-tests --exclude-jobs=phpunit-windows'
- os: ubuntu-latest
php: '8.5'
label: 'Tests (PHP 8.5)'
cmd: 'flow ci-tests --exclude-jobs=phpunit-windows'
- os: windows-latest
php: '7.4'
label: 'Windows Tests (PHP 7.4)'
cmd: 'job phpunit-windows'
- os: windows-latest
php: '8.5'
label: 'Windows Tests (PHP 8.5)'
cmd: 'job phpunit-windows'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Needed so fast-branch-style diffs (if ever enabled in ci-tests) can
# resolve merge-base. Harmless otherwise.
fetch-depth: 0
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ':opcache, fileinfo'
ini-values: 'post_max_size=256M'
coverage: none
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
tools/tmp/resultCache.php
${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
env:
# setup-php@v2 writes ~/.composer/auth.json with $GITHUB_TOKEN by
# default. Recently that token has been occasionally malformed
# (newlines embedded), causing composer to fail with "github oauth
# token contains invalid characters". Our deps are all public, so
# we drop the auto-written auth before install.
COMPOSER_AUTH: '{}'
run: |
rm -f ~/.composer/auth.json ~/.config/composer/auth.json
chmod -R +x tools/*
tools/composer install --prefer-dist --no-progress
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
run: composer install --prefer-dist --no-progress
- name: Run GitHooks
run: php githooks ${{ matrix.cmd }} --show-progress