MAD-I-T / magento-actions

Github deployment actions for Magento 2
MIT License
99 stars 35 forks source link

Unit Testing, can't use phpunit.xml #39

Closed francesco-di-marcantonio closed 1 year ago

francesco-di-marcantonio commented 1 year ago

Hi, during unit testing i'm receiving this error:

Could not read "dev/tests/unit/phpunit.xml".

Here it is the workflow file

name: magento2-unit-integration-test
on: [push]

jobs:
  magento2-build:
    runs-on: ubuntu-latest
    container: ubuntu
    name: 'm2 unit-integration tests'
    services:
      mysql:
        image: docker://mysql:8.0
        env:
          MYSQL_ROOT_PASSWORD: magento
          MYSQL_DATABASE: magento
        ports:
          - 3306:3306
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
      elasticsearch:
        image: docker://elasticsearch:7.1.0
        ports:
          - 9200:9200
        options: -e="discovery.type=single-node" --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
    steps:
      - uses: actions/checkout@v3 # pulls your repository, M2 src must be in a magento directory
      - name: 'install fresh magento repo'
        #if: always()
        if: ${{true}}
        uses: MAD-I-T/magento-actions@master
        env:
          COMPOSER_AUTH: ${{secrets.COMPOSER_AUTH}}
        with:
          process: 'create-project'
          magento_version: 2.4.5
          no_push: 1
      - name: 'Start unit testing process'
        #if: always()
        uses: MAD-I-T/magento-actions@v3.16
        env:
          COMPOSER_AUTH: ${{secrets.COMPOSER_AUTH}}
        with:
          process: 'unit-test'
          elasticsearch: 1
          unit_test_config: 'dev/tests/unit/phpunit.xml'
      - name: 'launch magento2 integration test custom testsuite'
        #if: ${{true}}
        uses: MAD-I-T/magento-actions@master
        env:
          COMPOSER_AUTH: ${{secrets.COMPOSER_AUTH}}
        with:
          process: 'integration-test'
          elasticsearch: 1
          testsuite: "Memory Usage Tests"

The file exist in the repository but i dont know why is not using this. I tested with master and v3.16 but i receive always the same error.

seyuf commented 1 year ago

Hi @francesco-di-marcantonio,

That's probably because you're overriding your magento src by the default 2.4.5 source through the preceding step :

 - name: 'install fresh magento repo'
        #if: always()
        if: ${{true}}
        uses: MAD-I-T/magento-actions@master
        env:
          COMPOSER_AUTH: ${{secrets.COMPOSER_AUTH}}
        with:
          process: 'create-project'
          magento_version: 2.4.5
          no_push: 1

Pass the ${{true}} to ${{false}} or even better remove this step ? Cause you clearly seems to not need it anymore.

Regards