Skip to content

Commit

Permalink
Add CI matrix generation workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-anne committed Jan 30, 2024
1 parent 1a99365 commit 1063c60
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/generate-ci-matrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "Generate CI matrix"

on:
workflow_call:
inputs:
glpi-version:
required: true
type: string
outputs:
matrix:
value: ${{ jobs.generate-ci-matrix.outputs.matrix }}

jobs:
generate-ci-matrix:
name: "Generate CI matrix"
runs-on: "ubuntu-latest"
outputs:
matrix: ${{ steps.generate-ci-matrix.outputs.matrix }}
steps:
- name: "Generate CI matrix"
id: "generate-ci-matrix"
run: |
if [[ "${{ inputs.glpi-version }}" = "10.0.x" ]]; then
MATRIX='
{
"include": [
{"glpi-version": "10.0.x", "php-version": "7.4", "db-image": "mysql:8.0"},
{"glpi-version": "10.0.x", "php-version": "8.0", "db-image": "mysql:8.0"},
{"glpi-version": "10.0.x", "php-version": "8.1", "db-image": "mysql:8.0"},
{"glpi-version": "10.0.x", "php-version": "8.2", "db-image": "mysql:8.0"},
{"glpi-version": "10.0.x", "php-version": "8.3", "db-image": "mysql:8.0"},
{"glpi-version": "10.0.x", "php-version": "8.3", "db-image": "mysql:5.7"},
{"glpi-version": "10.0.x", "php-version": "8.3", "db-image": "mariadb:10.2"},
{"glpi-version": "10.0.x", "php-version": "8.3", "db-image": "mariadb:10.11"}
]
}
'
elif [[ "${{ inputs.glpi-version }}" = "10.1.x" ]]; then
MATRIX='
{
"include": [
{"glpi-version": "10.1.x", "php-version": "8.1", "db-image": "mysql:8.0"},
{"glpi-version": "10.1.x", "php-version": "8.2", "db-image": "mysql:8.0"},
{"glpi-version": "10.1.x", "php-version": "8.3", "db-image": "mysql:8.0"},
{"glpi-version": "10.1.x", "php-version": "8.3", "db-image": "mariadb:10.5"},
{"glpi-version": "10.1.x", "php-version": "8.3", "db-image": "mariadb:10.11"}
]
}
'
fi
echo "matrix=$(echo $MATRIX | jq -c .)" >> $GITHUB_OUTPUT

0 comments on commit 1063c60

Please sign in to comment.