Skip to content

Commit

Permalink
Lint yaml files and Using semantic versions (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
kayw-geek authored Aug 14, 2023
1 parent 720af47 commit 05c8158
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 93 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

[*.{yml,yaml}]
indent_size = 2
36 changes: 17 additions & 19 deletions .github/workflows/bare_run.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
name: Bare Run on various PHP versions

on:
push:
tags:
- '*.72'
push:
tags:
- '*'

jobs:
bare_run:
runs-on: ubuntu-latest
bare_run:
if: git tag -l --format='%(contents)' $(git describe --tags $(git rev-list --tags --max-count=1)) |grep -q "PHP 7.2 downgraded"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php_version: ['7.2', '7.3', '7.4', '8.0']
steps:
- uses: actions/checkout@v3

strategy:
fail-fast: false
matrix:
php_version: ['7.2', '7.3', '7.4', '8.0']
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_version }}
coverage: none

steps:
- uses: actions/checkout@v3

-
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_version }}
coverage: none

- run: php bin/monorepo-builder list --ansi
- run: php bin/monorepo-builder list --ansi
108 changes: 52 additions & 56 deletions .github/workflows/code_analysis.yaml
Original file line number Diff line number Diff line change
@@ -1,61 +1,57 @@
name: Code Analysis

on:
pull_request: null
push:
branches:
- main
pull_request: null
push:
branches:
- main

jobs:
code_analysis:
strategy:
fail-fast: false
matrix:
actions:
-
name: 'PHPStan'
run: composer phpstan --ansi

-
name: 'Composer Validate'
run: composer validate --ansi

-
name: 'Rector'
run: composer rector --ansi

-
name: 'Coding Standard'
run: composer fix-cs --ansi

-
name: 'Tests'
run: vendor/bin/phpunit --testdox

-
name: 'PHP Linter'
run: vendor/bin/parallel-lint src tests

-
name: 'Check Commented Code'
run: vendor/bin/easy-ci check-commented-code src tests --ansi

-
name: 'Check Active Classes'
run: vendor/bin/class-leak check src packages bin --ansi --skip-type="Symplify\MonorepoBuilder\Release\Contract\ReleaseWorker\ReleaseWorkerInterface" --skip-type="\Symplify\MonorepoBuilder\Merge\Contract\ComposerKeyMergerInterface" --skip-type="\Symplify\MonorepoBuilder\Merge\Contract\ComposerJsonDecoratorInterface"

name: ${{ matrix.actions.name }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
# see https://github.com/shivammathur/setup-php
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none

# composer install cache - https://github.com/ramsey/composer-install
- uses: "ramsey/composer-install@v2"

- run: ${{ matrix.actions.run }}
code_analysis:
strategy:
fail-fast: false
matrix:
actions:
-
name: 'PHPStan'
run: composer phpstan --ansi

-
name: 'Composer Validate'
run: composer validate --ansi

-
name: 'Rector'
run: composer rector --ansi

-
name: 'Coding Standard'
run: composer fix-cs --ansi

-
name: 'Tests'
run: vendor/bin/phpunit --testdox

-
name: 'PHP Linter'
run: vendor/bin/parallel-lint src tests

-
name: 'Check Commented Code'
run: vendor/bin/easy-ci check-commented-code src tests --ansi

-
name: 'Check Active Classes'
run: vendor/bin/class-leak check src packages bin --ansi --skip-type="Symplify\MonorepoBuilder\Release\Contract\ReleaseWorker\ReleaseWorkerInterface" --skip-type="\Symplify\MonorepoBuilder\Merge\Contract\ComposerKeyMergerInterface" --skip-type="\Symplify\MonorepoBuilder\Merge\Contract\ComposerJsonDecoratorInterface"

name: ${{ matrix.actions.name }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none
- uses: "ramsey/composer-install@v2"
- run: ${{ matrix.actions.run }}
33 changes: 15 additions & 18 deletions .github/workflows/downgraded_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@ name: Downgraded Release
on:
push:
tags:
# avoid infinite looping, skip tags that ends with ".72"
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-including-and-excluding-branches
- '*'
- '!**.72'

jobs:
downgrade_release:
runs-on: ubuntu-latest

steps:
- uses: "actions/checkout@v3"
with:
token: ${{ secrets.WORKFLOWS_TOKEN }}
- uses: "actions/checkout@v3"
with:
token: ${{ secrets.WORKFLOWS_TOKEN }}

-
uses: "shivammathur/setup-php@v2"
Expand All @@ -24,42 +22,41 @@ jobs:
coverage: none

# invoke patches
- run: composer install --ansi
- run: composer install --ansi

# but no dev packages
- run: composer update --no-dev --ansi
- run: composer update --no-dev --ansi

# get rector to "rector-local" directory, to avoid downgrading itself in the /vendor
- run: mkdir rector-local
- run: composer require rector/rector --working-dir rector-local --ansi
- run: mkdir rector-local
- run: composer require rector/rector --working-dir rector-local --ansi

# downgrade to PHP 7.2
- run: rector-local/vendor/bin/rector process bin src packages config vendor --config build/rector-downgrade-php-72.php --ansi
- run: rector-local/vendor/bin/rector process bin src packages config vendor --config build/rector-downgrade-php-72.php --ansi

# clear the dev files
- run: rm -rf tests ecs.php phpstan.neon phpunit.xml .gitignore .editorconfig
- run: rm -rf tests ecs.php phpstan.neon phpunit.xml .gitignore .editorconfig

# prefix and scope
- run: sh prefix-code.sh
- run: sh prefix-code.sh

# copy PHP 7.2 composer + workflows
- run: cp -r build/target-repository/. .
- run: cp -r build/target-repository/. .

# clear the dev files
- run: rm -rf build prefix-code.sh monorepo-builder.php full-tool-build.sh scoper.php rector.php rector-local packages-tests php-scoper.phar
- run: rm -rf build prefix-code.sh monorepo-builder.php full-tool-build.sh scoper.php rector.php rector-local packages-tests php-scoper.phar

# setup git user
-
run: |
git config user.email "[email protected]"
git config user.name "GitHub Action"
# publish to the same repository with a new tag
# see https://tomasvotruba.com/blog/how-to-release-php-81-and-72-package-in-the-same-repository/
-
name: "Tag Downgraded Code"
run: |
# separate a "git add" to add untracked (new) files too
git add --all
git commit -m "release PHP 7.2 downgraded"
git tag "${GITHUB_REF#refs/tags/}.72"
git push origin "${GITHUB_REF#refs/tags/}.72"
git tag -a "${GITHUB_REF#refs/tags/}" -m 'PHP 7.2 downgraded' --force
git push origin "${GITHUB_REF#refs/tags/}" --force

0 comments on commit 05c8158

Please sign in to comment.