Skip to content

Commit

Permalink
fix github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
kurozumi committed May 29, 2024
1 parent 245f8a3 commit 0c967d6
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 46 deletions.
1 change: 1 addition & 0 deletions .github/actions/composer/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ runs:
${{ runner.os }}-composer-
- name: composer install
working-directory: ${{ env.WORKING_DIRECTORY }}
run: composer install --dev --no-interaction -o --apcu-autoloader
shell: bash
28 changes: 13 additions & 15 deletions .github/workflows/phpstan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: PHPStan
on: [workflow_dispatch, pull_request]
env:
PLUGIN_CODE: CustomerGroupRank42
CUSTOMER_GROUP_CODE: CustomerGroup42
CUSTOMER_GROUP_BRANCH: '4.2'

jobs:
phpstan:
Expand All @@ -26,17 +24,27 @@ jobs:

steps:
- name: Checkout EC-CUBE
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: EC-CUBE/ec-cube
ref: ${{ matrix.eccube-versions }}

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, mysql, intl, :xdebug
tools: composer:v2

- name: Initialize Composer
uses: ./.github/actions/composer

- name: Checkout CustomerGroup
uses: actions/checkout@v4
with:
repository: kurozumi/CustomerGroup
ref: ${{ env.CUSTOMER_GROUP_BRANCH }}
path: app/Plugin/${{ env.CUSTOMER_GROUP_CODE }}
ref: '4.2'
path: app/Plugin/CustomerGroup42
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

- name: Checkout
Expand All @@ -45,16 +53,6 @@ jobs:
path: app/Plugin/${{ env.PLUGIN_CODE }}
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, mysql, intl
tools: composer:v2

- name: Initialize Composer
uses: ./.github/actions/composer

- name: PHPStan
run: |
composer require phpstan/phpstan --dev
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:
jobs:
deploy:
name: Build
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -21,7 +21,7 @@ jobs:
cd $GITHUB_WORKSPACE
tar cvzf ../${{ env.PLUGIN_CODE }}-${{ github.event.release.tag_name }}.tar.gz ./*
- name: Upload binaries to release of TGZ
uses: svenstaro/upload-release-action@v1-release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ runner.workspace }}/${{ env.PLUGIN_CODE }}-${{ github.event.release.tag_name }}.tar.gz
Expand Down
74 changes: 46 additions & 28 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ name: CI/CD for EC-CUBE4 Plugin
on: [workflow_dispatch, pull_request]
env:
PLUGIN_CODE: CustomerGroupRank42
PACKAGE_NAME: 'ec-cube/customergrouprank42'
CUSTOMER_GROUP_CODE: CustomerGroup42
CUSTOMER_GROUP_BRANCH: '4.2'
WORKING_DIRECTORY: 'ec-cube'
APP_ENV: 'test'
APP_DEBUG: 0
jobs:
Expand Down Expand Up @@ -65,37 +66,54 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- name: Checkout EC-CUBE
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v4
with:
repository: EC-CUBE/ec-cube
ref: ${{ matrix.eccube-versions }}
ref: ${{ github.event.pull_request.head.sha }}

- name: Archive Plugin
run: |
tar cvzf ${GITHUB_WORKSPACE}/${{ env.PLUGIN_CODE }}.tar.gz ./*
- name: Checkout CustomerGroup
- name: Checkout CustomerGroup Plugin
uses: actions/checkout@v4
with:
repository: kurozumi/CustomerGroup
ref: ${{ env.CUSTOMER_GROUP_BRANCH }}
path: app/Plugin/${{ env.CUSTOMER_GROUP_CODE }}
ref: '4.2'
path: 'plugin'
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
path: app/Plugin/${{ env.PLUGIN_CODE }}
- name: Archive Plugin
working-directory: 'plugin'
run: |
tar cvzf ${GITHUB_WORKSPACE}/${{ env.CUSTOMER_GROUP_CODE }}.tar.gz ./*
- name: Setup mock-package-api
run: |
mkdir -p /tmp/repos
cp ${GITHUB_WORKSPACE}/${{ env.PLUGIN_CODE }}.tar.gz /tmp/repos/${{ env.PLUGIN_CODE }}.tgz
cp ${GITHUB_WORKSPACE}/${{ env.CUSTOMER_GROUP_CODE }}.tar.gz /tmp/repos/${{ env.CUSTOMER_GROUP_CODE }}.tgz
docker run --name package-api -d -v /tmp/repos:/repos -e MOCK_REPO_DIR=/repos -p 8080:8080 eccube/mock-package-api:composer2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, mysql, intl, :xdebug
tools: composer:v2

- name: Checkout EC-CUBE
uses: actions/checkout@v4
with:
repository: EC-CUBE/ec-cube
ref: ${{ matrix.eccube-versions }}
path: ${{ env.WORKING_DIRECTORY }}

- name: Initialize Composer
uses: ./.github/actions/composer

- name: Setup EC-CUBE
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
bin/console doctrine:database:create
bin/console doctrine:schema:create
Expand All @@ -107,29 +125,25 @@ jobs:
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
DATABASE_CHARSET: ${{ matrix.database_charset }}

- name: Setup CustomerGroup Plugin
run: |
bin/console eccube:plugin:install --code ${{ env.CUSTOMER_GROUP_CODE }}
bin/console eccube:plugin:enable --code ${{ env.CUSTOMER_GROUP_CODE }}
env:
APP_ENV: ${{ env.APP_ENV }}
APP_DEBUG: ${{ env.APP_DEBUG }}
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
DATABASE_CHARSET: ${{ matrix.database_charset }}

- name: Setup Plugin
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
bin/console eccube:plugin:install --code ${{ env.PLUGIN_CODE }}
bin/console doctrine:query:sql "update dtb_base_info set authentication_key='dummy'"
bin/console eccube:composer:require ${{ env.PACKAGE_NAME }}
bin/console cache:clear --no-warmup
bin/console eccube:plugin:enable --code ${{ env.CUSTOMER_GROUP_CODE }}
bin/console eccube:plugin:enable --code ${{ env.PLUGIN_CODE }}
env:
APP_ENV: ${{ env.APP_ENV }}
APP_DEBUG: ${{ env.APP_DEBUG }}
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
DATABASE_CHARSET: ${{ matrix.database_charset }}
ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080'
USE_SELFSIGNED_SSL_CERTIFICATE: '1'

- name: Run Tests
- name: Run PHPUnit
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
rm -rf var/cache
./vendor/bin/phpunit -c app/Plugin/${{ env.PLUGIN_CODE }}/phpunit.xml.dist app/Plugin/${{ env.PLUGIN_CODE }}/Tests
Expand All @@ -141,6 +155,7 @@ jobs:
DATABASE_CHARSET: ${{ matrix.database_charset }}

- name: Update Plugin
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
bin/console eccube:plugin:update ${{ env.PLUGIN_CODE }}
env:
Expand All @@ -151,8 +166,11 @@ jobs:
DATABASE_CHARSET: ${{ matrix.database_charset }}

- name: Uninstall Plugin
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
bin/console eccube:plugin:uninstall --code ${{ env.PLUGIN_CODE }}
bin/console eccube:plugin:disable --code ${{ env.PLUGIN_CODE }}
bin/console eccube:plugin:disable --code ${{ env.CUSTOMER_GROUP_CODE }}
bin/console eccube:composer:remove ${{ env.PACKAGE_NAME }}
env:
APP_ENV: ${{ env.APP_ENV }}
APP_DEBUG: ${{ env.APP_DEBUG }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 会員グループ管理::会員ランク管理アドオン

本プラグインは[会員グループ管理プラグイン](https://www.ec-cube.net/products/detail.php?product_id=2255) をインストール・有効化する必要があります。
本プラグインは[会員グループ管理プラグイン](https://www.ec-cube.net/products/detail.php?product_id=2439) をインストール・有効化する必要があります。

会員グループ管理::会員ランク管理アドオンは、購入金額や購入回数に応じて会員グループを自動登録することができるプラグインです。

Expand Down

0 comments on commit 0c967d6

Please sign in to comment.