Skip to content

Commit 337bee3

Browse files
Merge v1.18 into v1.19 (#1310)
2 parents cbc8104 + 36a7273 commit 337bee3

File tree

5 files changed

+80
-92
lines changed

5 files changed

+80
-92
lines changed

.github/actions/setup/action.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Setup
2+
description: Sets up the build environment
3+
inputs:
4+
php-version:
5+
description: "PHP version to install"
6+
required: true
7+
driver-version:
8+
description: "MongoDB extension version to install"
9+
required: true
10+
php-ini-values:
11+
description: "INI values to pass along to setup-php action"
12+
required: false
13+
default: ""
14+
15+
runs:
16+
using: composite
17+
steps:
18+
- name: Setup cache environment
19+
id: extcache
20+
uses: shivammathur/cache-extensions@v1
21+
with:
22+
php-version: ${{ env.PHP_VERSION }}
23+
extensions: "mongodb-${{ env.DRIVER_VERSION }}"
24+
key: "extcache-v1"
25+
26+
- name: Cache extensions
27+
uses: actions/cache@v4
28+
with:
29+
path: ${{ steps.extcache.outputs.dir }}
30+
key: ${{ steps.extcache.outputs.key }}
31+
restore-keys: ${{ steps.extcache.outputs.key }}
32+
33+
- name: Install PHP
34+
uses: shivammathur/setup-php@v2
35+
with:
36+
coverage: none
37+
extensions: "mongodb-${{ inputs.driver-version }}"
38+
php-version: "${{ inputs.php-version }}"
39+
tools: cs2pr
40+
ini-values: "${{ inputs.php-ini-values }}"
41+
42+
- name: Show driver information
43+
run: "php --ri mongodb"
44+
shell: bash
45+
46+
- name: Install dependencies with Composer
47+
uses: ramsey/[email protected]
48+
with:
49+
# Revert when psalm supports PHP 8.4
50+
# composer-options: "--no-suggest"
51+
composer-options: "--no-suggest ${{ inputs.php-version == '8.4' && '--ignore-platform-req=php+' || '' }}"

.github/workflows/coding-standards.yml

+3-28
Original file line numberDiff line numberDiff line change
@@ -26,36 +26,11 @@ jobs:
2626
- name: "Checkout"
2727
uses: "actions/checkout@v4"
2828

29-
- name: Setup cache environment
30-
id: extcache
31-
uses: shivammathur/cache-extensions@v1
29+
- name: "Setup"
30+
uses: "./.github/actions/setup"
3231
with:
3332
php-version: ${{ env.PHP_VERSION }}
34-
extensions: "mongodb-${{ env.DRIVER_VERSION }}"
35-
key: "extcache-v1"
36-
37-
- name: Cache extensions
38-
uses: actions/cache@v4
39-
with:
40-
path: ${{ steps.extcache.outputs.dir }}
41-
key: ${{ steps.extcache.outputs.key }}
42-
restore-keys: ${{ steps.extcache.outputs.key }}
43-
44-
- name: "Install PHP"
45-
uses: "shivammathur/setup-php@v2"
46-
with:
47-
coverage: "none"
48-
extensions: "mongodb-${{ env.DRIVER_VERSION }}"
49-
php-version: "${{ env.PHP_VERSION }}"
50-
tools: "cs2pr"
51-
52-
- name: "Show driver information"
53-
run: "php --ri mongodb"
54-
55-
- name: "Install dependencies with Composer"
56-
uses: "ramsey/[email protected]"
57-
with:
58-
composer-options: "--no-suggest"
33+
driver-version: ${{ env.DRIVER_VERSION }}
5934

6035
# The -q option is required until phpcs v4 is released
6136
- name: "Run PHP_CodeSniffer"

.github/workflows/static-analysis.yml

+21-31
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ on:
1212
- "v*.*"
1313
- "master"
1414
- "feature/*"
15+
tags:
16+
- "*"
1517

1618
env:
1719
PHP_VERSION: "8.2"
@@ -26,45 +28,33 @@ jobs:
2628
- name: "Checkout"
2729
uses: "actions/checkout@v4"
2830

29-
- name: Setup cache environment
30-
id: extcache
31-
uses: shivammathur/cache-extensions@v1
31+
- name: "Setup"
32+
uses: "./.github/actions/setup"
3233
with:
3334
php-version: ${{ env.PHP_VERSION }}
34-
extensions: "mongodb-${{ env.DRIVER_VERSION }}"
35-
key: "extcache-v1"
35+
driver-version: ${{ env.DRIVER_VERSION }}
3636

37-
- name: Cache extensions
38-
uses: actions/cache@v4
39-
with:
40-
path: ${{ steps.extcache.outputs.dir }}
41-
key: ${{ steps.extcache.outputs.key }}
42-
restore-keys: ${{ steps.extcache.outputs.key }}
37+
- name: "Run Psalm"
38+
run: "vendor/bin/psalm --show-info=false --stats --output-format=github --threads=$(nproc) --report=psalm.sarif"
4339

44-
- name: "Install PHP"
45-
uses: "shivammathur/setup-php@v2"
40+
- name: "Upload SARIF report"
41+
uses: "github/codeql-action/upload-sarif@v3"
4642
with:
47-
coverage: "none"
48-
extensions: "mongodb-${{ env.DRIVER_VERSION }}"
49-
php-version: "${{ env.PHP_VERSION }}"
50-
tools: "cs2pr"
43+
sarif_file: psalm.sarif
5144

52-
- name: "Show driver information"
53-
run: "php --ri mongodb"
45+
rector:
46+
name: "Rector"
47+
runs-on: "ubuntu-22.04"
5448

55-
- name: "Install dependencies with Composer"
56-
uses: "ramsey/[email protected]"
57-
with:
58-
composer-options: "--no-suggest"
49+
steps:
50+
- name: "Checkout"
51+
uses: "actions/checkout@v4"
5952

60-
- name: "Run Psalm"
61-
run: "vendor/bin/psalm --show-info=false --stats --output-format=github --threads=$(nproc) --report=psalm.sarif"
53+
- name: "Setup"
54+
uses: "./.github/actions/setup"
55+
with:
56+
php-version: ${{ env.PHP_VERSION }}
57+
driver-version: ${{ env.DRIVER_VERSION }}
6258

6359
- name: "Run Rector"
6460
run: "vendor/bin/rector --ansi --dry-run"
65-
66-
- name: "Upload Psalm report"
67-
uses: actions/upload-artifact@v4
68-
with:
69-
name: psalm.sarif
70-
path: psalm.sarif

.github/workflows/tests.yml

+4-32
Original file line numberDiff line numberDiff line change
@@ -75,40 +75,12 @@ jobs:
7575
version: ${{ matrix.mongodb-version }}
7676
topology: ${{ matrix.topology }}
7777

78-
- name: Setup cache environment
79-
id: extcache
80-
uses: shivammathur/cache-extensions@v1
78+
- name: "Setup"
79+
uses: "./.github/actions/setup"
8180
with:
8281
php-version: ${{ matrix.php-version }}
83-
extensions: "mongodb-${{ env.DRIVER_VERSION }}"
84-
key: "extcache-v1"
85-
86-
- name: Cache extensions
87-
uses: actions/cache@v4
88-
with:
89-
path: ${{ steps.extcache.outputs.dir }}
90-
key: ${{ steps.extcache.outputs.key }}
91-
restore-keys: ${{ steps.extcache.outputs.key }}
92-
93-
- name: "Install PHP"
94-
uses: "shivammathur/setup-php@v2"
95-
with:
96-
php-version: "${{ matrix.php-version }}"
97-
tools: "pecl"
98-
extensions: "mongodb-${{ env.DRIVER_VERSION }}"
99-
coverage: "none"
100-
ini-values: "zend.assertions=1"
101-
102-
- name: "Show driver information"
103-
run: "php --ri mongodb"
104-
105-
- name: "Install dependencies with Composer"
106-
uses: "ramsey/[email protected]"
107-
with:
108-
# Revert when psalm supports PHP 8.4
109-
# composer-options: "--no-suggest"
110-
composer-options: "--no-suggest ${{ matrix.php-version == '8.4' && '--ignore-platform-req=php+' || '' }}"
111-
82+
driver-version: ${{ env.DRIVER_VERSION }}
83+
php-ini-values: "zend.assertions=1"
11284

11385
- name: "Run PHPUnit"
11486
run: "vendor/bin/simple-phpunit -v"

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
},
2222
"require-dev": {
2323
"doctrine/coding-standard": "^12.0",
24-
"rector/rector": "^0.19",
24+
"rector/rector": "^1.1",
2525
"squizlabs/php_codesniffer": "^3.7",
2626
"symfony/phpunit-bridge": "^5.2",
2727
"vimeo/psalm": "^5.13"

0 commit comments

Comments
 (0)