Skip to content

Commit

Permalink
Merge pull request #1073 from nanasess/gh-actions-php-cs-fixer
Browse files Browse the repository at this point in the history
GitHub Actions で php-cs-fixer を実行し、エラーがある場合は diff を表示する
  • Loading branch information
nanasess authored Dec 20, 2024
2 parents 6235b10 + 5b6c587 commit d38820d
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dockerbuild-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4-rc' ]
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]

steps:
- name: downcase REPO
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dockerbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4-rc' ]
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]

steps:
- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- 'test/front_login'
- 'test/front_guest'
- 'test/admin'
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4-rc' ]
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
db: [ mysql, pgsql ]
steps:
- name: Checkout
Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:
fail-fast: false
matrix:
db: [ 'pgsql', 'mysql' ]
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4-rc' ]
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
include:
- db: mysql
dbport: '3306'
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,37 @@ jobs:
with:
event_name: ${{ github.event_name }}
uses: ./.github/workflows/dockerbuild.yml
phpstan:
php-cs-fixer:
with:
ref_name: ${{ github.ref_name }}
base_ref: ${{ github.base_ref }}
event_name: ${{ github.event_name }}
owner: ${{ github.repository_owner }}
needs: [ dockerbuild ]
uses: ./.github/workflows/php-cs-fixer.yml
phpstan:
with:
ref_name: ${{ github.ref_name }}
base_ref: ${{ github.base_ref }}
event_name: ${{ github.event_name }}
owner: ${{ github.repository_owner }}
needs: [ php-cs-fixer ]
uses: ./.github/workflows/phpstan.yml
unit-tests:
with:
ref_name: ${{ github.ref_name }}
base_ref: ${{ github.base_ref }}
event_name: ${{ github.event_name }}
owner: ${{ github.repository_owner }}
needs: [ dockerbuild ]
needs: [ php-cs-fixer ]
uses: ./.github/workflows/unit-tests.yml
e2e-tests:
with:
ref_name: ${{ github.ref_name }}
base_ref: ${{ github.base_ref }}
event_name: ${{ github.event_name }}
owner: ${{ github.repository_owner }}
needs: [ dockerbuild ]
needs: [ php-cs-fixer ]
uses: ./.github/workflows/e2e-tests.yml
success:
needs:
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: php-cs-fixer dry-run
run-name: php-cs-fixer

on:
workflow_call:
inputs:
ref_name:
required: false
type: string
base_ref:
required: false
type: string
event_name:
required: true
type: string
owner:
required: true
type: string
jobs:
php-cs-fixer:
name: php-cs-fixer
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v4

- name: Build docker image
uses: ./.github/actions/dockerbuild
with:
php-version: '8.4'

- name: Setup environment
env:
REF_NAME: ${{ inputs.ref_name }}
BASE_REF: ${{ inputs.base_ref }}
EVENT_NAME: ${{ inputs.event_name }}
OWNER: ${{ inputs.owner }}
run: |
echo "COMPOSE_FILE=docker-compose.yml:docker-compose.pgsql.yml:docker-compose.dev.yml" >> $GITHUB_ENV
echo "IMAGE_NAME=${OWNER,,}/ec-cube2-php" >> $GITHUB_ENV
if [ $EVENT_NAME = "pull_request" ]; then
if [ -n $DOCKER_METADATA_OUTPUT_VERSION ]; then
echo "TAG=${DOCKER_METADATA_OUTPUT_VERSION}" >> $GITHUB_ENV
else
echo "TAG=8.4-apache-${BASE_REF}" >> $GITHUB_ENV
fi
else
echo "TAG=8.4-apache-${REF_NAME}" >> $GITHUB_ENV
fi
- run: |
docker compose up -d --wait
docker compose exec -T ec-cube composer install
- run: docker compose exec -T -e PHP_CS_FIXER_IGNORE_ENV=1 ec-cube php data/vendor/bin/php-cs-fixer fix --diff --dry-run --allow-risky=yes
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ ubuntu-22.04 ]
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4-rc' ]
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
db: [ mysql, pgsql ]

steps:
Expand Down

0 comments on commit d38820d

Please sign in to comment.