1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/.github/workflows/test.yml
Ilija Tovilo 7a4da1040b [CI] Fix ineffective ccache
Cache on GHA is immutable. For this reason, hendrikmuhs/ccache-action creates a
new cache entry for each push, each with an appended timestamp, which fills the
cache very quickly. In an attempt to fix this, we've disabled the
append-timestamp option and appended a hash of php_version.h. Hence, we'll only
get a new cache file once this file is touched.

However, since this file rarely ever updates for master, we're relying on an
extremely outdated cache. To fix this, append the current year+week to rebuild
the cache each week instead, as suggested by Tim. Also use major.minor.release
version instead of the has of php_version.h for readability.

Fixes GH-14154
Closes GH-21258
2026-02-20 17:45:57 +01:00

72 lines
2.4 KiB
YAML

name: Test
on:
push:
paths-ignore: &ignore_paths
- docs/**
- NEWS
- UPGRADING
- UPGRADING.INTERNALS
- '**/README.*'
- CONTRIBUTING.md
- CODING_STANDARDS.md
- .cirrus.yml
- .circleci/**
branches:
- PHP-8.2
- PHP-8.3
- PHP-8.4
- PHP-8.5
- master
pull_request:
paths-ignore: *ignore_paths
branches:
- '**'
schedule:
- cron: "0 1 * * *"
workflow_dispatch: ~
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.url || github.run_id }}
cancel-in-progress: true
jobs:
GENERATE_MATRIX:
name: Generate Matrix
if: github.repository == 'php/php-src' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
outputs:
all_variations: ${{ steps.set-matrix.outputs.all_variations }}
branches: ${{ steps.set-matrix.outputs.branches }}
steps:
- uses: actions/checkout@v6
with:
# When running nightly, set fetch-depth to 0 to clone the full
# repository including all branches. This is required to find the
# correct commit hashes.
fetch-depth: ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && '0' || '1' }}
- name: Grab the commit mapping
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
uses: actions/cache@v5
with:
path: branch-commit-cache.json
# The cache key needs to change every time for the
# cache to be updated after this job finishes.
key: nightly-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: |
nightly-
- name: Generate Matrix
id: set-matrix
run: php .github/matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}" "${{ github.event_name == 'pull_request' && github.ref || github.ref_name }}" '${{ toJSON(github.event.pull_request.labels) }}' "${{ github.repository }}"
TEST:
needs: GENERATE_MATRIX
name: ${{ matrix.branch.name }}
uses: ./.github/workflows/test-suite.yml
strategy:
fail-fast: false
matrix:
branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }}
with:
all_variations: ${{ needs.GENERATE_MATRIX.outputs.all_variations == 'true' }}
branch: ${{ toJSON(matrix.branch) }}
secrets: inherit