-
Notifications
You must be signed in to change notification settings - Fork 5
85 lines (84 loc) · 2.64 KB
/
ci.yml
File metadata and controls
85 lines (84 loc) · 2.64 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
---
name: CI
'on':
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
persist-credentials: false
- name: Markdown Lint
uses: DavidAnson/markdownlint-cli2-action@v23
with:
globs: |
**/*.md
config: ".markdownlint.yaml"
- name: YAML Lint
uses: karancode/yamllint-github-action@master
with:
yamllint_config_filepath: .yamllint.yml
yamllint_comment: true
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test:
name: PHP ${{ matrix.php }} on ${{ matrix.os }}
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: ['8.3', '8.4']
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f
with:
php-version: ${{ matrix.php }}
extensions: json, mbstring
coverage: ${{ matrix.php == '8.3' && 'pcov' || 'none' }}
tools: composer:v2
- name: Cache Composer dependencies
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae
with:
path: ~/.composer/cache
key: composer-${{ matrix.php }}-${{ hashFiles('composer.json') }}
restore-keys: composer-${{ matrix.php }}-
- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress
- name: Lint (Pint)
run: vendor/bin/pint --test
- name: Static analysis (PHPStan)
run: vendor/bin/phpstan analyse --no-progress
- name: Rector dry-run
run: vendor/bin/rector --dry-run
- name: Run tests
run: |
mkdir -p build
if [ "${{ matrix.php }}" = "8.3" ]; then
XDEBUG_MODE=coverage vendor/bin/phpunit
else
vendor/bin/phpunit --no-coverage
fi
- name: Upload coverage to Coveralls
if: matrix.php == '8.3'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |-
if [ -n "$COVERALLS_REPO_TOKEN" ]; then
vendor/bin/php-coveralls --coverage_clover build/cov.xml --json_path build/coverage.json -v
else
echo "Skipping Coveralls upload — COVERALLS_REPO_TOKEN not set."
fi