name: Static analysis

on:
  pull_request:
  push:
    branches:
      - main
      - stable*

jobs:
  static-psalm-analysis:
      runs-on: ubuntu-latest
      strategy:
          matrix:
              ocp-version: [ 'dev-master', 'dev-stable23', 'dev-stable22', 'dev-stable21' ]
      name: Nextcloud ${{ matrix.ocp-version }}
      steps:
          - name: Checkout
            uses: actions/checkout@master
          - name: Set up php
            uses: shivammathur/setup-php@master
            with:
                php-version: 7.4
                tools: composer:v1
                coverage: none
          - name: Install dependencies
            run: composer i
          - name: Install dependencies
            run: composer require --dev christophwurst/nextcloud:${{ matrix.ocp-version }}
          - name: Run coding standards check
            run: composer run psalm
