-
-
Notifications
You must be signed in to change notification settings - Fork 262
112 lines (90 loc) · 3.44 KB
/
Copy pathbuild.yml
File metadata and controls
112 lines (90 loc) · 3.44 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
101
102
103
104
105
106
107
108
109
110
111
112
name: "phpMyFAQ Build"
on:
push:
pull_request:
permissions:
contents: read
checks: write
jobs:
run:
runs-on: ubuntu-latest
strategy:
matrix:
operating-system: ['ubuntu-latest']
php-versions: ['8.4', '8.5', '8.6']
name: phpMyFAQ ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v7.0.0
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, curl, fileinfo, filter, gd, json, zip, xml, sqlite3, xdebug, pcov
coverage: xdebug
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v6.1.0
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install PHP dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run Mago
run: |
./phpmyfaq/src/libs/bin/mago format --dry-run
./phpmyfaq/src/libs/bin/mago lint --baseline=mago-lint-baseline.toml --reporting-format=github
./phpmyfaq/src/libs/bin/mago analyze --baseline=mago-analyze-baseline.toml --reporting-format=github
- name: Check version consistency
run: php scripts/check-version.php
- name: Test with PHPUnit
run: phpmyfaq/src/libs/bin/phpunit --coverage-text --coverage-clover coverage/clover.xml --log-junit junit.xml
- name: Publish PHPUnit test results
uses: mikepenz/action-junit-report@v6.4.2
if: always()
with:
report_paths: junit.xml
check_name: PHPUnit Test Results (PHP ${{ matrix.php-versions }})
detailed_summary: true
include_passed: true
# Regression floor for line coverage. Raise MINIMUM_LINE_COVERAGE as coverage improves;
# the step prints the current percentage so the floor can be ratcheted toward it.
- name: Enforce code coverage threshold
env:
MINIMUM_LINE_COVERAGE: '50'
run: php scripts/check-coverage.php coverage/clover.xml "$MINIMUM_LINE_COVERAGE"
- name: Setup Node.js with pnpm
uses: actions/setup-node@v6
with:
package-manager-cache: false
node-version: 24
- name: Setup pnpm
uses: pnpm/action-setup@v6.0.9
with:
version: 8.15.5
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v6.1.0
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Node.js dependencies
run: pnpm install
- name: Run oxfmt format check
run: pnpm run oxfmt
- name: Run oxlint check
run: pnpm run oxlint
- name: Run Stylelint check
run: pnpm run stylelint
- name: Run Vitest tests
run: pnpm test