|
| 1 | +on: |
| 2 | + push: |
| 3 | + pull_request: |
| 4 | +name: Check python installation |
| 5 | +jobs: |
| 6 | + pythoninstall: |
| 7 | + name: Test Python install |
| 8 | + runs-on: ${{ matrix.os }} |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + os: [ubuntu-latest] |
| 12 | + python-version: ['3.11'] |
| 13 | + use-external-python: [true, false] |
| 14 | + env: |
| 15 | + python-test-package: python-dummy |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Install Python if required |
| 20 | + if: ${{ matrix.use-external-python }} |
| 21 | + uses: actions/setup-python@v5 |
| 22 | + with: |
| 23 | + python-version: ${{ matrix.python-version }} |
| 24 | + |
| 25 | + - name: Install a test dependency if external Python is used |
| 26 | + if: ${{ matrix.use-external-python }} |
| 27 | + run: |
| 28 | + pip install ${{ env.python-test-package }} |
| 29 | + |
| 30 | + - name: Test Action usage |
| 31 | + uses: ./ |
| 32 | + with: |
| 33 | + python-root-list: "./tests/*.py ./tests/subtest/*.py" |
| 34 | + use-black: true |
| 35 | + use-isort: true |
| 36 | + use-mypy: true |
| 37 | + use-pycodestyle: true |
| 38 | + use-pydocstyle: true |
| 39 | + extra-pycodestyle-options: "--max-line-length=88" |
| 40 | + use-pylint: false |
| 41 | + use-flake8: false |
| 42 | + use-vulture: true |
| 43 | + python-version: ${{ matrix.python-version }} |
| 44 | + use-external-python: ${{ matrix.use-external-python }} |
| 45 | + |
| 46 | + - name: Check if test dependency exists after execution |
| 47 | + run: | |
| 48 | + pip freeze > all-deps.txt |
| 49 | + should_appear=$( if [[ "${{ matrix.use-external-python }}" == "true" ]]; then echo 0; else echo 1; fi ) |
| 50 | + line_exists=$( grep -qF "${{ env.python-test-package }}" "all-deps.txt"; echo $? ) |
| 51 | + echo "test package should be installed: ${{ matrix.use-external-python }}" |
| 52 | + echo "test package is present (0 = present): ${line_exists}" |
| 53 | + cat all-deps.txt |
| 54 | + test "${should_appear}" == "${line_exists}" |
| 55 | + |
0 commit comments