Skip to content

Commit 728fc63

Browse files
authored
Merge pull request #1127 from andrewmy/add-gh-actions
Add GitHub Action CI
2 parents 9010c31 + b732d96 commit 728fc63

File tree

1 file changed

+165
-0
lines changed

1 file changed

+165
-0
lines changed

.github/workflows/ci.yml

+165
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
name: CI
2+
on: [pull_request]
3+
jobs:
4+
static_analysis:
5+
name: Static analysis
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
10+
- uses: technote-space/get-diff-action@v4
11+
with:
12+
PATTERNS: |
13+
pkg/**/*.php
14+
15+
- name: Get Composer Cache Directory
16+
id: composer-cache
17+
run: |
18+
echo "::set-output name=dir::$(composer config cache-files-dir)"
19+
20+
- uses: actions/cache@v2
21+
with:
22+
path: ${{ steps.composer-cache.outputs.dir }}
23+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
24+
restore-keys: |
25+
${{ runner.os }}-composer-
26+
27+
- uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: '7.1'
30+
coverage: none
31+
extensions: mongodb, redis, :xdebug
32+
ini-values: memory_limit=2048M
33+
34+
- run: php ./bin/fix-symfony-version.php "4.3.*"
35+
- run: composer install --no-progress
36+
- run: sed -i 's/525568/16777471/' vendor/kwn/php-rdkafka-stubs/stubs/constants.php
37+
38+
- run: docker run --workdir="/mqdev" -v "`pwd`:/mqdev" --rm enqueue/dev:latest php -d memory_limit=1024M bin/phpstan analyse -l 1 -c phpstan.neon --error-format=github -- ${{ env.GIT_DIFF_FILTERED }}
39+
if: env.GIT_DIFF_FILTERED
40+
41+
code_style_check:
42+
name: Code style check
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v2
46+
47+
- uses: technote-space/get-diff-action@v4
48+
with:
49+
PATTERNS: |
50+
pkg/**/*.php
51+
52+
- name: Get Composer Cache Directory
53+
id: composer-cache
54+
run: |
55+
echo "::set-output name=dir::$(composer config cache-files-dir)"
56+
57+
- uses: actions/cache@v2
58+
with:
59+
path: ${{ steps.composer-cache.outputs.dir }}
60+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
61+
restore-keys: |
62+
${{ runner.os }}-composer-
63+
64+
- uses: shivammathur/setup-php@v2
65+
with:
66+
php-version: '7.1'
67+
coverage: none
68+
extensions: mongodb, redis, :xdebug
69+
ini-values: memory_limit=2048M
70+
71+
- run: php ./bin/fix-symfony-version.php "4.3.*"
72+
- run: composer install --no-progress
73+
- run: sed -i 's/525568/16777471/' vendor/kwn/php-rdkafka-stubs/stubs/constants.php
74+
75+
- run: ./bin/php-cs-fixer fix --config=.php_cs.php --no-interaction --dry-run --diff -v --path-mode=intersection -- ${{ env.GIT_DIFF_FILTERED }}
76+
if: env.GIT_DIFF_FILTERED
77+
78+
tests:
79+
runs-on: ubuntu-latest
80+
strategy:
81+
matrix:
82+
php: ['7.4']
83+
symfony_version: ['4.3.*']
84+
experimental: [false]
85+
unit_tests: [true]
86+
functional_tests: [false]
87+
prepare_container: [false]
88+
rdkafka_tests: [false]
89+
include:
90+
- php: 7.1
91+
symfony_version: 4.3.*
92+
- php: 7.2
93+
symfony_version: 4.3.*
94+
- php: 7.2
95+
symfony_version: 5.0.*
96+
- php: 7.3
97+
symfony_version: 4.3.*
98+
- php: 7.3
99+
symfony_version: 4.4.*
100+
- php: 7.3
101+
symfony_version: 5.0.*
102+
- php: 7.4
103+
symfony_version: 4.3.*
104+
- php: 7.4
105+
symfony_version: 4.4.*
106+
- php: 7.4
107+
symfony_version: 5.0.*
108+
- php: 7.1
109+
symfony_version: 4.3.*
110+
unit_tests: false
111+
functional_tests: true
112+
prepare_container: true
113+
- php: 7.3
114+
symfony_version: 5.0.*
115+
unit_tests: false
116+
functional_tests: true
117+
prepare_container: true
118+
- php: 7.1
119+
symfony_version: 4.3.*
120+
unit_tests: false
121+
rdkafka_tests: true
122+
prepare_container: true
123+
experimental: true
124+
125+
name: PHP ${{ matrix.php }} tests on Sf ${{ matrix.symfony_version }}, unit=${{ matrix.unit_tests }}, func=${{ matrix.functional_tests }}, rdkafka=${{ matrix.rdkafka_tests }}
126+
127+
steps:
128+
- uses: actions/checkout@v2
129+
130+
- name: Get Composer Cache Directory
131+
id: composer-cache
132+
run: |
133+
echo "::set-output name=dir::$(composer config cache-files-dir)"
134+
135+
- uses: actions/cache@v2
136+
with:
137+
path: ${{ steps.composer-cache.outputs.dir }}
138+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
139+
restore-keys: |
140+
${{ runner.os }}-composer-
141+
142+
- uses: shivammathur/setup-php@v2
143+
with:
144+
php-version: ${{ matrix.php }}
145+
coverage: none
146+
extensions: mongodb, redis, :xdebug
147+
ini-values: memory_limit=2048M
148+
149+
- run: php ./bin/fix-symfony-version.php "${{ matrix.symfony_version }}"
150+
151+
- run: composer install --no-progress
152+
153+
- run: sed -i 's/525568/16777471/' vendor/kwn/php-rdkafka-stubs/stubs/constants.php
154+
155+
- run: bin/dev -b
156+
if: matrix.prepare_container
157+
158+
- run: bin/phpunit --exclude-group=functional
159+
if: matrix.unit_tests
160+
161+
- run: bin/test.sh --exclude-group=rdkafka
162+
if: matrix.functional_tests
163+
164+
- run: bin/test.sh --group=rdkafka
165+
if: matrix.rdkafka_tests

0 commit comments

Comments
 (0)