From a9d0746acdbf495186c54680111b2914c7681331 Mon Sep 17 00:00:00 2001 From: le0m Date: Fri, 18 Oct 2024 17:33:22 +0200 Subject: [PATCH] chore: add pipelines --- .github/dependabot.yml | 17 +++++++ .github/workflows/php.yml | 90 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 23 +++++++++ 3 files changed, 130 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/php.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..7741ce1 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,17 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + groups: + gh-actions: + patterns: ['actions/*'] + docker: + patterns: ['docker/*'] diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..374d009 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,90 @@ +name: 'php' + +on: + pull_request: + paths: + - '**/*.php' + - '.github/workflows/php.yml' + - 'composer.json' + push: + paths: + - '**/*.php' + - '.github/workflows/php.yml' + - 'composer.json' + +jobs: + cs: + name: 'Check coding style' + if: "!contains(github.event.commits[0].message, '[skip ci]') && !contains(github.event.commits[0].message, '[ci skip]')" + runs-on: 'ubuntu-latest' + strategy: + matrix: + php-version: ["8.2","8.3"] + steps: + - name: 'Checkout current revision' + uses: 'actions/checkout@v4' + + - name: 'Setup PHP' + uses: 'shivammathur/setup-php@v2' + with: + php-version: '${{ matrix.php-version }}' + tools: 'composer:v2' + extensions: 'mbstring, intl' + coverage: 'none' + + - name: 'Discover Composer cache directory' + id: 'cachedir' + run: echo "path=$(composer global config cache-dir)" >> $GITHUB_OUTPUT + + - name: 'Share Composer cache across runs' + uses: 'actions/cache@v4' + with: + path: '${{ steps.cachedir.outputs.path }}' + key: "composer-${{ github.job }}-${{ hashFiles('**/composer.json') }}" + restore-keys: | + composer-${{ github.job }}- + composer- + + - name: 'Install dependencies with Composer' + run: 'composer install --prefer-dist --no-interaction --ignore-platform-req=ext-opentelemetry' + + - name: 'Run PHP CodeSniffer' + run: vendor/bin/phpcs -n + + stan: + name: 'Static code analyzer' + if: "!contains(github.event.commits[0].message, '[skip ci]') && !contains(github.event.commits[0].message, '[ci skip]')" + runs-on: 'ubuntu-latest' + strategy: + matrix: + php-version: ["8.2","8.3"] + steps: + - name: 'Checkout current revision' + uses: 'actions/checkout@v4' + + - name: 'Setup PHP' + uses: 'shivammathur/setup-php@v2' + with: + php-version: '${{ matrix.php-version }}' + tools: 'composer:v2' + extensions: 'mbstring, intl' + coverage: 'none' + + - name: 'Discover Composer cache directory' + id: 'cachedir' + run: echo "path=$(composer global config cache-dir)" >> $GITHUB_OUTPUT + + - name: 'Share Composer cache across runs' + uses: 'actions/cache@v4' + with: + path: '${{ steps.cachedir.outputs.path }}' + key: "composer-${{ github.job }}-${{ hashFiles('**/composer.json') }}" + restore-keys: | + composer-${{ github.job }}- + composer- + + - name: 'Install dependencies with Composer' + run: 'composer install --prefer-dist --no-interaction --ignore-platform-req=ext-opentelemetry' + + - name: 'Run PHP STAN' + run: vendor/bin/phpstan analyse --no-progress --error-format=github diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e996bfa --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,23 @@ +name: Release + +on: + pull_request_target: + types: [closed] + workflow_dispatch: + inputs: + releaseType: + description: 'Release type' + required: true + default: 'patch' + type: choice + options: + - patch + - minor + - major +jobs: + release-job: + uses: bedita/github-workflows/.github/workflows/release.yml@v1 + with: + main_branch: 'main' + dist_branches: '["main"]' + version_bump: ${{ inputs.releaseType }}