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