Skip to content

Commit f33ed65

Browse files
committed
ci: replace travis with github actions
Replace Travis with GitHub Actions for continuous integration. Closes #1
1 parent de15165 commit f33ed65

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

.github/workflows/ci.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "main", "develop" ]
6+
pull_request:
7+
branches: [ "main", "develop" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
14+
code-style:
15+
runs-on: 'ubuntu-latest'
16+
name: 'Coding style'
17+
steps:
18+
- name: 'Checkout'
19+
uses: 'actions/checkout@v3'
20+
21+
- name: 'Setup PHP'
22+
uses: 'shivammathur/setup-php@v2'
23+
with:
24+
php-version: '8.1'
25+
coverage: 'none'
26+
tools: 'composer:v2, composer-normalize'
27+
28+
- name: 'Install dependencies'
29+
run: |
30+
composer install --no-interaction --no-progress --ansi
31+
32+
- name: 'Check PHP code'
33+
run: |
34+
composer phpcs
35+
composer phpmd
36+
37+
- name: 'Check composer.json'
38+
run: 'composer-normalize --diff --dry-run --no-update-lock'
39+
if: 'always()'
40+
41+
phpunit:
42+
runs-on: ${{ matrix.system }}
43+
name: 'PHPUnit (PHP ${{ matrix.php }} - ${{ matrix.system }})'
44+
strategy:
45+
matrix:
46+
system: ['ubuntu-latest']
47+
php:
48+
- '8.0'
49+
- '8.1'
50+
steps:
51+
- name: Checkout Code
52+
uses: actions/checkout@v3
53+
54+
- name: 'Setup PHP'
55+
uses: 'shivammathur/setup-php@v2'
56+
with:
57+
php-version: '${{ matrix.php }}'
58+
coverage: 'none'
59+
tools: 'composer:v2'
60+
61+
- name: 'Install dependencies'
62+
run: |
63+
composer install --no-interaction --no-progress --ansi
64+
65+
- name: 'Run unit tests'
66+
run: |
67+
composer phpunit
68+
69+
code-coverage:
70+
runs-on: 'ubuntu-latest'
71+
name: 'Code Coverage'
72+
steps:
73+
- name: 'Checkout'
74+
uses: 'actions/checkout@v3'
75+
76+
- name: 'Setup PHP'
77+
uses: 'shivammathur/setup-php@v2'
78+
with:
79+
php-version: '8.1'
80+
tools: 'composer:v2'
81+
82+
- name: 'Install dependencies'
83+
run: |
84+
composer install --no-interaction --no-progress --ansi
85+
86+
- name: 'Run code coverage'
87+
run: |
88+
composer coverage
89+
90+
- name: Send code coverage report to Codecov.io
91+
uses: codecov/codecov-action@v2
92+
with:
93+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)