Skip to content

ci(*): Update m2 insatll action #24

ci(*): Update m2 insatll action

ci(*): Update m2 insatll action #24

Workflow file for this run

name: Unit and integration tests
on:
push:
branches:
- main
paths-ignore:
- '**.md'
workflow_dispatch:
permissions:
contents: read
env:
# Allow ddev get to use a GitHub token to prevent rate limiting by tests
DDEV_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
unit-and-integration-tests:
strategy:
fail-fast: false
matrix:
# Last one for the current and previous minor, greatest php version
m2-version: [ "2.3.7", "2.4.6" ]
php-version: [ "7.4", "8.2" ]
exclude:
- { php-version: "8.2", m2-version: "2.3.7" }
- { php-version: "7.4", m2-version: "2.4.6" }
name: Unit and integration tests
runs-on: ubuntu-latest
env:
EXTENSION_PACKAGE_NAME: "okaeli/magento2-category-code"
EXTENSION_PATH: "category-code"
steps:
- name: Install Magento 2
uses: julienloizelet/magento2-ddev-installation@v2.1.1
with:
php_version: ${{ matrix.php-version }}
magento_version: ${{ matrix.m2-version }}
composer_auth: ${{ secrets.M2_COMPOSER_AUTH }}
magento_repository: "https://repo.magento.com/"
- name: Clone M2 Okaeli Category Code files
uses: actions/checkout@v3
with:
path: my-own-modules/${{ env.EXTENSION_PATH }}
- name: Prepare composer repositories
run: |
ddev composer config --unset repositories.0
ddev composer config repositories.0 '{"type": "path", "url":"my-own-modules/${{ env.EXTENSION_PATH }}/", "canonical": true, "options": {"symlink": false}}'
ddev composer config repositories.1 '{"type": "composer", "url":"https://repo.magento.com/", "exclude": ["${{ env.EXTENSION_PACKAGE_NAME }}"]}'
cat composer.json
- name: Add Okaeli Category Code as composer dependency
run: |
ddev composer require ${{ env.EXTENSION_PACKAGE_NAME }}:@dev --no-interaction
- name: Fix Unit Test for Magento 2.4.6
# @see https://github.com/magento/magento2/issues/36702
if: contains(fromJson('["2.4.6"]'),matrix.m2-version)
run: sed -i 's/allure\/allure.config.php/dev\/tests\/unit\/allure\/allure.config.php/g' dev/tests/unit/phpunit.xml.dist
- name: Run Unit tests
run: ddev phpunit vendor/${{ env.EXTENSION_PACKAGE_NAME }}/Test/Unit