1
+ # Copyright 2024 The HuggingFace Inc. team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
name : Quality
2
16
3
17
on :
4
18
workflow_dispatch :
5
19
workflow_call :
6
20
pull_request :
7
- branches :
8
- - main
9
21
push :
10
22
branches :
11
23
- main
12
24
25
+ permissions : {}
26
+
13
27
env :
14
28
PYTHON_VERSION : " 3.10"
15
29
19
33
runs-on : ubuntu-latest
20
34
steps :
21
35
- name : Checkout Repository
22
- uses : actions/checkout@v3
36
+ uses : actions/checkout@v4
37
+ with :
38
+ persist-credentials : false
23
39
24
40
- name : Set up Python
25
41
uses : actions/setup-python@v4
@@ -30,55 +46,27 @@ jobs:
30
46
id : get-ruff-version
31
47
run : |
32
48
RUFF_VERSION=$(awk '/repo: https:\/\/github.com\/astral-sh\/ruff-pre-commit/{flag=1;next}/rev:/{if(flag){print $2;exit}}' .pre-commit-config.yaml)
33
- echo "RUFF_VERSION =${RUFF_VERSION}" >> $GITHUB_ENV
49
+ echo "ruff_version =${RUFF_VERSION}" >> $GITHUB_OUTPUT
34
50
35
51
- name : Install Ruff
36
- run : python -m pip install "ruff==${{ env.RUFF_VERSION }}"
52
+ env :
53
+ RUFF_VERSION : ${{ steps.get-ruff-version.outputs.ruff_version }}
54
+ run : python -m pip install "ruff==${RUFF_VERSION}"
37
55
38
56
- name : Ruff check
39
- run : ruff check
57
+ run : ruff check --output-format=github
40
58
41
59
- name : Ruff format
42
60
run : ruff format --diff
43
61
44
-
45
- poetry_check :
46
- name : Poetry check
62
+ typos :
63
+ name : Typos
47
64
runs-on : ubuntu-latest
48
65
steps :
49
66
- name : Checkout Repository
50
- uses : actions/checkout@v3
51
-
52
- - name : Install poetry
53
- run : pipx install "poetry<2.0.0"
54
-
55
- - name : Poetry check
56
- run : poetry check
57
-
58
-
59
- poetry_relax :
60
- name : Poetry relax
61
- runs-on : ubuntu-latest
62
- steps :
63
- - name : Checkout Repository
64
- uses : actions/checkout@v3
65
-
66
- - name : Install poetry
67
- run : pipx install "poetry<2.0.0"
68
-
69
- - name : Install poetry-relax
70
- run : poetry self add poetry-relax
67
+ uses : actions/checkout@v4
68
+ with :
69
+ persist-credentials : false
71
70
72
- - name : Poetry relax
73
- id : poetry_relax
74
- run : |
75
- output=$(poetry relax --check 2>&1)
76
- if echo "$output" | grep -q "Proposing updates"; then
77
- echo "$output"
78
- echo ""
79
- echo "Some dependencies have caret '^' version requirement added by poetry by default."
80
- echo "Please replace them with '>='. You can do this by hand or use poetry-relax to do this."
81
- exit 1
82
- else
83
- echo "$output"
84
- fi
71
+ - name : typos-action
72
+ uses : crate-ci/typos@v1.29.10
0 commit comments