-
Notifications
You must be signed in to change notification settings - Fork 91
158 lines (137 loc) · 3.99 KB
/
build.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
name: Code Analysis & Test
on:
push:
pull_request:
# Once on the first of the month at 06:00 UTC
schedule:
- cron: 0 6 1 * *
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
php-cs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
name: Checkout repository
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none
- uses: ramsey/composer-install@v3
with:
dependency-versions: 'locked'
- name: Code Style Analysis
run: composer run lint
- name: Static Code Analysis
run: composer run static-code-analysis
examples:
runs-on: ${{ matrix.os }}
needs:
- php-cs
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
php: 8.1
- os: macos-12
php: 8.3
- os: macos-14
php: 8.2
- os: windows-latest
example: 'json'
php: 8.2
- os: windows-latest
example: 'binary'
php: 8.2
- os: windows-latest
example: 'multipart'
php: 8.2
- os: windows-latest
example: 'xml'
php: 8.2
- os: windows-latest
example: 'message'
php: 8.2
- os: windows-latest
example: 'matchers'
php: 8.2
- os: windows-latest
example: 'generators'
php: 8.2
- os: windows-latest
example: 'csv'
php: 8.2
- os: windows-latest
example: 'protobuf-sync-message'
php: 8.1
- os: windows-latest
example: 'protobuf-async-message'
php: 8.2
- os: windows-latest
example: 'stub-server'
php: 8.2
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
name: Checkout repository
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
extensions: sockets, curl, zip, ffi ${{ (!matrix.example || matrix.example == 'protobuf-sync-message') && ', grpc' || '' }}
php-version: ${{ matrix.php }}
coverage: none
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Composer install
uses: ramsey/composer-install@v3
with:
dependency-versions: 'locked'
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
if: ${{ !matrix.example || contains(matrix.example, 'protobuf') }}
- name: Generate Library
run: composer gen-lib
if: ${{ !matrix.example || contains(matrix.example, 'protobuf') }}
- name: Cache Pact Plugins
uses: actions/cache@v4
with:
path: ~/.pact/plugins
key: ${{ matrix.os }}-pact-plugins
if: ${{ !matrix.example || matrix.example == 'csv' || contains(matrix.example, 'protobuf') }}
- name: Run example(s)
run: composer test -- --exclude-testsuite unit ${{ matrix.example && format('--testsuite {0}-example', matrix.example) || '' }}
env:
PACT_DO_NOT_TRACK: true
unit:
runs-on: ubuntu-latest
needs:
- php-cs
strategy:
fail-fast: false
matrix:
php: [ '8.1', '8.2', '8.3' ]
dependencies: [ 'lowest', 'locked' ]
steps:
- uses: actions/checkout@v4
name: Checkout repository
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
extensions: 'sockets, curl, zip, ffi'
php-version: ${{ matrix.php }}
coverage: pcov
- name: Composer install
uses: ramsey/composer-install@v3
with:
dependency-versions: ${{ matrix.dependencies }}
- name: Test Unit
run: vendor/bin/phpunit --testsuite unit
env:
PACT_DO_NOT_TRACK: true