diff --git a/.github/workflows/moodle-ci.yml b/.github/workflows/moodle-ci.yml index 75312bb..b86b367 100644 --- a/.github/workflows/moodle-ci.yml +++ b/.github/workflows/moodle-ci.yml @@ -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: @@ -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 }} diff --git a/README.md b/README.md index 4447447..e0fcf86 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/plugin_compatibility.json b/plugin_compatibility.json new file mode 100644 index 0000000..5510194 --- /dev/null +++ b/plugin_compatibility.json @@ -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"] + } +] \ No newline at end of file