Skip to content

Commit 7186416

Browse files
committed
Add support for PHP 8 and rdkafka v5
- improve CI - upgrade deps - require PHP 7.4 min
1 parent 706497a commit 7186416

32 files changed

+350
-355
lines changed

.ci/install_rdkafka.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#!/bin/sh
1+
#!/bin/bash
2+
3+
set -eux
24

35
git clone --depth 1 --branch "${LIBRDKAFKA_VERSION}" https://github.com/edenhill/librdkafka.git
46
(

.gitattributes

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# Set the default behavior, in case people don't have core.autocrlf set.
22
* text eol=lf
3-
/.ci export-ignore
4-
/.github export-ignore
5-
/tests export-ignore
6-
/.coveralls.yml export-ignore
73
/.gitattributes export-ignore
4+
/.gitignore export-ignore
5+
/.github export-ignore
86
/infection.json.dist export-ignore
9-
/phpcs.xml.dist export-ignore
10-
/phpstan.xml.dist export-ignore
11-
/phpunit.xml.dist export-ignore
12-
/psalm.xml export-ignore
13-
.gitignore export-ignore
7+
/phpcs.xml.dist export-ignore
8+
/phpstan.neon.dist export-ignore
9+
/phpstan-baseline.neon export-ignore
10+
/phpunit.xml.dist export-ignore
11+
/psalm.xml.dist export-ignore
12+
/tests export-ignore

.github/workflows/ci.yml

Lines changed: 50 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,37 @@
1-
name: CI
1+
name: "CI"
22

33
on:
44
pull_request:
55
push:
66
branches:
77
- "master"
88
schedule:
9-
- cron: "0 17 * * *"
9+
- cron: "42 3 * * *"
1010

1111
env:
12-
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"}}'
1312
LIBRDKAFKA_VERSION: v1.4.2
1413

1514
jobs:
16-
coding-standard:
17-
runs-on: ubuntu-18.04
18-
name: Coding Standard
15+
phpunit:
16+
name: "PHPUnit"
17+
runs-on: "ubuntu-20.04"
1918

20-
steps:
21-
- uses: actions/checkout@v2
22-
23-
- name: Install librdkafka
24-
run: |
25-
chmod +x .ci/install_rdkafka.sh
26-
.ci/install_rdkafka.sh
27-
28-
- name: Install PHP
29-
uses: shivammathur/setup-php@2.2.0
30-
with:
31-
php-version: 7.3
32-
coverage: none
33-
tools: pecl
34-
extensions: json, mbstring, rdkafka
35-
36-
- name: Get Composer Cache Directory
37-
id: composer-cache
38-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
39-
40-
- name: Cache dependencies
41-
uses: actions/cache@v1
42-
with:
43-
path: ${{ steps.composer-cache.outputs.dir }}
44-
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
45-
restore-keys: ${{ runner.os }}-composer-
46-
47-
- name: Install Dependencies
48-
run: composer install ${DEPENDENCIES}
49-
50-
- name: Coding Standard
51-
run: vendor/bin/phpcs
52-
53-
phpstan:
54-
runs-on: ubuntu-18.04
55-
name: PHPStan
56-
57-
steps:
58-
- uses: actions/checkout@v2
59-
60-
- name: Install librdkafka
61-
run: |
62-
chmod +x .ci/install_rdkafka.sh
63-
.ci/install_rdkafka.sh
64-
65-
- name: Install PHP
66-
uses: shivammathur/setup-php@2.2.0
67-
with:
68-
php-version: 7.3
69-
coverage: none
70-
tools: pecl
71-
extensions: json, mbstring, rdkafka
72-
73-
- name: Get Composer Cache Directory
74-
id: composer-cache
75-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
76-
77-
- name: Cache dependencies
78-
uses: actions/cache@v1
79-
with:
80-
path: ${{ steps.composer-cache.outputs.dir }}
81-
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
82-
restore-keys: ${{ runner.os }}-composer-
83-
84-
- name: Install Dependencies
85-
run: composer install ${DEPENDENCIES}
86-
87-
- name: PHPStan
88-
run: vendor/bin/phpstan analyse
89-
90-
coverage:
91-
runs-on: ubuntu-18.04
92-
name: Code Coverage
19+
strategy:
20+
matrix:
21+
php-version:
22+
- "7.4"
23+
- "8.0"
24+
dependencies:
25+
- "highest"
26+
include:
27+
- dependencies: "lowest"
28+
php-version: "7.4"
9329

9430
steps:
95-
- uses: actions/checkout@v2
31+
- name: "Checkout"
32+
uses: "actions/checkout@v2"
9633
with:
97-
ref: ${{ github.ref }}
34+
fetch-depth: 2
9835

9936
- name: Build the docker-compose stack
10037
run: docker-compose -f tests/docker-compose.yaml up -d
@@ -104,85 +41,47 @@ jobs:
10441
chmod +x .ci/install_rdkafka.sh
10542
.ci/install_rdkafka.sh
10643
107-
- name: Install PHP
108-
uses: shivammathur/setup-php@2.2.0
109-
with:
110-
php-version: 7.3
111-
coverage: pcov
112-
tools: pecl
113-
extensions: json, mbstring, rdkafka
114-
115-
- name: Get Composer Cache Directory
116-
id: composer-cache
117-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
11844
119-
- name: Cache dependencies
120-
uses: actions/cache@v1
45+
- name: "Install PHP"
46+
uses: "shivammathur/setup-php@v2"
12147
with:
122-
path: ${{ steps.composer-cache.outputs.dir }}
123-
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
124-
restore-keys: ${{ runner.os }}-composer-
48+
php-version: "${{ matrix.php-version }}"
49+
coverage: "pcov"
50+
extensions: "rdkafka"
51+
ini-values: "zend.assertions=1"
12552

126-
- name: Install Dependencies
127-
run: composer install ${DEPENDENCIES}
53+
- name: "Install dependencies with Composer"
54+
uses: "ramsey/composer-install@v1"
55+
with:
56+
dependency-versions: "${{ matrix.dependencies }}"
12857

129-
- name: Code coverage
130-
run: |
131-
./vendor/bin/phpunit --coverage-clover /tmp/coverage/clover.xml
58+
- name: "Run PHPUnit"
59+
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"
13260

133-
- name: Report to Coveralls
134-
env:
135-
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
136-
COVERALLS_RUN_LOCALLY: 1
137-
run: vendor/bin/php-coveralls --coverage_clover /tmp/coverage/clover.xml --json_path /tmp/coverage/coveralls.json
61+
- name: "Upload coverage file"
62+
uses: "actions/upload-artifact@v2"
63+
with:
64+
name: "phpunit-${{ matrix.deps }}-${{ matrix.php-version }}.coverage"
65+
path: "coverage.xml"
13866

139-
test_with-php-versions:
140-
runs-on: ubuntu-18.04
141-
strategy:
142-
matrix:
143-
php: [7.3, 7.4]
144-
env: [
145-
'DEPENDENCIES=--prefer-lowest',
146-
'',
147-
]
148-
name: PHP ${{ matrix.php }} Test ${{ matrix.env }}
67+
upload_coverage:
68+
name: "Upload coverage to Codecov"
69+
runs-on: "ubuntu-20.04"
70+
needs:
71+
- "phpunit"
14972

15073
steps:
151-
- uses: actions/checkout@v2
152-
153-
- name: Build the docker-compose stack
154-
run: docker-compose -f tests/docker-compose.yaml up -d
155-
156-
- name: Install librdkafka
157-
run: |
158-
chmod +x .ci/install_rdkafka.sh
159-
.ci/install_rdkafka.sh
160-
161-
- name: Install PHP
162-
uses: shivammathur/setup-php@2.2.0
74+
- name: "Checkout"
75+
uses: "actions/checkout@v2"
16376
with:
164-
php-version: ${{ matrix.php }}
165-
coverage: none
166-
tools: pecl
167-
extensions: json, mbstring, rdkafka
168-
169-
- name: Get Composer Cache Directory
170-
id: composer-cache
171-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
77+
fetch-depth: 2
17278

173-
- name: Cache dependencies
174-
uses: actions/cache@v1
79+
- name: "Download coverage files"
80+
uses: "actions/download-artifact@v2"
17581
with:
176-
path: ${{ steps.composer-cache.outputs.dir }}
177-
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
178-
restore-keys: ${{ runner.os }}-composer-
82+
path: "reports"
17983

180-
- name: Install Dependencies
181-
run: composer install ${DEPENDENCIES}
182-
183-
- name: Run tests
184-
run: |
185-
export $ENV
186-
./vendor/bin/phpunit
187-
env:
188-
ENV: ${{ matrix.env}}
84+
- name: "Upload to Codecov"
85+
uses: "codecov/codecov-action@v1"
86+
with:
87+
directory: reports
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: "Coding Standards"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- "master"
8+
9+
env:
10+
LIBRDKAFKA_VERSION: v1.4.2
11+
12+
jobs:
13+
coding-standards:
14+
name: "Coding Standards"
15+
runs-on: "ubuntu-20.04"
16+
17+
steps:
18+
- name: "Checkout"
19+
uses: "actions/checkout@v2"
20+
21+
- name: Install librdkafka
22+
run: |
23+
chmod +x .ci/install_rdkafka.sh
24+
.ci/install_rdkafka.sh
25+
26+
- name: "Install PHP"
27+
uses: "shivammathur/setup-php@v2"
28+
with:
29+
php-version: "7.4"
30+
coverage: "none"
31+
extensions: "rdkafka"
32+
tools: "cs2pr, pecl"
33+
34+
- name: "Install dependencies with Composer"
35+
uses: "ramsey/composer-install@v1"
36+
37+
- name: "Run PHP_CodeSniffer"
38+
run: "vendor/bin/phpcs -q --no-colors --report=checkstyle | cs2pr"

.github/workflows/infection.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Infection
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- "master"
8+
9+
env:
10+
LIBRDKAFKA_VERSION: v1.4.2
11+
12+
jobs:
13+
Infection:
14+
runs-on: ubuntu-20.04
15+
16+
steps:
17+
- name: "Checkout"
18+
uses: "actions/checkout@v2"
19+
with:
20+
fetch-depth: 2
21+
22+
- name: Build the docker-compose stack
23+
run: docker-compose -f tests/docker-compose.yaml up -d
24+
25+
- name: Install librdkafka
26+
run: |
27+
chmod +x .ci/install_rdkafka.sh
28+
.ci/install_rdkafka.sh
29+
30+
- name: "Install PHP"
31+
uses: "shivammathur/setup-php@v2"
32+
with:
33+
php-version: "7.4"
34+
coverage: "pcov"
35+
extensions: "rdkafka"
36+
37+
- name: "Install dependencies with Composer"
38+
uses: "ramsey/composer-install@v1"
39+
40+
- name: Run Infection
41+
run: vendor/bin/roave-infection-static-analysis-plugin --min-msi=40 --min-covered-msi=50 --log-verbosity=none -s
42+
env:
43+
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }}

.github/workflows/infection.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)