From 8576b92740ee7ef07c41f6b01468b242da085029 Mon Sep 17 00:00:00 2001 From: Yoanm <4410697+yoanm@users.noreply.github.com> Date: Sun, 31 Aug 2025 16:58:59 +0200 Subject: [PATCH 1/6] Revert "Split Nightly tests (#151)" This reverts commit 417aca00a86c292bef2df053d2131d3e5a45b643. --- .github/workflows/CI.yml | 4 - .github/workflows/auto-merge-dependabot.yml | 5 +- .github/workflows/coverage-upload.yml | 4 - .github/workflows/nightly-tests.yml | 17 ---- .github/workflows/pre-check-CI-updates.yml | 13 ---- .github/workflows/reusable-CI-workflow.yml | 52 ++++++++++--- .../reusable-coverage-upload-workflow.yml | 4 - .../reusable-nightly-tests-workflow.yml | 77 ------------------- 8 files changed, 43 insertions(+), 133 deletions(-) delete mode 100644 .github/workflows/nightly-tests.yml delete mode 100644 .github/workflows/reusable-nightly-tests-workflow.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index be1cfbb2..496d2580 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -14,16 +14,12 @@ on: # Build any PRs and main branch changes - '.github/workflows/coverage-upload.yml' - '.github/workflows/reusable-CI-workflow.yml' - '.github/workflows/reusable-coverage-upload-workflow.yml' - - '.github/workflows/reusable-nightly-tests-workflow.yml' - '.github/workflows/auto-merge-dependabot.yml' push: branches: [ master ] schedule: - cron: '0 0 1 * *' # Every month -permissions: - contents: read - concurrency: group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}" cancel-in-progress: true diff --git a/.github/workflows/auto-merge-dependabot.yml b/.github/workflows/auto-merge-dependabot.yml index d9726abf..bed36d80 100644 --- a/.github/workflows/auto-merge-dependabot.yml +++ b/.github/workflows/auto-merge-dependabot.yml @@ -7,11 +7,8 @@ permissions: jobs: dependabot: - if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'yoanm/php-jsonrpc-server-sdk' runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write + if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'yoanm/php-jsonrpc-server-sdk' steps: - name: Dependabot metadata id: metadata diff --git a/.github/workflows/coverage-upload.yml b/.github/workflows/coverage-upload.yml index 7953f5df..02bda588 100644 --- a/.github/workflows/coverage-upload.yml +++ b/.github/workflows/coverage-upload.yml @@ -4,10 +4,6 @@ on: workflows: ["CI"] types: [completed] -permissions: - contents: read - checks: write # For the check run creation ! - jobs: upload: name: Coverage diff --git a/.github/workflows/nightly-tests.yml b/.github/workflows/nightly-tests.yml deleted file mode 100644 index 3018c9ee..00000000 --- a/.github/workflows/nightly-tests.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: 'Nightly' -on: - workflow_run: - workflows: ["CI"] - types: [completed] - -permissions: - contents: read - checks: write # For the check run creation ! - -jobs: - tests: - name: Tests - permissions: - contents: read - checks: write # For the check run creation ! - uses: ./.github/workflows/reusable-nightly-tests-workflow.yml diff --git a/.github/workflows/pre-check-CI-updates.yml b/.github/workflows/pre-check-CI-updates.yml index d4b2dc57..8ec496d6 100644 --- a/.github/workflows/pre-check-CI-updates.yml +++ b/.github/workflows/pre-check-CI-updates.yml @@ -16,13 +16,8 @@ on: - '.github/workflows/coverage-upload.yml' - '.github/workflows/reusable-CI-workflow.yml' - '.github/workflows/reusable-coverage-upload-workflow.yml' - - '.github/workflows/reusable-nightly-tests-workflow.yml' - '.github/workflows/auto-merge-dependabot.yml' -permissions: - contents: read - checks: write # For the check run creation ! - concurrency: group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}" cancel-in-progress: true @@ -34,14 +29,6 @@ jobs: contents: read uses: ./.github/workflows/reusable-CI-workflow.yml - nightly: - name: Nightly - needs: [tests] - permissions: - contents: read - checks: write # For the check run creation ! - uses: ./.github/workflows/reusable-nightly-tests-workflow.yml - upload: name: Coverage needs: [tests] diff --git a/.github/workflows/reusable-CI-workflow.yml b/.github/workflows/reusable-CI-workflow.yml index 92a6ad31..096e7935 100644 --- a/.github/workflows/reusable-CI-workflow.yml +++ b/.github/workflows/reusable-CI-workflow.yml @@ -7,15 +7,10 @@ env: COMPOSER_PREFER_STABLE: '1' TEST_OUTPUT_STYLE: pretty -permissions: - contents: read - jobs: fetch-supported-versions: name: Fetch supported versions runs-on: ubuntu-latest - permissions: - contents: read outputs: php-min: ${{ steps.fetch-php-versions.outputs.min }} php-max: ${{ steps.fetch-php-versions.outputs.max }} @@ -25,15 +20,13 @@ jobs: id: fetch-php-versions uses: yoanm/gha-supported-versions-parser@feature/init with: - path: .github/workflows/supported-versions.json dependency: php + path: .github/workflows/supported-versions.json tests: name: ${{ matrix.job-name }} needs: [fetch-supported-versions] runs-on: ubuntu-latest - permissions: - contents: read env: COVERAGE_TYPE: none COVERAGE_OUTPUT_STYLE: clover @@ -123,8 +116,6 @@ jobs: name: Static analysis needs: [fetch-supported-versions] runs-on: ubuntu-latest - permissions: - contents: read env: PHP_VERSION: ${{ needs.fetch-supported-versions.outputs.php-max }} steps: @@ -162,3 +153,44 @@ jobs: - name: Dependencies check if: ${{ github.event_name == 'pull_request' }} uses: actions/dependency-review-action@v4 + + nightly-tests: + name: Nightly + needs: [ fetch-supported-versions, tests ] + runs-on: ubuntu-latest + continue-on-error: true + env: + PHP_VERSION: ${{ needs.fetch-supported-versions.outputs.php-next }} + COMPOSER_IGNORE_PLATFORM_REQ: 'php+' + steps: + - name: Check out code + uses: actions/checkout@v5 + + - name: Setup PHP ${{ env.PHP_VERSION }} + id: setup-php + uses: shivammathur/setup-php@v2 + env: + update: true # whether to use latest available patch for the version or not + fail-fast: true # step will fail if an extension or tool fails to set up + with: + php-version: ${{ env.PHP_VERSION }} + tools: composer + coverage: none + + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Setup cache for PHP ${{ steps.setup-php.outputs.php-version }} + uses: actions/cache@v4 + with: + path: | + ${{ steps.composer-cache.outputs.dir }} + # Clear the cache if composer.json (as composer.lock is not available) has been updated + key: tests-php${{ steps.setup-php.outputs.php-version }}-${{ hashFiles('composer.json') }} + + - name: Build with PHP ${{ steps.setup-php.outputs.php-version }} + run: make build + + - name: Test + run: make test-unit && make test-functional diff --git a/.github/workflows/reusable-coverage-upload-workflow.yml b/.github/workflows/reusable-coverage-upload-workflow.yml index a28b1600..0f25cc64 100644 --- a/.github/workflows/reusable-coverage-upload-workflow.yml +++ b/.github/workflows/reusable-coverage-upload-workflow.yml @@ -8,10 +8,6 @@ on: CODECOV_TOKEN: required: true -permissions: - contents: read - checks: write # For the check run creation ! - jobs: fetch-info: name: Fetch triggering workflow metadata diff --git a/.github/workflows/reusable-nightly-tests-workflow.yml b/.github/workflows/reusable-nightly-tests-workflow.yml deleted file mode 100644 index 2917c192..00000000 --- a/.github/workflows/reusable-nightly-tests-workflow.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: 'Nightly reusable workflow' - -on: - workflow_call: - inputs: - ref: - description: Reference in order to fetch code - type: string - required: false - default: "${{ github.event.workflow_run && github.event.workflow_run.referenced_workflows[0] && github.event.workflow_run.referenced_workflows[0].ref || github.ref }}" - -env: - COMPOSER_PREFER_STABLE: '1' - TEST_OUTPUT_STYLE: pretty - -permissions: - contents: read - checks: write # For the check run creation ! - -jobs: - tests: - name: PHP - permissions: - contents: read - checks: write # For the check run creation ! - runs-on: ubuntu-latest - continue-on-error: true - env: - COMPOSER_IGNORE_PLATFORM_REQ: 'php+' - steps: - - name: 'Check run ○' - uses: yoanm/temp-reports-group-workspace/utils/attach-check-run-to-triggering-workflow@v0 - with: - name: 'Nightly / PHP' - fails-on-triggering-workflow-failure: true - - - name: Fetch PHP supported versions - id: fetch-php-versions - uses: yoanm/gha-supported-versions-parser@feature/init - with: - dependency: php - path: .github/workflows/supported-versions.json - ref: "${{ inputs.ref }}" - - - name: Check out code - uses: actions/checkout@v5 - with: - ref: "${{ inputs.ref }}" - - - name: Setup PHP ${{ steps.fetch-php-versions.outputs.next }} - id: setup-php - uses: shivammathur/setup-php@v2 - env: - update: true # whether to use latest available patch for the version or not - fail-fast: true # step will fail if an extension or tool fails to set up - with: - php-version: ${{ steps.fetch-php-versions.outputs.next }} - tools: composer - coverage: none - - - name: Get composer cache directory - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Setup cache for PHP ${{ steps.setup-php.outputs.php-version }} - uses: actions/cache@v4 - with: - path: | - ${{ steps.composer-cache.outputs.dir }} - # Clear the cache if composer.json (as composer.lock is not available) has been updated - key: tests-php${{ steps.setup-php.outputs.php-version }}-${{ hashFiles('composer.json') }} - - - name: Build with PHP ${{ steps.setup-php.outputs.php-version }} - run: make build - - - name: Test - run: make test-unit && make test-functional From 342c9124b81120e59ecd85988efb9ab599a52c4f Mon Sep 17 00:00:00 2001 From: Yoanm <4410697+yoanm@users.noreply.github.com> Date: Sun, 31 Aug 2025 17:02:53 +0200 Subject: [PATCH 2/6] Keep the good --- .github/workflows/CI.yml | 3 +++ .github/workflows/auto-merge-dependabot.yml | 5 ++++- .github/workflows/coverage-upload.yml | 4 ++++ .github/workflows/pre-check-CI-updates.yml | 4 ++++ .github/workflows/reusable-CI-workflow.yml | 13 ++++++++++++- .../workflows/reusable-coverage-upload-workflow.yml | 4 ++++ 6 files changed, 31 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 496d2580..3d4649b1 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -20,6 +20,9 @@ on: # Build any PRs and main branch changes schedule: - cron: '0 0 1 * *' # Every month +permissions: + contents: read + concurrency: group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}" cancel-in-progress: true diff --git a/.github/workflows/auto-merge-dependabot.yml b/.github/workflows/auto-merge-dependabot.yml index bed36d80..d9726abf 100644 --- a/.github/workflows/auto-merge-dependabot.yml +++ b/.github/workflows/auto-merge-dependabot.yml @@ -7,8 +7,11 @@ permissions: jobs: dependabot: - runs-on: ubuntu-latest if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'yoanm/php-jsonrpc-server-sdk' + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write steps: - name: Dependabot metadata id: metadata diff --git a/.github/workflows/coverage-upload.yml b/.github/workflows/coverage-upload.yml index 02bda588..7953f5df 100644 --- a/.github/workflows/coverage-upload.yml +++ b/.github/workflows/coverage-upload.yml @@ -4,6 +4,10 @@ on: workflows: ["CI"] types: [completed] +permissions: + contents: read + checks: write # For the check run creation ! + jobs: upload: name: Coverage diff --git a/.github/workflows/pre-check-CI-updates.yml b/.github/workflows/pre-check-CI-updates.yml index 8ec496d6..63b9f898 100644 --- a/.github/workflows/pre-check-CI-updates.yml +++ b/.github/workflows/pre-check-CI-updates.yml @@ -18,6 +18,10 @@ on: - '.github/workflows/reusable-coverage-upload-workflow.yml' - '.github/workflows/auto-merge-dependabot.yml' +permissions: + contents: read + checks: write # For the check run creation ! + concurrency: group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}" cancel-in-progress: true diff --git a/.github/workflows/reusable-CI-workflow.yml b/.github/workflows/reusable-CI-workflow.yml index 096e7935..022fcf49 100644 --- a/.github/workflows/reusable-CI-workflow.yml +++ b/.github/workflows/reusable-CI-workflow.yml @@ -3,6 +3,9 @@ name: 'CI reusable workflow' on: workflow_call: +permissions: + contents: read + env: COMPOSER_PREFER_STABLE: '1' TEST_OUTPUT_STYLE: pretty @@ -11,6 +14,8 @@ jobs: fetch-supported-versions: name: Fetch supported versions runs-on: ubuntu-latest + permissions: + contents: read outputs: php-min: ${{ steps.fetch-php-versions.outputs.min }} php-max: ${{ steps.fetch-php-versions.outputs.max }} @@ -20,13 +25,15 @@ jobs: id: fetch-php-versions uses: yoanm/gha-supported-versions-parser@feature/init with: - dependency: php path: .github/workflows/supported-versions.json + dependency: php tests: name: ${{ matrix.job-name }} needs: [fetch-supported-versions] runs-on: ubuntu-latest + permissions: + contents: read env: COVERAGE_TYPE: none COVERAGE_OUTPUT_STYLE: clover @@ -116,6 +123,8 @@ jobs: name: Static analysis needs: [fetch-supported-versions] runs-on: ubuntu-latest + permissions: + contents: read env: PHP_VERSION: ${{ needs.fetch-supported-versions.outputs.php-max }} steps: @@ -158,6 +167,8 @@ jobs: name: Nightly needs: [ fetch-supported-versions, tests ] runs-on: ubuntu-latest + permissions: + contents: read continue-on-error: true env: PHP_VERSION: ${{ needs.fetch-supported-versions.outputs.php-next }} diff --git a/.github/workflows/reusable-coverage-upload-workflow.yml b/.github/workflows/reusable-coverage-upload-workflow.yml index 0f25cc64..a28b1600 100644 --- a/.github/workflows/reusable-coverage-upload-workflow.yml +++ b/.github/workflows/reusable-coverage-upload-workflow.yml @@ -8,6 +8,10 @@ on: CODECOV_TOKEN: required: true +permissions: + contents: read + checks: write # For the check run creation ! + jobs: fetch-info: name: Fetch triggering workflow metadata From d2b5684ddf3a85326bfb49ad24ea3f5b62fb6cc1 Mon Sep 17 00:00:00 2001 From: Yoanm <4410697+yoanm@users.noreply.github.com> Date: Sun, 31 Aug 2025 17:15:19 +0200 Subject: [PATCH 3/6] Enable nightly only for push or PR with specific label --- .github/workflows/reusable-CI-workflow.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/reusable-CI-workflow.yml b/.github/workflows/reusable-CI-workflow.yml index 022fcf49..1ad28459 100644 --- a/.github/workflows/reusable-CI-workflow.yml +++ b/.github/workflows/reusable-CI-workflow.yml @@ -166,6 +166,7 @@ jobs: nightly-tests: name: Nightly needs: [ fetch-supported-versions, tests ] + if: ${{ github.event == 'push' || ( github.event == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'with-nightly-tests') ) }} runs-on: ubuntu-latest permissions: contents: read From ab78b13839c4a69bf9b5fc61f2fc9b8b4b391c66 Mon Sep 17 00:00:00 2001 From: Yoanm <4410697+yoanm@users.noreply.github.com> Date: Sun, 31 Aug 2025 17:17:00 +0200 Subject: [PATCH 4/6] Trigger CI From 463caf25236a18faec44acd6d9557f68b80642f3 Mon Sep 17 00:00:00 2001 From: Yoanm <4410697+yoanm@users.noreply.github.com> Date: Sun, 31 Aug 2025 17:24:35 +0200 Subject: [PATCH 5/6] Fix --- .github/workflows/reusable-CI-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-CI-workflow.yml b/.github/workflows/reusable-CI-workflow.yml index 1ad28459..ec0814d2 100644 --- a/.github/workflows/reusable-CI-workflow.yml +++ b/.github/workflows/reusable-CI-workflow.yml @@ -166,7 +166,7 @@ jobs: nightly-tests: name: Nightly needs: [ fetch-supported-versions, tests ] - if: ${{ github.event == 'push' || ( github.event == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'with-nightly-tests') ) }} + if: ${{ github.event_name == 'push' || ( github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'with-nightly-tests') ) }} runs-on: ubuntu-latest permissions: contents: read From a0ed40582f07c4efecab232e451c361155c3883a Mon Sep 17 00:00:00 2001 From: Yoanm <4410697+yoanm@users.noreply.github.com> Date: Sun, 31 Aug 2025 17:26:58 +0200 Subject: [PATCH 6/6] Trigger CI