-
Notifications
You must be signed in to change notification settings - Fork 6k
60 lines (51 loc) · 1.57 KB
/
Codestyle-Check.yml
File metadata and controls
60 lines (51 loc) · 1.57 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
name: Codestyle-Check
on:
pull_request:
branches: ["develop"]
jobs:
check-bypass:
name: Check bypass
if: ${{ github.repository_owner == 'PaddlePaddle' }}
uses: ./.github/workflows/check-bypass.yml
with:
workflow-name: 'codestyle'
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
pre-commit:
name: Pre Commit
if: ${{ github.repository_owner == 'PaddlePaddle' && needs.check-bypass.outputs.can-skip != 'true' }}
needs: check-bypass
runs-on: ubuntu-latest
timeout-minutes: 10
env:
PR_ID: ${{ github.event.pull_request.number }}
BRANCH: develop
steps:
- name: Checkout base repo
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}
fetch-depth: 1000
- name: Merge PR to test branch
run: |
git fetch origin pull/${PR_ID}/merge
git checkout -b test FETCH_HEAD
- name: Setup python3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install dependencies
run: |
pip install pre-commit==2.17.0 cpplint==1.6.0 clang-format==13.0.0
pip install ast-grep-cli==0.40.0 # This version should be consistent with the one in .pre-commit-config.yaml
- name: Run ast-grep unit tests
run: |
ast-grep test
- name: Check pre-commit
env:
SKIP_CLANG_TIDY_CHECK: "ON"
run: |
set +e
bash -x tools/codestyle/pre_commit.sh;EXCODE=$?
exit $EXCODE