Skip to content

Commit 848865d

Browse files
committed
feat: add gitHub actions ci
1 parent 09c4250 commit 848865d

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [ main, develop ]
7+
8+
jobs:
9+
run:
10+
runs-on: ubuntu-18.04
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
php:
15+
- '8.0'
16+
- '8.1'
17+
coverage: ['none']
18+
symfony-versions:
19+
- '5.1.*'
20+
- '5.2.*'
21+
- '5.3.*'
22+
- '5.4.*'
23+
- '6.0.*'
24+
include:
25+
- description: 'Log Code Coverage'
26+
php: '8.0'
27+
coverage: 'xdebug'
28+
symfony-versions: '^5.4'
29+
30+
name: PHP ${{ matrix.php }} Symfony ${{ matrix.symfony-versions }} ${{ matrix.description }}
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v2
34+
35+
- uses: actions/cache@v2
36+
with:
37+
path: ~/.composer/cache/files
38+
key: ${{ matrix.php }}-${{ matrix.symfony-versions }}
39+
40+
- name: Setup PHP
41+
uses: shivammathur/setup-php@v2
42+
with:
43+
php-version: ${{ matrix.php }}
44+
coverage: ${{ matrix.coverage }}
45+
46+
- name: Add PHPUnit matcher
47+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
48+
49+
- name: Set composer cache directory
50+
id: composer-cache
51+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
52+
53+
- name: Cache composer
54+
uses: actions/cache@v2.1.2
55+
with:
56+
path: ${{ steps.composer-cache.outputs.dir }}
57+
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.symfony-versions }}-composer-${{ hashFiles('composer.json') }}
58+
restore-keys: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.symfony-versions }}-composer
59+
60+
- name: Update Symfony version
61+
if: matrix.symfony-versions != ''
62+
run: |
63+
composer require symfony/messenger:${{ matrix.symfony-versions }} --no-update --no-scripts
64+
composer require symfony/serializer:${{ matrix.symfony-versions }} --no-update --no-scripts
65+
66+
- name: Install dependencies
67+
run: composer install
68+
69+
- name: Run PHPUnit tests
70+
run: vendor/bin/phpunit
71+
if: matrix.coverage == 'none'
72+
73+
- name: PHPUnit tests and Log Code coverage
74+
run: vendor/bin/phpunit --coverage-clover=coverage.xml
75+
if: matrix.coverage == 'xdebug'
76+
77+
- name: Run codecov
78+
uses: codecov/codecov-action@v1
79+
if: matrix.coverage == 'xdebug'
80+
with:
81+
file: './coverage.xml'
82+
fail_ci_if_error: true

0 commit comments

Comments
 (0)