xref: /plugin/openlayersmap/.github/workflows/CI.yml (revision 53f2535c19036e64d556e829f2a42aa8cc68101f)
1name: CI
2
3on: [ push, pull_request, workflow_dispatch ]
4
5permissions:
6  contents: read
7
8jobs:
9  test:
10    name: PHP Unit
11    runs-on: ubuntu-latest
12
13    strategy:
14      matrix:
15        php-version: [ '8.0', '8.1', '8.2', '8.3' ]
16        dokuwiki-branch: [ 'master', 'stable' ]
17      fail-fast: false
18
19    steps:
20      - uses: actions/checkout@v4
21
22      - name: Setup PHP
23        uses: shivammathur/setup-php@v2
24        with:
25          php-version: ${{ matrix.php-version }}
26          extensions: mbstring, intl, bz2, gd, imagick
27          ini-values: pcre.jit=0
28
29      - name: Setup problem matchers
30        run: |
31          echo ::add-matcher::${{ runner.tool_cache }}/php.json
32          echo ::add-matcher::${{ runner.tool_cache }}/phpunit.json
33
34      - name: Download DokuWiki Test-setup
35        run: wget https://raw.github.com/splitbrain/dokuwiki-travis/master/travis.sh
36
37      - name: Install DokuWiki and required plugins
38        id: dokuwiki-env
39        uses: dokuwiki/github-action/.github/actions/dokuenv@main
40        with:
41          branch: ${{ matrix.dokuwiki-branch }}
42
43      - name: Install Composer Dependencies
44        run: |
45          cd _test
46          composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader --no-scripts
47
48      - name: Setup PHPUnit
49        # old branches
50        run: |
51          if [ -f _test/fetchphpunit.php ]; then
52            php _test/fetchphpunit.php
53          fi
54
55      - name: Run PHPUnit
56        run: |
57          cd _test
58          if [ -f phpunit.phar ]; then
59            php phpunit.phar --verbose --stderr --group ${{ steps.dokuwiki-env.outputs.type }}_${{ steps.dokuwiki-env.outputs.base }}
60          else
61            composer exec -- phpunit --verbose --stderr --group ${{ steps.dokuwiki-env.outputs.type }}_${{ steps.dokuwiki-env.outputs.base }}
62          fi
63