Code development platform for open source projects from the European Union institutions

Commit d5ba972b authored by Pol Dellaiera's avatar Pol Dellaiera
Browse files

ci: update workflow

parent f6e2c6fe
Loading
Loading
Loading
Loading
+25 −32
Original line number Diff line number Diff line
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

on:
    - pull_request
    - push
    push:
        branches:
            - master
    pull_request:

name: "Continuous Integration"

jobs:
    run:
        name: "Grumphp"
    supported-versions-matrix:
        name: Supported Versions Matrix
        runs-on: ubuntu-latest
        outputs:
            version: ${{ steps.supported-versions-matrix.outputs.version }}
        steps:
            - uses: actions/checkout@v3
            - id: supported-versions-matrix
              uses: WyriHaximus/github-action-composer-php-versions-in-range@v1
    tests:
        name: "Unit Tests"
        runs-on: ${{ matrix.operating-system }}
        needs:
            - supported-versions-matrix
        strategy:
            fail-fast: false
            matrix:
                operating-system: [ubuntu-latest, windows-latest, macOS-latest]
                php-versions: ['7.4', '8.1']

                php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
        steps:
            - name: Set git to use LF
              run: |
@@ -23,41 +35,22 @@ jobs:
                  git config --global core.eol lf

            - name: Checkout
              uses: actions/checkout@master
              with:
                  fetch-depth: 1
              uses: actions/checkout@v3

            - name: Install PHP
              uses: shivammathur/setup-php@master
              with:
                  php-version: ${{ matrix.php-versions }}
                  extensions: xdebug,mbstring

            - name: Get Composer Cache Directory
              id: composer-cache
              run: echo "::set-output name=dir::$(composer config cache-files-dir)"

            - name: Cache dependencies
              uses: actions/cache@v3.0.11
              uses: shivammathur/setup-php@v2
              with:
                  path: ${{ steps.composer-cache.outputs.dir }}
                  key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
                  restore-keys: ${{ runner.os }}-composer-
                  php-version: ${{ matrix.php }}
                  coverage: pcov

            - name: Install dependencies
              run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
              uses: ramsey/composer-install@v2

            - name: Run Grumphp
              run: vendor/bin/grumphp run
              env:
                  STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

            - name: Send PSALM data
              run: vendor/bin/psalm --shepherd --stats src/
              continue-on-error: true

            - name: Send Scrutinizer data
              run: |
                  wget https://scrutinizer-ci.com/ocular.phar
                  php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
                  composer require scrutinizer/ocular --dev
                  vendor/bin/ocular code-coverage:upload --format=php-clover build/logs/coverage/clover.xml
              continue-on-error: true