From 1613975e0e5fb3d3157a8d0867fb6e07caa6bd89 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 13 Aug 2022 10:11:41 +0200 Subject: [PATCH 1/3] Improved cache keys for extensions in CI workflow to support several PHP versions when needed --- .github/workflows/ci-db-tests.yml | 2 +- .github/workflows/ci-mutation-tests.yml | 2 +- .github/workflows/ci-tests.yml | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/publish-release.yml | 17 ++++++++++++++++- .github/workflows/publish-swagger-spec.yml | 17 ++++++++++++++++- 6 files changed, 36 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-db-tests.yml b/.github/workflows/ci-db-tests.yml index 7a4aa3d1..234167d1 100644 --- a/.github/workflows/ci-db-tests.yml +++ b/.github/workflows/ci-db-tests.yml @@ -32,7 +32,7 @@ jobs: with: php-version: ${{ matrix.php-version }} extensions: ${{ env.extensions }} - key: db-tests-extensions-${{ inputs.platform }} + key: db-tests-extensions-${{ matrix.php-version }}-${{ inputs.platform }} - name: Cache extensions uses: actions/cache@v2 with: diff --git a/.github/workflows/ci-mutation-tests.yml b/.github/workflows/ci-mutation-tests.yml index 16937a2e..85ff6a8e 100644 --- a/.github/workflows/ci-mutation-tests.yml +++ b/.github/workflows/ci-mutation-tests.yml @@ -25,7 +25,7 @@ jobs: with: php-version: ${{ matrix.php-version }} extensions: ${{ env.extensions }} - key: mutation-tests-extensions-${{ inputs.test-group }} + key: mutation-tests-extensions-${{ matrix.php-version }}-${{ inputs.test-group }} - name: Cache extensions uses: actions/cache@v2 with: diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 078bc551..630c9614 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -31,7 +31,7 @@ jobs: with: php-version: ${{ matrix.php-version }} extensions: ${{ env.extensions }} - key: tests-extensions-${{ inputs.test-group }} + key: tests-extensions-${{ matrix.php-version }}-${{ inputs.test-group }} - name: Cache extensions uses: actions/cache@v2 with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c76f47bc..2be038e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: with: php-version: ${{ matrix.php-version }} extensions: ${{ env.extensions }} - key: tests-extensions-${{ matrix.command }} + key: tests-extensions-${{ matrix.php-version }}-${{ matrix.command }} - name: Cache extensions uses: actions/cache@v2 with: diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 6ff6ec15..88068a16 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -12,15 +12,30 @@ jobs: matrix: php-version: ['8.1'] swoole: ['yes', 'no'] + env: + extensions: openswoole-4.11.1 steps: - name: Checkout code uses: actions/checkout@v2 + - name: Setup cache environment + id: extcache + uses: shivammathur/cache-extensions@v1 + with: + php-version: ${{ matrix.php-version }} + extensions: ${{ env.extensions }} + key: publish-release-extensions-${{ matrix.php-version }}-${{ matrix.swoole }} + - name: Cache extensions + uses: actions/cache@v2 + with: + path: ${{ steps.extcache.outputs.dir }} + key: ${{ steps.extcache.outputs.key }} + restore-keys: ${{ steps.extcache.outputs.key }} - name: Use PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} tools: composer - extensions: openswoole-4.11.1 + extensions: ${{ env.extensions }} - if: ${{ matrix.swoole == 'yes' }} run: ./build.sh ${GITHUB_REF#refs/tags/v} - if: ${{ matrix.swoole == 'no' }} diff --git a/.github/workflows/publish-swagger-spec.yml b/.github/workflows/publish-swagger-spec.yml index 83864389..f78abb2a 100644 --- a/.github/workflows/publish-swagger-spec.yml +++ b/.github/workflows/publish-swagger-spec.yml @@ -11,6 +11,8 @@ jobs: strategy: matrix: php-version: ['8.1'] + env: + extensions: openswoole-4.11.1 steps: - name: Checkout code uses: actions/checkout@v2 @@ -18,12 +20,25 @@ jobs: id: determine_version run: echo "::set-output name=version::${GITHUB_REF#refs/tags/}" shell: bash + - name: Setup cache environment + id: extcache + uses: shivammathur/cache-extensions@v1 + with: + php-version: ${{ matrix.php-version }} + extensions: ${{ env.extensions }} + key: publish-release-extensions-${{ matrix.php-version }} + - name: Cache extensions + uses: actions/cache@v2 + with: + path: ${{ steps.extcache.outputs.dir }} + key: ${{ steps.extcache.outputs.key }} + restore-keys: ${{ steps.extcache.outputs.key }} - name: Use PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} tools: composer - extensions: openswoole-4.11.1 + extensions: ${{ env.extensions }} coverage: none - run: composer install --no-interaction --prefer-dist - run: composer swagger:inline From 0c2bcaee342dac8cf35251fe9a5f0b2c07cd34b0 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 13 Aug 2022 10:12:52 +0200 Subject: [PATCH 2/3] Fixed typo --- .github/workflows/publish-swagger-spec.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-swagger-spec.yml b/.github/workflows/publish-swagger-spec.yml index f78abb2a..8d9a5d8d 100644 --- a/.github/workflows/publish-swagger-spec.yml +++ b/.github/workflows/publish-swagger-spec.yml @@ -26,7 +26,7 @@ jobs: with: php-version: ${{ matrix.php-version }} extensions: ${{ env.extensions }} - key: publish-release-extensions-${{ matrix.php-version }} + key: publish-swagger-spec-extensions-${{ matrix.php-version }} - name: Cache extensions uses: actions/cache@v2 with: From de71821759bc046d644ea8d0b8dc49003da31145 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 13 Aug 2022 10:19:38 +0200 Subject: [PATCH 3/3] Updated to latest actions/checkout version --- .github/workflows/ci-db-tests.yml | 2 +- .github/workflows/ci-mutation-tests.yml | 2 +- .github/workflows/ci-tests.yml | 2 +- .github/workflows/ci.yml | 6 +++--- .github/workflows/docker-image-build.yml | 2 +- .github/workflows/publish-release.yml | 4 ++-- .github/workflows/publish-swagger-spec.yml | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci-db-tests.yml b/.github/workflows/ci-db-tests.yml index 234167d1..a8fb3d15 100644 --- a/.github/workflows/ci-db-tests.yml +++ b/.github/workflows/ci-db-tests.yml @@ -19,7 +19,7 @@ jobs: extensions: openswoole-4.11.1, pdo_sqlsrv-5.10.1 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install MSSQL ODBC if: ${{ inputs.platform == 'ms' }} run: sudo ./data/infra/ci/install-ms-odbc.sh diff --git a/.github/workflows/ci-mutation-tests.yml b/.github/workflows/ci-mutation-tests.yml index 85ff6a8e..bc985f12 100644 --- a/.github/workflows/ci-mutation-tests.yml +++ b/.github/workflows/ci-mutation-tests.yml @@ -18,7 +18,7 @@ jobs: extensions: openswoole-4.11.1 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup cache environment id: extcache uses: shivammathur/cache-extensions@v1 diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 630c9614..157ebbed 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -18,7 +18,7 @@ jobs: extensions: openswoole-4.11.1 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Start postgres database server if: ${{ inputs.test-group == 'api' }} run: docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d shlink_db_postgres diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2be038e2..eb2f3334 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: extensions: openswoole-4.11.1 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup cache environment id: extcache uses: shivammathur/cache-extensions@v1 @@ -124,7 +124,7 @@ jobs: php-version: ['8.1'] steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Use PHP uses: shivammathur/setup-php@v2 with: @@ -166,7 +166,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 100 - uses: marceloprado/has-changed-path@v1 diff --git a/.github/workflows/docker-image-build.yml b/.github/workflows/docker-image-build.yml index fb24e60b..a7581b5f 100644 --- a/.github/workflows/docker-image-build.yml +++ b/.github/workflows/docker-image-build.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 88068a16..af6c2e26 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -16,7 +16,7 @@ jobs: extensions: openswoole-4.11.1 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup cache environment id: extcache uses: shivammathur/cache-extensions@v1 @@ -50,7 +50,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - uses: actions/download-artifact@v3 with: path: build diff --git a/.github/workflows/publish-swagger-spec.yml b/.github/workflows/publish-swagger-spec.yml index 8d9a5d8d..e0f9f2ee 100644 --- a/.github/workflows/publish-swagger-spec.yml +++ b/.github/workflows/publish-swagger-spec.yml @@ -15,7 +15,7 @@ jobs: extensions: openswoole-4.11.1 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Determine version id: determine_version run: echo "::set-output name=version::${GITHUB_REF#refs/tags/}"