-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (55 loc) · 1.83 KB
/
ci.yaml
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
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 "::set-output name=matrix::$(echo $MATRIX | jq -c --arg branch $BRANCH_NAME '.[$branch]')"
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 }}