From 0c967d69aae85e879978674e1c5327234c673a57 Mon Sep 17 00:00:00 2001 From: kurozumi Date: Wed, 29 May 2024 16:50:54 +0900 Subject: [PATCH] fix github actions --- .github/actions/composer/action.yaml | 1 + .github/workflows/phpstan.yaml | 28 +++++------ .github/workflows/release.yml | 4 +- .github/workflows/test.yaml | 74 +++++++++++++++++----------- README.md | 2 +- 5 files changed, 63 insertions(+), 46 deletions(-) diff --git a/.github/actions/composer/action.yaml b/.github/actions/composer/action.yaml index 8a1af17..8fc22f4 100644 --- a/.github/actions/composer/action.yaml +++ b/.github/actions/composer/action.yaml @@ -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 diff --git a/.github/workflows/phpstan.yaml b/.github/workflows/phpstan.yaml index 322a986..118bd5e 100644 --- a/.github/workflows/phpstan.yaml +++ b/.github/workflows/phpstan.yaml @@ -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: @@ -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 @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0b985ba..8100edc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 @@ -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 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2a60fe2..fb6e93d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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: @@ -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 @@ -107,20 +125,13 @@ 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 }} @@ -128,8 +139,11 @@ jobs: 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 @@ -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: @@ -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 }} diff --git a/README.md b/README.md index 8406289..45e9d04 100644 --- a/README.md +++ b/README.md @@ -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) をインストール・有効化する必要があります。 会員グループ管理::会員ランク管理アドオンは、購入金額や購入回数に応じて会員グループを自動登録することができるプラグインです。