-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython-ci.yml
More file actions
47 lines (43 loc) · 1.31 KB
/
python-ci.yml
File metadata and controls
47 lines (43 loc) · 1.31 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
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
name: Reusable Python CI
# Phase 1-2: 派生リポで使う Python CI ベースライン
on:
workflow_call:
inputs:
python-version:
type: string
default: '3.11'
coverage-threshold:
type: number
default: 80
jobs:
ci:
name: Python CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- run: pip install -r requirements.txt
if: ${{ hashFiles('requirements.txt') != '' }}
- run: pip install -r requirements-dev.txt
if: ${{ hashFiles('requirements-dev.txt') != '' }}
- name: Install pytest coverage helpers
run: pip install pytest pytest-cov
- name: Ruff
run: pipx run ruff check .
- name: Pytest
env:
COVERAGE_THRESHOLD: ${{ inputs.coverage-threshold }}
run: pytest --cov=. --cov-report=term-missing --cov-fail-under="$COVERAGE_THRESHOLD" -q