Skip to content

Commit 0b2ce27

Browse files
russellbsumitd2
authored andcommitted
[CI/Build] Add linting for github actions workflows (vllm-project#7876)
Signed-off-by: Russell Bryant <[email protected]> Signed-off-by: Sumit Dubey <[email protected]>
1 parent 976b9b6 commit 0b2ce27

File tree

11 files changed

+87
-14
lines changed

11 files changed

+87
-14
lines changed

.github/workflows/actionlint.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Lint GitHub Actions workflows
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
paths:
7+
- '.github/workflows/*.ya?ml'
8+
- '.github/workflows/actionlint.*'
9+
pull_request:
10+
branches:
11+
- "main"
12+
paths:
13+
- '.github/workflows/*.ya?ml'
14+
- '.github/workflows/actionlint.*'
15+
16+
env:
17+
LC_ALL: en_US.UTF-8
18+
19+
defaults:
20+
run:
21+
shell: bash
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
actionlint:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: "Checkout"
31+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
32+
with:
33+
fetch-depth: 0
34+
35+
- name: "Run actionlint"
36+
run: |
37+
tools/actionlint.sh -color

.github/workflows/add_label_automerge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Add label
11-
uses: actions/github-script@v5
11+
uses: actions/github-script@v6
1212
with:
1313
script: |
1414
github.rest.issues.addLabels({

.github/workflows/clang-format.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
matrix:
1818
python-version: ["3.11"]
1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v3
2121
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v2
22+
uses: actions/setup-python@v3
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525
- name: Install dependencies
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "actionlint",
5+
"pattern": [
6+
{
7+
"regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$",
8+
"file": 1,
9+
"line": 2,
10+
"column": 3,
11+
"message": 4,
12+
"code": 5
13+
}
14+
]
15+
}
16+
]
17+
}

.github/workflows/mypy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
matrix:
1818
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v3
2121
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v2
22+
uses: actions/setup-python@v3
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525
- name: Install dependencies

.github/workflows/publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Extract branch info
2727
shell: bash
2828
run: |
29-
echo "release_tag=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
29+
echo "release_tag=${GITHUB_REF#refs/*/}" >> "$GITHUB_ENV"
3030
3131
- name: Create Release
3232
id: create_release
@@ -86,10 +86,10 @@ jobs:
8686
CMAKE_BUILD_TYPE: Release # do not compile with debug symbol to reduce wheel size
8787
run: |
8888
bash -x .github/workflows/scripts/build.sh ${{ matrix.python-version }} ${{ matrix.cuda-version }}
89-
wheel_name=$(ls dist/*whl | xargs -n 1 basename)
89+
wheel_name=$(find dist -name "*whl" -print0 | xargs -0 -n 1 basename)
9090
asset_name=${wheel_name//"linux"/"manylinux1"}
91-
echo "wheel_name=${wheel_name}" >> $GITHUB_ENV
92-
echo "asset_name=${asset_name}" >> $GITHUB_ENV
91+
echo "wheel_name=${wheel_name}" >> "$GITHUB_ENV"
92+
echo "asset_name=${asset_name}" >> "$GITHUB_ENV"
9393
9494
- name: Upload Release Asset
9595
uses: actions/upload-release-asset@v1

.github/workflows/ruff.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
matrix:
1818
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v3
2121
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v2
22+
uses: actions/setup-python@v3
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525
- name: Install dependencies

.github/workflows/yapf.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
matrix:
1717
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v3
2020
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v2
21+
uses: actions/setup-python@v3
2222
with:
2323
python-version: ${{ matrix.python-version }}
2424
- name: Install dependencies

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,6 @@ hip_compat.h
199199

200200
# Benchmark dataset
201201
benchmarks/*.json
202+
203+
# Linting
204+
actionlint

format.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ clang_format_changed() {
263263
MERGEBASE="$(git merge-base origin/main HEAD)"
264264

265265
# Get the list of changed files, excluding the specified ones
266-
changed_files=$(git diff --name-only --diff-filter=ACM "$MERGEBASE" -- '*.h' '*.cpp' '*.cu' '*.cuh' | grep -vFf <(printf "%s\n" "${CLANG_FORMAT_EXCLUDES[@]}"))
266+
changed_files=$(git diff --name-only --diff-filter=ACM "$MERGEBASE" -- '*.h' '*.cpp' '*.cu' '*.cuh' | (grep -vFf <(printf "%s\n" "${CLANG_FORMAT_EXCLUDES[@]}") || echo -e))
267267
if [ -n "$changed_files" ]; then
268268
echo "$changed_files" | xargs -P 5 clang-format -i
269269
fi
@@ -286,6 +286,9 @@ else
286286
fi
287287
echo 'vLLM clang-format: Done'
288288

289+
echo 'vLLM actionlint:'
290+
tools/actionlint.sh -color
291+
echo 'vLLM actionlint: Done'
289292

290293
if ! git diff --quiet &>/dev/null; then
291294
echo 'Reformatted files. Please review and stage the changes.'

tools/actionlint.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
if command -v actionlint &> /dev/null; then
4+
actionlint "$@"
5+
exit 0
6+
elif [ -x ./actionlint ]; then
7+
./actionlint "$@"
8+
exit 0
9+
fi
10+
11+
# download a binary to the current directory - v1.7.3
12+
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/aa0a7be8e566b096e64a5df8ff290ec24fa58fbc/scripts/download-actionlint.bash)
13+
./actionlint "$@"

0 commit comments

Comments
 (0)