Skip to content

Test fix

Test fix #123

Workflow file for this run

name: PHPStan
# This makes sure that the tests are run on every push. See this page for more options:
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
on: push
jobs:
build:
strategy:
fail-fast: false
max-parallel: 2
# This Matrix will run the tests on PHP 7.0, 7.1 and 7.2 and on Magento 2.2.11 and 2.3.5-p1.
# Magento 2.3.5-p1 requires PHP 7.1 and higher, so PHP 7.0 is disabled for this version.
# Magento 2.2.11 supports PHP up to version 7.1, so PHP 7.2 is disabled for this version.
matrix:
include:
- PHP_VERSION: php73-fpm
MAGENTO_VERSION: 2.3.6
- PHP_VERSION: php74-fpm
MAGENTO_VERSION: 2.4.3-p1
- PHP_VERSION: php81-fpm
MAGENTO_VERSION: 2.4.5-p1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
# Download the correct Docker image with the correct Magento & PHP version for this specific run.
- name: Start Docker
run: docker run --detach --name magento-project-community-edition michielgerritsen/magento-project-community-edition:${{ matrix.PHP_VERSION }}-magento${{ matrix.MAGENTO_VERSION }}
# If your code is not in the root but in a subdirectory you need to change this command.
# Example: If your code is in the `src` folder then you need to do this:
# run: docker cp $(pwd)/src magento-project-community-edition:/data/extensions/
- name: Upload our code into the docker container
run: docker cp $(pwd) magento-project-community-edition:/data/extensions/
# Install the extension and PHPStan into Magento
- name: Install the extensions in Magento
run: docker exec magento-project-community-edition composer require cmdotcom-plugins/magento2-payments:@dev
- name: Fix permissions for files
run: docker exec magento-project-community-edition sh -c 'find var generated vendor pub/static pub/media app/etc -type f -exec chmod u+w {} +'
- name: Fix permissions for directories
run: docker exec magento-project-community-edition sh -c 'find var generated vendor pub/static pub/media app/etc -type d -exec chmod u+w {} +'
- name: Enable the extension
run: docker exec magento-project-community-edition bash -c "php bin/magento module:enable CM_Payments && php bin/magento setup:upgrade && php bin/magento setup:di:compile"
# Only the tests in your repository will be run, the default Magento tests are not included in this.
- name: Run tests
run: docker exec magento-project-community-edition vendor/bin/phpstan analyze -c /data/extensions/${{ github.event.repository.name }}/phpstan.neon /data/extensions/${{ github.event.repository.name }}