Skip to content

Commit 3898c48

Browse files
committed
Adding input use-external-python; adding workflow tests for this case
1 parent ffe24b3 commit 3898c48

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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, macos-latest, windows-latest]
12+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
13+
use-external-python: [true, false]
14+
env:
15+
python-test-package: python-dummy
16+
steps:
17+
- name: Get the branch name
18+
id: get_branch
19+
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
20+
21+
- uses: actions/checkout@v4
22+
23+
- name: Install Python if required
24+
if: ${{ matrix.use-external-python }}
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
29+
- name: Install a test dependency if external Python is used
30+
if: ${{ matrix.use-external-python }}
31+
run:
32+
pip install ${{ env.python-test-package }}
33+
34+
- name: Test Action usage
35+
uses: ${{ github.repository }}@${{ env.BRANCH_NAME }}
36+
with:
37+
python-root-list: "./tests/*.py ./tests/subtest/*.py"
38+
use-black: true
39+
use-isort: true
40+
use-mypy: true
41+
use-pycodestyle: true
42+
use-pydocstyle: true
43+
extra-pycodestyle-options: "--max-line-length=88"
44+
use-pylint: false
45+
use-flake8: false
46+
use-vulture: true
47+
python-version: ${{ matrix.python-version }}
48+
use-external-python: ${{ matrix.use-external-python }}
49+
50+
- name: Check if test dependency exists after execution
51+
description: "If use-external-python is set, then python test package should be installed. False otherwise"
52+
run:
53+
pip freeze > all-deps.txt
54+
should_appear=$( if [[ "${{ matrix.use-external-python }}" == "true" ]]; then echo 0; else echo 1; fi )
55+
line_exists=$( grep -qF "${{ env.python-test-package }}" "all-deps.txt"; echo $? )
56+
echo "test package should be installed: ${{ matrix.use-external-python }}"
57+
test "$should_appear" == "line_exists"
58+

0 commit comments

Comments
 (0)