Skip to content

Commit

Permalink
Refactor psalm and phpcs workflows to get static names (#1115)
Browse files Browse the repository at this point in the history
Using a matrix strategy results in changing names whenever we change the driver or PHP version, requiring an update to protected branch settings. Moving this configuration to env variables prevents this issue.
  • Loading branch information
alcaeus committed Jun 22, 2023
1 parent 38c48c1 commit d4cdf05
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,15 @@ on:
paths-ignore:
- "docs/**"

env:
PHP_VERSION: "8.2"
DRIVER_VERSION: "stable"

jobs:
phpcs:
name: "phpcs"
runs-on: "ubuntu-22.04"

strategy:
matrix:
php-version:
- "8.2"
driver-version:
- "stable"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
Expand All @@ -36,8 +33,8 @@ jobs:
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-version }}
extensions: "mongodb-${{ matrix.driver-version }}"
php-version: ${{ env.PHP_VERSION }}
extensions: "mongodb-${{ env.DRIVER_VERSION }}"
key: "extcache-v1"

- name: Cache extensions
Expand All @@ -51,8 +48,8 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "mongodb-${{ matrix.driver-version }}"
php-version: "${{ matrix.php-version }}"
extensions: "mongodb-${{ env.DRIVER_VERSION }}"
php-version: "${{ env.PHP_VERSION }}"
tools: "cs2pr"

- name: "Show driver information"
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,15 @@ on:
paths-ignore:
- "docs/**"

env:
PHP_VERSION: "8.2"
DRIVER_VERSION: "stable"

jobs:
psalm:
name: "Psalm"
runs-on: "ubuntu-22.04"

strategy:
matrix:
php-version:
- "8.2"
driver-version:
- "stable"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
Expand All @@ -36,8 +33,8 @@ jobs:
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-version }}
extensions: "mongodb-${{ matrix.driver-version }}"
php-version: ${{ env.PHP_VERSION }}
extensions: "mongodb-${{ ENV.DRIVER_VERSION }}"
key: "extcache-v1"

- name: Cache extensions
Expand All @@ -51,8 +48,8 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "mongodb-${{ matrix.driver-version }}"
php-version: "${{ matrix.php-version }}"
extensions: "mongodb-${{ ENV.DRIVER_VERSION }}"
php-version: "${{ env.PHP_VERSION }}"
tools: "cs2pr"

- name: "Show driver information"
Expand Down

0 comments on commit d4cdf05

Please sign in to comment.