Path patterns not working


I used the tests/**/*.py syntax to match all the Python files within the tests directory, as specified here.

However, it only matches the files within the first subdirectory and completely ignores the Python files in the current directory and the sub-subdirectories.

    runs-on: ubuntu-latest
        python-version: [ 3.7, 3.8, 3.9 ]
    needs: build
      - uses: actions/checkout@v2
      - name: Set up Python
        uses: actions/setup-python@v2
          python-version: ${{ matrix.python-version }}
      - name: Cache build
        id: restore-build
        uses: actions/cache@v2
          path: ${{ env.pythonLocation }}
          key: ${{ env.pythonLocation }}-build-${{ hashFiles('') }}
      - run: ls -d tests/**/*.py
      - run: openfisca test tests/**/*.py

Locally, it matched the behavior of tests/*/*.py.

To match any number of directories with ** in Bash, you need to activate the “globstar” option:

shopt -s globstar

You could put that into your run commands, or use the shell parameter for the stop and the -O option of Bash to activate it on shell start.

I have already tried shopt -s globstar but it didn’t change anything.

I still have missing files.

Each step gets a fresh shell, so changes to shell settings are lost after the step. You need to set the globstar option in the step where you want to use the ** glob.


      - run: |
          shopt -s globstar
          ls tests/**/*.py

This works. Thank you!

1 Like