Use phpstan to analyse magento code in CI/CD

Analyse with phpstan a standalone third party magento module on github with magento-actions (full sample):


name: m2-actions-sips2-test

on: [push]

jobs:
  magento2-build:
    runs-on: ubuntu-latest
    container: ubuntu
    name: 'm2 tests & build'

    steps:

      - uses: actions/checkout@v3
        with:
          path: Custom_Module

      - name: 'install fresh magento repo'
        uses: MAD-I-T/magento-actions@v3.20
        env:
          COMPOSER_AUTH: ${{secrets.COMPOSER_AUTH}}
        with:
          process: 'install-magento'
          magento_version: 2.4.6
          no_push: 1   ## add this arg to not push to the repo ideal for quick test on specific version
          
      - name: 'phpstan'
        if: always()
        uses: MAD-I-T/magento-actions@v3.20
        with:
          process: 'phpstan'
          exec_path: '../Custom_Module/'

Use phpstan to analyse your magento code on gitlab CI with gitlab-ci-magento :

include:
  - remote: 'https://raw.githubusercontent.com/MAD-I-T/gitlab-ci-magento/main/.magento-actions-full-template.yml'

mess-detector:
  variables:
    INPUT_PROCESS: "mess-detector"
    INPUT_MD_PATH: 'magento/vendor/magento/module-email' # path to the src to mess detect
  extends: .mess-detector:test:stage