From d4cdf057a67cb99a32db8984a16959bfa7ca7eb5 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Thu, 22 Jun 2023 13:04:04 +0200 Subject: [PATCH] Refactor psalm and phpcs workflows to get static names (#1115) 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. --- .github/workflows/coding-standards.yml | 19 ++++++++----------- .github/workflows/static-analysis.yml | 19 ++++++++----------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index c271d72fa..c3e8d5d49 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -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" @@ -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 @@ -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" diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index ec312c700..8f9c45019 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -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" @@ -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 @@ -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"