moodlehq / moodle-plugin-ci

Helps running Moodle plugins analysis checks and tests under various CI environments.
https://moodlehq.github.io/moodle-plugin-ci/
GNU General Public License v3.0
44 stars 45 forks source link

PHPUNIT_IGNORE_PATHS does not work. #133

Open manojmalik20 opened 2 years ago

manojmalik20 commented 2 years ago

Hello!

I am using moodle-plugin-ci in a Moodle plugin and want to ignore some PHPUnit tests from running in the CI. I tried using IGNORE_PATHS, PHPUNIT_IGNORE_PATHS, IGNORE_NAMES, PHPUNIT_IGNORE_NAMES but nothing seems to work. I even tried to use these variables in the env for only phpunit command instead of defining them while installing moodle-plugin-ci but that didn't work also. I am using Github actions and here are some examples I tried in my yml file.

- name: Install moodle-plugin-ci
        run: |
          moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
        env:
          DB: ${{ matrix.database }}
          MOODLE_BRANCH: ${{ matrix.moodle-branch }}
          PHPUNIT_IGNORE_PATHS: tests/integration
- name: PHPUnit tests
        if: ${{ always() }}
        run: moodle-plugin-ci phpunit
        env:
          PHPUNIT_IGNORE_PATHS: tests/integration
          IGNORE_PATHS: tests/integration

I've tried several paths too like

./moodle/mod/{module_name}/tests/integration/*.php
moodle/mod/{module_name}/tests/integration
plugin/tests/integration

But nothing seems to work. I would really appreciate some help on this.

Thanks,

Manoj

kabalin commented 2 years ago

Hi @manojmalik20, you need to define IGNORE_* at installing step, they don't have effect at actual test running step. Did you try quoting the path?

    PHPUNIT_IGNORE_PATHS: 'tests/integration'
manojmalik20 commented 2 years ago

Hi @manojmalik20, you need to define IGNORE_* at installing step, they don't have effect at actual test running step. Did you try quoting the path?

Defining the variables at installing step didn't work either and I tried quoting the path also, still didn't work.

kabalin commented 2 years ago

Can you share the link to the CI report where you tested this ignore param?

manojmalik20 commented 2 years ago

Right now, the repo is private and we are planning to make it public in a few days. I can share the link with you after that.

manojmalik20 commented 2 years ago

Here is the link for a workflow run. https://github.com/Brightscout/mod_mattermost/actions/runs/1258282057

manojmalik20 commented 2 years ago

@kabalin Did you get a chance to look at the link?

kabalin commented 2 years ago

Hi @manojmalik20, yeah, phpunit does not respect *_IGNORE_PATHS at all at the moment. As workaround you need either custom phpunit.xml that would filter directory you need to exclude or run vendor/bin/phpunit directly as separate step (with --filter param to fetch only testcases you need).