forked from BrianHenryIE/strauss
-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (114 loc) · 3.62 KB
/
Copy pathmain.yml
File metadata and controls
138 lines (114 loc) · 3.62 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Lint and test
on:
push:
branches:
- master
- main
paths:
- '**.php'
- 'composer.json'
- '.github/workflows/main.yml'
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
branches:
- master
- main
paths:
- '**.php'
- 'composer.json'
- '.github/workflows/main.yml'
workflow_dispatch:
concurrency:
# Cancel previous runs of this workflow if they are testing the same branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
strategy:
matrix:
php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
os: [ubuntu-latest]
# os: [ubuntu-latest, windows-latest]
fail-fast: false
name: PHP tests ${{ matrix.php }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
extensions: fileinfo, gd, zip
- name: Setup problem matcher for PHPUnit
run: |
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Debugging
run: |
php --version
php -m
composer --version
- name: Install dependencies
run: composer install --prefer-dist --verbose
- name: Print installed dependencies
run: composer show
- name: Run previously workflows' failed tests first
uses: BrianHenryIE/bh-phpunit-failed-tests-action@main
with:
phpunit-command: vendor/bin/phpunit
env:
RENAMESPACER_LOG: "debug"
- name: Run tests
run: vendor/bin/phpunit --order-by=random
- name: Build phar
run:
./scripts/createphar.sh
- uses: actions/upload-artifact@v7
if: ${{ matrix.php == '7.4' && github.event_name == 'pull_request' }}
id: artifact-upload-step
with:
name: strauss.phar
path: strauss.phar
- name: Add phar to PR comment
uses: mshick/add-pr-comment@v3
if: ${{ matrix.php == '7.4' && github.event_name == 'pull_request' }}
with:
message-id: strauss-phar
message: ${{ format('[strauss.phar.zip]({0}) @ {1} {2} `composer require brianhenryie/strauss:"dev-master#{1}" --dev`', steps.artifact-upload-step.outputs.artifact-url, github.event.pull_request.head.sha, '\n') }}
continue-on-error: true
- name: Run tests with strauss.phar
run: vendor/bin/phpunit
spelling:
runs-on: ubuntu-latest
name: Spelling
steps:
- uses: actions/checkout@v7
- name: Search for misspellings
uses: crate-ci/typos@master
lint:
runs-on: ubuntu-latest
name: Lint project files
steps:
- uses: actions/checkout@v7
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer:v2, cs2pr
extensions: fileinfo, gd
- name: Debugging
run: |
php --version
php -m
composer --version
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run validate
run: |
vendor/bin/phpcbf || true
vendor/bin/phpcs -q -n --report=checkstyle | cs2pr
- name: Commit PHPCBF changes
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }} # only commit on pushes to master
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "🤖 PHPCBF"