mirrored from git://develop.git.wordpress.org/
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
124 lines (114 loc) · 5.36 KB
/
reusable-support-json-reader-v1.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
##
# A reusable workflow that reads the .version-support-*.json files and returns values for use in a
# test matrix based on a given WordPress version.
##
name: Determine test matrix values
on:
workflow_call:
inputs:
wp-version:
description: 'The WordPress version to test . Accepts major and minor versions, "latest", or "nightly". Major releases must not end with ".0".'
type: string
default: 'nightly'
repository:
description: 'The repository to read support JSON files from.'
type: string
default: 'WordPress/wordpress-develop'
outputs:
major-wp-version:
description: "The major WordPress version based on the version provided in wp-version"
value: ${{ jobs.major-wp-version.outputs.version }}
php-versions:
description: "The PHP versions to test for the given wp-version"
value: ${{ jobs.php-versions.outputs.versions }}
mysql-versions:
description: "The MySQL versions to test for the given wp-version"
value: ${{ jobs.mysql-versions.outputs.versions }}
jobs:
# Determines the major version of WordPress being tested.
#
# The data in the JSON files are indexed by major version, so this is used to look up the appropriate support policy.
#
# Performs the following steps:
# - Checks out the repository
# - Returns the major WordPress version as an output based on the value passed to the wp-version input.
major-wp-version:
name: Determine major WordPress version
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
version: ${{ steps.major-wp-version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: ${{ inputs.repository }}
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
- name: Determine the major WordPress version
id: major-wp-version
run: |
if [ "${{ inputs.wp-version }}" ] && [ "${{ inputs.wp-version }}" != "nightly" ] && [ "${{ inputs.wp-version }}" != "latest" ] && [ "${{ inputs.wp-version }}" != "trunk" ]; then
echo "version=$(echo "${{ inputs.wp-version }}" | tr '.' '-' | cut -d '-' -f1-2)" >> $GITHUB_OUTPUT
elif [ "${{ inputs.wp-version }}" ] && [ "${{ inputs.wp-version }}" != "trunk" ]; then
echo "version=$(echo "${{ inputs.wp-version }}")" >> $GITHUB_OUTPUT
else
echo "version=nightly" >> $GITHUB_OUTPUT
fi
# Determines the versions of PHP supported for a version of WordPress.
#
# Performs the following steps:
# - Checks out the repository
# - Returns the versions of PHP supported for the major version of WordPress by parsing the
# .version-support-php.json file and returning the values in that version's index.
php-versions:
name: Determine PHP versions
runs-on: ubuntu-latest
needs: [ major-wp-version ]
timeout-minutes: 5
outputs:
versions: ${{ steps.php-versions.outputs.versions }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: ${{ inputs.repository }}
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
# Look up the major version's specific PHP support policy when a version is provided.
# Otherwise, use the current PHP support policy.
- name: Get supported PHP versions
id: php-versions
run: |
if [ "${{ needs.major-wp-version.outputs.version }}" != "latest" ] && [ "${{ needs.major-wp-version.outputs.version }}" != "nightly" ]; then
echo "versions=$(jq -r '.["${{ needs.major-wp-version.outputs.version }}"] | @json' .version-support-php.json)" >> $GITHUB_OUTPUT
else
echo "versions=$(jq -r '.[ (keys[-1]) ] | @json' .version-support-php.json)" >> $GITHUB_OUTPUT
fi
# Determines the versions of MySQL supported for a version of WordPress.
#
# Performs the following steps:
# - Checks out the repository
# - Returns the versions of MySQL supported for the major version of WordPress by parsing the
# .version-support-mysql.json file and returning the values in that version's index.
mysql-versions:
name: Determine MySQL versions
runs-on: ubuntu-latest
needs: [ major-wp-version ]
timeout-minutes: 5
outputs:
versions: ${{ steps.mysql-versions.outputs.versions }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: ${{ inputs.repository }}
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
# Look up the major version's specific MySQL support policy when a version is provided.
# Otherwise, use the current MySQL support policy.
- name: Get supported MySQL versions
id: mysql-versions
run: |
if [ "${{ needs.major-wp-version.outputs.version }}" != "latest" ] && [ "${{ needs.major-wp-version.outputs.version }}" != "nightly" ]; then
echo "versions=$(jq -r '.["${{ needs.major-wp-version.outputs.version }}"] | @json' .version-support-mysql.json)" >> $GITHUB_OUTPUT
else
echo "versions=$(jq -r '.[ (keys[-1]) ] | @json' .version-support-mysql.json)" >> $GITHUB_OUTPUT
fi