Skip to content

Commit 417aca0

Browse files
authored
Split Nightly tests (#151)
1 parent 6739ffa commit 417aca0

File tree

8 files changed

+133
-43
lines changed

8 files changed

+133
-43
lines changed

.github/workflows/CI.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ on: # Build any PRs and main branch changes
1414
- '.github/workflows/coverage-upload.yml'
1515
- '.github/workflows/reusable-CI-workflow.yml'
1616
- '.github/workflows/reusable-coverage-upload-workflow.yml'
17+
- '.github/workflows/reusable-nightly-tests-workflow.yml'
1718
- '.github/workflows/auto-merge-dependabot.yml'
1819
push:
1920
branches: [ master ]
2021
schedule:
2122
- cron: '0 0 1 * *' # Every month
2223

24+
permissions:
25+
contents: read
26+
2327
concurrency:
2428
group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}"
2529
cancel-in-progress: true

.github/workflows/auto-merge-dependabot.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ permissions:
77

88
jobs:
99
dependabot:
10-
runs-on: ubuntu-latest
1110
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'yoanm/php-jsonrpc-server-sdk'
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
1215
steps:
1316
- name: Dependabot metadata
1417
id: metadata

.github/workflows/coverage-upload.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
workflows: ["CI"]
55
types: [completed]
66

7+
permissions:
8+
contents: read
9+
checks: write # For the check run creation !
10+
711
jobs:
812
upload:
913
name: Coverage
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: 'Nightly'
2+
on:
3+
workflow_run:
4+
workflows: ["CI"]
5+
types: [completed]
6+
7+
permissions:
8+
contents: read
9+
checks: write # For the check run creation !
10+
11+
jobs:
12+
tests:
13+
name: Tests
14+
permissions:
15+
contents: read
16+
checks: write # For the check run creation !
17+
uses: ./.github/workflows/reusable-nightly-tests-workflow.yml

.github/workflows/pre-check-CI-updates.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ on:
1616
- '.github/workflows/coverage-upload.yml'
1717
- '.github/workflows/reusable-CI-workflow.yml'
1818
- '.github/workflows/reusable-coverage-upload-workflow.yml'
19+
- '.github/workflows/reusable-nightly-tests-workflow.yml'
1920
- '.github/workflows/auto-merge-dependabot.yml'
2021

22+
permissions:
23+
contents: read
24+
checks: write # For the check run creation !
25+
2126
concurrency:
2227
group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}"
2328
cancel-in-progress: true
@@ -29,6 +34,14 @@ jobs:
2934
contents: read
3035
uses: ./.github/workflows/reusable-CI-workflow.yml
3136

37+
nightly:
38+
name: Nightly
39+
needs: [tests]
40+
permissions:
41+
contents: read
42+
checks: write # For the check run creation !
43+
uses: ./.github/workflows/reusable-nightly-tests-workflow.yml
44+
3245
upload:
3346
name: Coverage
3447
needs: [tests]

.github/workflows/reusable-CI-workflow.yml

Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@ env:
77
COMPOSER_PREFER_STABLE: '1'
88
TEST_OUTPUT_STYLE: pretty
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
fetch-supported-versions:
1215
name: Fetch supported versions
1316
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
1419
outputs:
1520
php-min: ${{ steps.fetch-php-versions.outputs.min }}
1621
php-max: ${{ steps.fetch-php-versions.outputs.max }}
@@ -20,13 +25,15 @@ jobs:
2025
id: fetch-php-versions
2126
uses: yoanm/gha-supported-versions-parser@feature/init
2227
with:
23-
dependency: php
2428
path: .github/workflows/supported-versions.json
29+
dependency: php
2530

2631
tests:
2732
name: ${{ matrix.job-name }}
2833
needs: [fetch-supported-versions]
2934
runs-on: ubuntu-latest
35+
permissions:
36+
contents: read
3037
env:
3138
COVERAGE_TYPE: none
3239
COVERAGE_OUTPUT_STYLE: clover
@@ -116,6 +123,8 @@ jobs:
116123
name: Static analysis
117124
needs: [fetch-supported-versions]
118125
runs-on: ubuntu-latest
126+
permissions:
127+
contents: read
119128
env:
120129
PHP_VERSION: ${{ needs.fetch-supported-versions.outputs.php-max }}
121130
steps:
@@ -153,44 +162,3 @@ jobs:
153162
- name: Dependencies check
154163
if: ${{ github.event_name == 'pull_request' }}
155164
uses: actions/dependency-review-action@v4
156-
157-
nightly-tests:
158-
name: Nightly
159-
needs: [ fetch-supported-versions, tests ]
160-
runs-on: ubuntu-latest
161-
continue-on-error: true
162-
env:
163-
PHP_VERSION: ${{ needs.fetch-supported-versions.outputs.php-next }}
164-
COMPOSER_IGNORE_PLATFORM_REQ: 'php+'
165-
steps:
166-
- name: Check out code
167-
uses: actions/checkout@v5
168-
169-
- name: Setup PHP ${{ env.PHP_VERSION }}
170-
id: setup-php
171-
uses: shivammathur/setup-php@v2
172-
env:
173-
update: true # whether to use latest available patch for the version or not
174-
fail-fast: true # step will fail if an extension or tool fails to set up
175-
with:
176-
php-version: ${{ env.PHP_VERSION }}
177-
tools: composer
178-
coverage: none
179-
180-
- name: Get composer cache directory
181-
id: composer-cache
182-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
183-
184-
- name: Setup cache for PHP ${{ steps.setup-php.outputs.php-version }}
185-
uses: actions/cache@v4
186-
with:
187-
path: |
188-
${{ steps.composer-cache.outputs.dir }}
189-
# Clear the cache if composer.json (as composer.lock is not available) has been updated
190-
key: tests-php${{ steps.setup-php.outputs.php-version }}-${{ hashFiles('composer.json') }}
191-
192-
- name: Build with PHP ${{ steps.setup-php.outputs.php-version }}
193-
run: make build
194-
195-
- name: Test
196-
run: make test-unit && make test-functional

.github/workflows/reusable-coverage-upload-workflow.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
CODECOV_TOKEN:
99
required: true
1010

11+
permissions:
12+
contents: read
13+
checks: write # For the check run creation !
14+
1115
jobs:
1216
fetch-info:
1317
name: Fetch triggering workflow metadata
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: 'Nightly reusable workflow'
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
ref:
7+
description: Reference in order to fetch code
8+
type: string
9+
required: false
10+
default: "${{ github.event.workflow_run && github.event.workflow_run.referenced_workflows[0] && github.event.workflow_run.referenced_workflows[0].ref || github.ref }}"
11+
12+
env:
13+
COMPOSER_PREFER_STABLE: '1'
14+
TEST_OUTPUT_STYLE: pretty
15+
16+
permissions:
17+
contents: read
18+
checks: write # For the check run creation !
19+
20+
jobs:
21+
tests:
22+
name: PHP
23+
permissions:
24+
contents: read
25+
checks: write # For the check run creation !
26+
runs-on: ubuntu-latest
27+
continue-on-error: true
28+
env:
29+
COMPOSER_IGNORE_PLATFORM_REQ: 'php+'
30+
steps:
31+
- name: 'Check run ○'
32+
uses: yoanm/temp-reports-group-workspace/utils/attach-check-run-to-triggering-workflow@v0
33+
with:
34+
name: 'Nightly / PHP'
35+
fails-on-triggering-workflow-failure: true
36+
37+
- name: Fetch PHP supported versions
38+
id: fetch-php-versions
39+
uses: yoanm/gha-supported-versions-parser@feature/init
40+
with:
41+
dependency: php
42+
path: .github/workflows/supported-versions.json
43+
ref: "${{ inputs.ref }}"
44+
45+
- name: Check out code
46+
uses: actions/checkout@v5
47+
with:
48+
ref: "${{ inputs.ref }}"
49+
50+
- name: Setup PHP ${{ steps.fetch-php-versions.outputs.next }}
51+
id: setup-php
52+
uses: shivammathur/setup-php@v2
53+
env:
54+
update: true # whether to use latest available patch for the version or not
55+
fail-fast: true # step will fail if an extension or tool fails to set up
56+
with:
57+
php-version: ${{ steps.fetch-php-versions.outputs.next }}
58+
tools: composer
59+
coverage: none
60+
61+
- name: Get composer cache directory
62+
id: composer-cache
63+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
64+
65+
- name: Setup cache for PHP ${{ steps.setup-php.outputs.php-version }}
66+
uses: actions/cache@v4
67+
with:
68+
path: |
69+
${{ steps.composer-cache.outputs.dir }}
70+
# Clear the cache if composer.json (as composer.lock is not available) has been updated
71+
key: tests-php${{ steps.setup-php.outputs.php-version }}-${{ hashFiles('composer.json') }}
72+
73+
- name: Build with PHP ${{ steps.setup-php.outputs.php-version }}
74+
run: make build
75+
76+
- name: Test
77+
run: make test-unit && make test-functional

0 commit comments

Comments
 (0)