summaryrefslogtreecommitdiffstats
path: root/.github/workflows/lint-php.yml
blob: 6c520e1c1d15541fad8fff566f47a166cf935744 (plain)
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
60
61
62
63
64
65
66
67
68
69
70
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
#
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT

name: Lint php

on: pull_request

permissions:
  contents: read

concurrency:
  group: lint-php-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

jobs:
  matrix:
    runs-on: ubuntu-latest-low
    outputs:
      php-versions: ${{ steps.versions.outputs.php-versions }}
    steps:
      - name: Checkout app
        uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
      - name: Get version matrix
        id: versions
        uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.0.0

  php-lint:
    runs-on: ubuntu-latest
    needs: matrix
    strategy:
      matrix:
        php-versions: ${{fromJson(needs.matrix.outputs.php-versions)}}

    name: php-lint

    steps:
      - name: Checkout
        uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4

      - name: Set up php ${{ matrix.php-versions }}
        uses: shivammathur/setup-php@c665c7a15b5295c2488ac8a87af9cb806cd72198 # v2
        with:
          php-version: ${{ matrix.php-versions }}
          extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
          coverage: none
          ini-file: development
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Lint
        run: composer run lint

  summary:
    permissions:
      contents: none
    runs-on: ubuntu-latest-low
    needs: php-lint

    if: always()

    name: php-lint-summary

    steps:
      - name: Summary status
        run: if ${{ needs.php-lint.result != 'success' && needs.php-lint.result != 'skipped' }}; then exit 1; fi