Skip to content

Commit

Permalink
refactor list of compatible moodle and php versions to a separate mac…
Browse files Browse the repository at this point in the history
…hine-readable file plugin_compatibility.json and use it's content to populate the pipelines execution matrix
  • Loading branch information
Glutamat42 committed Oct 31, 2024
1 parent 1f37110 commit 8088bfe
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 16 deletions.
46 changes: 38 additions & 8 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,42 @@ on:
- '**'

jobs:
define-matrix:
runs-on: ubuntu-latest

outputs:
include_list: ${{ steps.include_list.outputs.include_list }}

steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Define matrix
id: include_list
run: |
# Generates a json array with include entries for all possible combinations of PHP, Moodle branch and database
include_str="["
first_entry=true
for i in $(cat plugin_compatibility.json | jq -c '.[]'); do
moodle=$(echo "$i" | jq -r '.moodle')
for php in $(echo "$i" | jq -r '.PHP[]'); do
for database in pgsql mariadb; do
if [ "$first_entry" = true ]; then
first_entry=false
else
include_str="$include_str,"
fi
next_entry="{\"php\": \"$php\", \"moodle-branch\": \"$moodle\", \"database\": \"$database\", \"experimental\": false}"
include_str="$include_str$next_entry"
done
done
done
include_str="$include_str]"
echo "include_list=$include_str" >> "$GITHUB_OUTPUT"
test:
runs-on: ubuntu-22.04
needs: define-matrix

services:
postgres:
Expand All @@ -38,15 +72,11 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3']
moodle-branch: ['MOODLE_404_STABLE', 'MOODLE_405_STABLE']
php: ['8.3']
moodle-branch: ['main']
database: [pgsql, mariadb]
experimental: [false]
include:
- php: '8.3'
moodle-branch: 'main'
database: mariadb
experimental: true
experimental: [true]
include: ${{ fromJSON(needs.define-matrix.outputs.include_list) }}

continue-on-error: ${{ matrix.experimental }}

Expand Down
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,7 @@
## Kompabilität
Folgende Versionen werden unterstützt (mit mariadb und postresql getestet):

| Moodle Branch | PHP Version |
|-------------------------|-------------|
| MOODLE_404_STABLE | 8.1 |
| MOODLE_404_STABLE | 8.2 |
| MOODLE_404_STABLE | 8.3 |
| MOODLE_405_STABLE (LTS) | 8.1 |
| MOODLE_405_STABLE (LTS) | 8.2 |
| MOODLE_405_STABLE (LTS) | 8.3 |
siehe [plugin_compatibility.json](plugin_compatibility.json)



Expand Down
10 changes: 10 additions & 0 deletions plugin_compatibility.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"moodle": "MOODLE_404_STABLE",
"PHP": ["8.1", "8.2", "8.3"]
},
{
"moodle": "MOODLE_405_STABLE",
"PHP": ["8.1", "8.2", "8.3"]
}
]

0 comments on commit 8088bfe

Please sign in to comment.