-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
70 lines (62 loc) · 1.99 KB
/
action.yml
File metadata and controls
70 lines (62 loc) · 1.99 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: "Python Code Checker"
description: "Run tox across matrix Python versions with optional requirements files and flexible test file handling."
author: "GitCodeCheckers"
branding:
icon: "check-circle"
color: "blue"
inputs:
python-version:
description: "Python version to use."
required: true
file:
description: "Optional file(s) or directory passed to tox as {posargs}."
required: false
default: ""
requirements:
description: "Optional comma-separated list of requirements files to install (overrides requirements.txt)."
required: false
default: ""
runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}
allow-prereleases: true
- name: Upgrade pip
shell: bash
run: python -m pip install --upgrade pip
- name: Install tox + tox-gh-actions
shell: bash
run: pip install tox tox-gh-actions
- name: Install project dependencies
shell: bash
run: |
# If multiple requirement files are provided, split them by comma
if [ -n "${{ inputs.requirements }}" ]; then
IFS=',' read -ra reqs <<< "${{ inputs.requirements }}"
for req in "${reqs[@]}"; do
req_trimmed="$(echo "$req" | xargs)"
if [ -f "$req_trimmed" ]; then
echo "Installing from requirements file: $req_trimmed"
pip install -r "$req_trimmed"
else
echo "Warning: requirements file '$req_trimmed' not found."
fi
done
elif [ -f requirements.txt ]; then
echo "Installing from default requirements.txt"
pip install -r requirements.txt
else
echo "No requirements file provided or found."
fi
- name: Run tox
shell: bash
run: |
echo "Running tox."
if [ -n "${{ inputs.file }}" ]; then
tox -- ${{ inputs.file }}
else
tox
fi