Repository navigation
70 lines (67 loc) · 2.08 KB
/
Copy pathstack-python.yml
File metadata and controls
70 lines (67 loc) · 2.08 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: stack-python
on:
workflow_call:
inputs:
python-versions:
description: JSON list of Python versions
type: string
default: '["3.11","3.12","3.13"]'
os:
description: JSON list of runner labels
type: string
default: '["ubuntu-latest"]'
manager:
description: pip or uv
type: string
default: pip
install-command:
description: Command that installs the project and its check tools
type: string
default: python -m pip install ruff
commands:
description: JSON list of shell commands run in order
type: string
default: '["ruff format --check .","ruff check ."]'
working-directory:
description: Directory holding the project
type: string
default: .
permissions:
contents: read
jobs:
python:
name: python ${{ matrix.python }} (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(inputs.os) }}
python: ${{ fromJSON(inputs.python-versions) }}
runs-on: ${{ matrix.os }}
permissions:
contents: read
defaults:
run:
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
UV_PYTHON: ${{ matrix.python }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ matrix.python }}
- if: inputs.manager == 'uv'
uses: astral-sh/setup-uv@18d369b23da25a81e9458561248e1aafff6a70fa # v10.3.1
- name: Install dependencies
run: ${{ inputs.install-command }}
- name: Run checks
env:
COMMANDS: ${{ inputs.commands }}
run: |
node -e 'for (const c of JSON.parse(process.env.COMMANDS)) console.log(c)' | while IFS= read -r command; do
echo "::group::$command"
bash -c "$command" </dev/null
echo "::endgroup::"
done