-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
55 lines (49 loc) · 1.47 KB
/
action.yml
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
name: Standard Python Steps
description: Runs the standard steps for Python
inputs:
PYTHON_VERSION:
description: The version of Python to use
required: true
default: 3.x
RUN_UNIT_TESTS:
description: Set to true to run unit tests
required: false
default: false
outputs:
PROJECT_FILES:
description: "The pattern used to match files in the project"
value: ${{ steps.project_files.outputs.files }}
runs:
using: "composite"
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ inputs.PYTHON_VERSION }}
uses: actions/setup-python@v2
with:
python-version: ${{ inputs.PYTHON_VERSION }}
- name: Install requirements
run: |
pip install -r requirements.txt
pip install flake8
pip install pylint
shell: bash
- name: Identify project files
id: project_files
run: |
if [ -d "./tests" ];
then
echo "files=*.py tests/*.py" >> $GITHUB_OUTPUT
else
echo "files=*.py" >> $GITHUB_OUTPUT
fi
shell: bash
- name: flake8
run: flake8 --ignore=E501,E231 ${{ steps.project_files.outputs.files }}
shell: bash
- name: pylint
run: pylint --errors-only --disable=C0301 --disable=C0326 ${{ steps.project_files.outputs.files }}
shell: bash
- name: unit tests
if: ${{ inputs.RUN_UNIT_TESTS == false }}
run: python -m unittest --verbose --failfast
shell: bash