Skip to content

Commit 65f8b97

Browse files
committed
Travis -> Github Actions
1 parent 03f82d1 commit 65f8b97

File tree

2 files changed

+291
-55
lines changed

2 files changed

+291
-55
lines changed

.github/workflows/main.yaml

+291
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,291 @@
1+
name: "build"
2+
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- ".docs/**"
7+
push:
8+
branches:
9+
- "master"
10+
schedule:
11+
- cron: "0 8 * * 1" # At 08:00 on Monday
12+
13+
env:
14+
extensions: "json"
15+
cache-version: "1"
16+
composer-version: "v2"
17+
composer-install: "composer update --no-interaction --no-progress --prefer-dist --prefer-stable"
18+
coverage: "none"
19+
20+
jobs:
21+
qa:
22+
name: "Quality assurance"
23+
runs-on: "${{ matrix.operating-system }}"
24+
25+
strategy:
26+
matrix:
27+
php-version: ["7.4"]
28+
operating-system: ["ubuntu-latest"]
29+
fail-fast: false
30+
31+
steps:
32+
- name: "Checkout"
33+
uses: "actions/checkout@v2"
34+
35+
- name: "Setup PHP cache environment"
36+
id: "extcache"
37+
uses: "shivammathur/cache-extensions@v1"
38+
with:
39+
php-version: "${{ matrix.php-version }}"
40+
extensions: "${{ env.extensions }}"
41+
key: "${{ env.cache-version }}"
42+
43+
- name: "Cache PHP extensions"
44+
uses: "actions/cache@v2"
45+
with:
46+
path: "${{ steps.extcache.outputs.dir }}"
47+
key: "${{ steps.extcache.outputs.key }}"
48+
restore-keys: "${{ steps.extcache.outputs.key }}"
49+
50+
- name: "Install PHP"
51+
uses: "shivammathur/setup-php@v2"
52+
with:
53+
php-version: "${{ matrix.php-version }}"
54+
extensions: "${{ env.extensions }}"
55+
tools: "composer:${{ env.composer-version }}, cs2pr"
56+
coverage: "${{ env.coverage }}"
57+
env:
58+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
60+
- name: "Setup problem matchers for PHP"
61+
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
62+
63+
- name: "Get Composer cache directory"
64+
id: "composercache"
65+
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'
66+
67+
- name: "Cache PHP dependencies"
68+
uses: "actions/cache@v2"
69+
with:
70+
path: "${{ steps.composercache.outputs.dir }}"
71+
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
72+
restore-keys: "${{ runner.os }}-composer-"
73+
74+
- name: "Validate Composer"
75+
run: "composer validate"
76+
77+
- name: "Install dependencies"
78+
run: "${{ env.composer-install }}"
79+
80+
- name: "Coding Standard"
81+
run: "make cs"
82+
83+
static-analysis:
84+
name: "Static analysis"
85+
runs-on: "${{ matrix.operating-system }}"
86+
87+
strategy:
88+
matrix:
89+
php-version: ["7.4"]
90+
operating-system: ["ubuntu-latest"]
91+
fail-fast: false
92+
93+
steps:
94+
- name: "Checkout"
95+
uses: "actions/checkout@v2"
96+
97+
- name: "Setup PHP cache environment"
98+
id: "extcache"
99+
uses: "shivammathur/cache-extensions@v1"
100+
with:
101+
php-version: "${{ matrix.php-version }}"
102+
extensions: "${{ env.extensions }}"
103+
key: "${{ env.cache-version }}"
104+
105+
- name: "Cache PHP extensions"
106+
uses: "actions/cache@v2"
107+
with:
108+
path: "${{ steps.extcache.outputs.dir }}"
109+
key: "${{ steps.extcache.outputs.key }}"
110+
restore-keys: "${{ steps.extcache.outputs.key }}"
111+
112+
- name: "Install PHP"
113+
uses: "shivammathur/setup-php@v2"
114+
with:
115+
php-version: "${{ matrix.php-version }}"
116+
extensions: "${{ env.extensions }}"
117+
tools: "composer:${{ env.composer-version }}"
118+
coverage: "${{ env.coverage }}"
119+
env:
120+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
122+
- name: "Setup problem matchers for PHP"
123+
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
124+
125+
- name: "Get Composer cache directory"
126+
id: "composercache"
127+
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'
128+
129+
- name: "Cache PHP dependencies"
130+
uses: "actions/cache@v2"
131+
with:
132+
path: "${{ steps.composercache.outputs.dir }}"
133+
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
134+
restore-keys: "${{ runner.os }}-composer-"
135+
136+
- name: "Install dependencies"
137+
run: "${{ env.composer-install }}"
138+
139+
- name: "PHPStan"
140+
run: "make phpstan"
141+
142+
tests:
143+
name: "Tests"
144+
runs-on: "${{ matrix.operating-system }}"
145+
146+
strategy:
147+
matrix:
148+
php-version: ["7.2", "7.3", "7.4"]
149+
operating-system: ["ubuntu-latest"]
150+
composer-args: [ "" ]
151+
include:
152+
- php-version: "7.2"
153+
operating-system: "ubuntu-latest"
154+
composer-args: "--prefer-lowest"
155+
- php-version: "8.0"
156+
operating-system: "ubuntu-latest"
157+
composer-args: ""
158+
fail-fast: false
159+
160+
steps:
161+
- name: "Checkout"
162+
uses: "actions/checkout@v2"
163+
164+
- name: "Setup PHP cache environment"
165+
id: "extcache"
166+
uses: "shivammathur/cache-extensions@v1"
167+
with:
168+
php-version: "${{ matrix.php-version }}"
169+
extensions: "${{ env.extensions }}"
170+
key: "${{ env.cache-version }}"
171+
172+
- name: "Cache PHP extensions"
173+
uses: "actions/cache@v2"
174+
with:
175+
path: "${{ steps.extcache.outputs.dir }}"
176+
key: "${{ steps.extcache.outputs.key }}"
177+
restore-keys: "${{ steps.extcache.outputs.key }}"
178+
179+
- name: "Install PHP"
180+
uses: "shivammathur/setup-php@v2"
181+
with:
182+
php-version: "${{ matrix.php-version }}"
183+
extensions: "${{ env.extensions }}"
184+
tools: "composer:${{ env.composer-version }}"
185+
coverage: "${{ env.coverage }}"
186+
env:
187+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
188+
189+
- name: "Setup problem matchers for PHP"
190+
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
191+
192+
- name: "Get Composer cache directory"
193+
id: "composercache"
194+
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'
195+
196+
- name: "Cache PHP dependencies"
197+
uses: "actions/cache@v2"
198+
with:
199+
path: "${{ steps.composercache.outputs.dir }}"
200+
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
201+
restore-keys: "${{ runner.os }}-composer-"
202+
203+
- name: "Install dependencies"
204+
run: "${{ env.composer-install }} ${{ matrix.composer-args }}"
205+
206+
- name: "Tests"
207+
run: "make tests"
208+
209+
- name: "Upload test output"
210+
if: ${{ failure() }}
211+
uses: actions/upload-artifact@v2
212+
with:
213+
name: output
214+
path: tests/**/output
215+
216+
tests-code-coverage:
217+
name: "Tests with code coverage"
218+
runs-on: "${{ matrix.operating-system }}"
219+
220+
strategy:
221+
matrix:
222+
php-version: ["7.4"]
223+
operating-system: ["ubuntu-latest"]
224+
fail-fast: false
225+
226+
if: "github.event_name == 'push'"
227+
228+
steps:
229+
- name: "Checkout"
230+
uses: "actions/checkout@v2"
231+
232+
- name: "Setup PHP cache environment"
233+
id: "extcache"
234+
uses: "shivammathur/cache-extensions@v1"
235+
with:
236+
php-version: "${{ matrix.php-version }}"
237+
extensions: "${{ env.extensions }}"
238+
key: "${{ env.cache-version }}"
239+
240+
- name: "Cache PHP extensions"
241+
uses: "actions/cache@v2"
242+
with:
243+
path: "${{ steps.extcache.outputs.dir }}"
244+
key: "${{ steps.extcache.outputs.key }}"
245+
restore-keys: "${{ steps.extcache.outputs.key }}"
246+
247+
- name: "Install PHP"
248+
uses: "shivammathur/setup-php@v2"
249+
with:
250+
php-version: "${{ matrix.php-version }}"
251+
extensions: "${{ env.extensions }}"
252+
tools: "composer:${{ env.composer-version }}"
253+
coverage: "${{ env.coverage }}"
254+
env:
255+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
256+
257+
- name: "Setup problem matchers for PHP"
258+
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
259+
260+
- name: "Get Composer cache directory"
261+
id: "composercache"
262+
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'
263+
264+
- name: "Cache PHP dependencies"
265+
uses: "actions/cache@v2"
266+
with:
267+
path: "${{ steps.composercache.outputs.dir }}"
268+
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
269+
restore-keys: "${{ runner.os }}-composer-"
270+
271+
- name: "Install dependencies"
272+
run: "${{ env.composer-install }}"
273+
274+
- name: "Tests"
275+
run: "make coverage-clover"
276+
277+
- name: "Upload test output"
278+
if: ${{ failure() }}
279+
uses: actions/upload-artifact@v2
280+
with:
281+
name: output
282+
path: tests/**/output
283+
284+
- name: "Coveralls.io"
285+
env:
286+
CI_NAME: github
287+
CI: true
288+
COVERALLS_REPO_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
289+
run: |
290+
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar
291+
php php-coveralls.phar --verbose --config tests/.coveralls.yml

.travis.yml

-55
This file was deleted.

0 commit comments

Comments
 (0)