Skip to content

Fix pipeline matrix extraction #20

Fix pipeline matrix extraction

Fix pipeline matrix extraction #20

Workflow file for this run

name: CI
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
PLUGIN_PATH: Customizing/global/libs/ilias-plugin-utils
MATRIX: |
{
"release/7": {"php": ["7.4"], "ilias": ["release_7"]},
"release/8": {"php": ["8.0"], "ilias": ["release_8"]}
}
on:
push:
branches:
- release/*
pull_request:
jobs:
build-matrix:
if: "!contains(github.event.head_commit.message, '[CI SKIP]')"
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: echo "matrix=$(echo $MATRIX | jq -c --arg branch $BRANCH_NAME '.[$branch]')" >> "$GITHUB_OUTPUT"
PHPUnit:
if: "!contains(github.event.head_commit.message, '[CI SKIP]')"
needs: build-matrix
name: Check (ILIAS ${{ matrix.ilias }} PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
with:
repository: ILIAS-eLearning/ILIAS
ref: ${{ matrix.ilias }}
- uses: actions/checkout@v4
with:
path: ${{ env.PLUGIN_PATH }}
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
ini-file: development
- run: composer install
working-directory: ${{ env.PLUGIN_PATH }}
- run: composer install --no-dev
- run: vendor/bin/phpunit --coverage-text --coverage-clover=clover.xml
working-directory: ${{ env.PLUGIN_PATH }}
- name: Check 100% code coverage
shell: php {0}
run: |
<?php
$metrics = simplexml_load_file('clover.xml')->project->metrics;
exit((int) $metrics['statements'] === (int) $metrics['coveredstatements'] ? 0 : 1);
working-directory: ${{ env.PLUGIN_PATH }}