-
Notifications
You must be signed in to change notification settings - Fork 119
150 lines (120 loc) · 4.14 KB
/
Copy pathsetup.yaml
File metadata and controls
150 lines (120 loc) · 4.14 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# This workflow will install Python dependencies, run tests and lint
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: "CI"
on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
tools:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: "zizmor"
commands: zizmor .github/
- name: "typos"
commands: typos --config .typos.toml
- name: "ast-grep"
commands: |
sg test --test-dir tests/ast-grep
sg scan
name: ${{ matrix.name }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.14"
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: ${{ github.ref_type != 'tag' }} # zizmor: ignore[cache-poisoning]
- name: "Install ${{ matrix.name }}"
run: uv pip install --group ${{ matrix.name }} --system
- name: "Run ${{ matrix.name }}"
run: ${{ matrix.commands }}
testing:
name: "Testing / python ${{ matrix.python-version }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: "Set up ${{ matrix.python-version }} on ${{ matrix.os }}"
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: ${{ matrix.python-version }}
- name: "Install uv"
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- name: "Install dependencies"
run: |
uv pip install . --group ci --system
- name: "Run ruff"
run: |
ruff check
- name: "Run mypy"
run: |
mypy
- name: "Run tests"
run: |
nox -t ci
mv .coverage .coverage.${{ matrix.python-version }}
- name: "Build doc"
run: |
uv pip install -r requirements_doc.txt --system
sphinx-build -M html docs docs-build -W
- name: "Store coverage file"
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ github.event_name == 'pull_request' }}
with:
name: coverage-${{ matrix.python-version }}
path: .coverage.${{ matrix.python-version }}
if-no-files-found: error
include-hidden-files: true
coverage:
name: "Coverage"
runs-on: ubuntu-latest
needs: testing
permissions:
pull-requests: write
contents: write
if: ${{ github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
id: download
with:
pattern: coverage-*
merge-multiple: true
- name: "Coverage comment"
id: coverage_comment
uses: py-cov-action/python-coverage-comment-action@5d8df5979747514c914e1c5a12335a7cf9a2745f # v4.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MERGE_COVERAGE_FILES: true
MINIMUM_GREEN: 90
- name: "Store Pull Request comment to be posted (for external pr)"
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
with:
name: python-coverage-comment-action
path: python-coverage-comment-action.txt