Skip to content

Commit

Permalink
Update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-helldar committed Dec 19, 2023
1 parent 15c74a0 commit 06fc3e3
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 53 deletions.
50 changes: 0 additions & 50 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,53 +24,3 @@ jobs:
with:
github_token: ${{ secrets.COMPOSER_TOKEN }}
fix: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}

normalize:
needs: style

runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
file:
- src/Core
- src/Cash
- src/SberAuth
- src/SberOnline
- src/SberQrCode
- src/TinkoffAuth
- src/TinkoffCredit
- src/TinkoffOnline
- src/TinkoffQrCode
- src/TemplateDriver
- src/TemplateDriverAuth

if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}

steps:
- name: Git setup
if: success()
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Install dependency
run: composer global require ergebnis/composer-normalize

- name: Normalize composer.json
id: normalizer
run: |
IS_DIRTY=1
composer normalize ${{ matrix.file }}/composer.json
{ git add . && git commit -a -m "Normalized \`composer.json\` files"; } || IS_DIRTY_0
echo "is_dirty=${IS_DIRTY}" >> $GITHUB_OUTPUT
- name: Push changes
uses: ad-m/github-push-action@master
if: steps.normalizer.outputs.is_dirty == 1
with:
github_token: ${{ secrets.COMPOSER_TOKEN }}
62 changes: 62 additions & 0 deletions .github/workflows/composer_normalize.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Normalize composer.json

on: [ push, pull_request ]

permissions: write-all

jobs:
normalize:
needs: style

runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
package:
- Core
- Cash
- SberAuth
- SberOnline
- SberQrCode
- TinkoffAuth
- TinkoffCredit
- TinkoffOnline
- TinkoffQrCode
- TemplateDriver
- TemplateDriverAuth

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, json
coverage: none

- name: Git setup
if: success()
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Install dependency
run: composer global require ergebnis/composer-normalize

- name: Normalize composer.json
id: normalizer
run: composer normalize src/${{ matrix.package }}/composer.json

{ git add . && git commit -a -m "Normalized \`composer.json\` files"; }

- name: Create a Pull Request
uses: peter-evans/create-pull-request@v5
with:
branch: normalize/package
branch-suffix: random
delete-branch: true
add-paths: src/${{ matrix.package }}/composer.json
title: "[${{ matrix.package }}]: Normalized \`composer.json\`"
commit-message: Normalized \`composer.json\`
6 changes: 3 additions & 3 deletions .github/workflows/databases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: true
matrix:
db: [ "5.7", "8" ]
db: [ "8" ]

name: MySQL ${{ matrix.db }}

Expand Down Expand Up @@ -41,7 +41,7 @@ jobs:
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --optimize-autoloader

- name: Execute tests
run: vendor/bin/pest --colors=always
run: vendor/bin/pest --colors=always
env:
DB_CONNECTION: mysql
DB_USERNAME: root
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
strategy:
fail-fast: true
matrix:
db: [ "14", "15" ]
db: [ "14", "15", "16" ]

name: PostgreSQL ${{ matrix.db }}

Expand Down

0 comments on commit 06fc3e3

Please sign in to comment.