This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
171 lines (133 loc) · 4.76 KB
/
ci.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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
on:
# Run on every commit to all branches, but not on tags.
push:
branches:
- '**'
# Allow manually triggering the workflow.
workflow_dispatch:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
name: CI
jobs:
static-analysis:
name: Static Analysis
timeout-minutes: 5
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test-type: [phpcs, phpstan]
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
# Colon means remove
extensions: :apcu, :imagick
coverage: none
tools: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install composer dependencies
run: composer update --no-interaction --no-ansi --no-progress --optimize-autoloader
- name: Test with ${{ matrix.test-type }}
run: composer test:${{ matrix.test-type }}
tests:
name: Tests
timeout-minutes: 5
needs: static-analysis
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
test-type: [unit, integration]
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1']
dependencies: [lowest, highest]
exclude:
- test-type: unit
dependencies: lowest
os: macos-latest
- test-type: unit
dependencies: lowest
os: windows-latest
- test-type: integration
os: macos-latest
- test-type: integration
os: windows-latest
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
if: matrix.test-type == 'integration'
uses: actions/setup-node@v3
- name: Install and run @stoplight/prism
if: matrix.test-type == 'integration'
run: |
npm install -g @stoplight/prism-cli
prism mock tests/openapi.yaml >prism.log 2>&1 &
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none
extensions: ctype, json, mbstring, simplexml, tokenizer, xmlwriter, :apcu, :imagick
ini-values: memory_limit=-1, assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On
tools: none
- name: Install lowest dependencies with composer
if: matrix.dependencies == 'lowest'
run: composer update --no-interaction --no-ansi --no-progress --prefer-lowest --optimize-autoloader
- name: Install highest dependencies with composer
if: matrix.dependencies == 'highest'
run: composer update --no-interaction --no-ansi --no-progress --optimize-autoloader
- name: Test ${{ matrix.test-type }} with phpunit
run: composer test:${{ matrix.test-type }} -- --testdox
- name: Upload prism log
if: matrix.test-type == 'integration'
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}-prism.log
path: prism.log
coverage:
name: Coverage
timeout-minutes: 5
needs: tests
runs-on: ubuntu-latest
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
- name: Install and run @stoplight/prism
run: |
npm install -g @stoplight/prism-cli
prism mock tests/openapi.yaml &
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: xdebug
extensions: ctype, json, mbstring, simplexml, tokenizer, xmlwriter, :apcu, :imagick
ini-values: memory_limit=-1, assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On
tools: none
- name: Install composer dependencies
run: composer update --no-interaction --no-ansi --no-progress --optimize-autoloader
- name: Test coverage with phpunit
run: composer test:coverage
- name: Upload code coverage results
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}-coverage-report
path: coverage/