Repository navigation
55 lines (52 loc) · 1.74 KB
/
Copy pathpython-gates.yml
File metadata and controls
55 lines (52 loc) · 1.74 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
name: python-gates
on:
workflow_call:
inputs:
python-version:
type: string
default: "3.12"
working-directory:
type: string
default: "."
run-lint:
type: boolean
default: true
run-tests:
type: boolean
default: true
runs-on:
description: 'Runner label or JSON array of labels, for example ["self-hosted","linux-ci"]. Empty uses vars.CI_RUNNER, then ubuntu-latest.'
type: string
default: ""
permissions:
contents: read
jobs:
gates:
runs-on: ${{ fromJSON(startsWith(inputs['runs-on'] || vars.CI_RUNNER || 'ubuntu-latest', '[') && (inputs['runs-on'] || vars.CI_RUNNER || 'ubuntu-latest') || format('["{0}"]', inputs['runs-on'] || vars.CI_RUNNER || 'ubuntu-latest')) }}
timeout-minutes: 15
defaults:
run:
working-directory: ${{ inputs.working-directory }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
with:
python-version: ${{ inputs.python-version }}
cache: pip
- name: Install
run: |
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f pyproject.toml ]; then pip install -e ".[dev]"; fi
- name: Lint (ruff)
if: ${{ inputs.run-lint }}
run: |
python -m pip install ruff==0.14.1
ruff check .
- name: Test (pytest)
if: ${{ inputs.run-tests }}
run: |
python -m pip install pytest==8.4.2
python -m pytest -q