From cc6f0ad2728d5dc2101ed2a5081bf3837ad6f2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Bouc=CC=8Cek?= Date: Sat, 28 Oct 2023 21:45:16 +0200 Subject: [PATCH] CI: Update new GH env, add PHP versions up to 8.3 --- .gitattributes | 4 ++ .github/workflows/code-analysis.yaml | 54 ++++++++++++++++++++++++ .github/workflows/code_analysis.yaml | 62 ---------------------------- 3 files changed, 58 insertions(+), 62 deletions(-) create mode 100644 .gitattributes create mode 100644 .github/workflows/code-analysis.yaml delete mode 100644 .github/workflows/code_analysis.yaml diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..91becc0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +.gitattributes export-ignore +.gitignore export-ignore +.github export-ignore +phpstan.neon export-ignore diff --git a/.github/workflows/code-analysis.yaml b/.github/workflows/code-analysis.yaml new file mode 100644 index 0000000..0f758a8 --- /dev/null +++ b/.github/workflows/code-analysis.yaml @@ -0,0 +1,54 @@ +name: Code analysis + +on: + push: + pull_request: + +# Cancels all previous workflow runs for the same branch that have not yet completed. +concurrency: + # The concurrency group contains the workflow name and the branch name. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + static-analysis: + strategy: + fail-fast: false + matrix: + php: + - "7.2" + - "7.3" + - "7.4" + - "8.0" + - "8.1" + - "8.2" + - "8.3" + name: PHPStan at PHP ${{ matrix.php }} + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - name: Get Composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install Composer dependencies + run: composer update --no-progress + + - name: Statically analyze code (PHPStan) + run: composer run phpstan -- --ansi diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml deleted file mode 100644 index a43e1e2..0000000 --- a/.github/workflows/code_analysis.yaml +++ /dev/null @@ -1,62 +0,0 @@ -name: Code Analysis - -on: - pull_request: - push: - branches: - - master - -jobs: - code_analysis: - strategy: - fail-fast: false - matrix: - actions: - - name: PHPStan - run: composer phpstan - - php: - - name: PHP 7.3 - version: 7.3 - - - name: PHP 7.4 - version: 7.4 - - - name: PHP 8.0 - version: 8.0 - - name: ${{ matrix.actions.name }} on ${{ matrix.php.name }} - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - # see https://github.com/shivammathur/setup-php - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php.version }} - coverage: none - - - # see https://github.com/actions/cache/blob/main/examples.md#php---composer - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - - uses: actions/cache@v2 - with: - path: | - ${{ steps.composer-cache.outputs.dir }} - **/composer.lock - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - ${{ runner.os }}-composer- - - - - name: Install Composer - run: composer install --no-progress - - - run: ${{ matrix.actions.run }}