-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (67 loc) · 2.42 KB
/
static.yml
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
name: static checks on sco
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
env:
ENV_SOURCE: /mnt/cache/share/platform/env/dipu_latest
PROXY_SOURCE: /mnt/cache/share/platform/env/proxy
WORKSPACE: workspace
CODE_SOURCE: source
CLANGD_TIDY_SOURCE: clangd-tidy
concurrency:
group: ${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
checkout-code:
name: checkout code
runs-on: tps-sco-ci
steps:
- name: prepare workspace
run: |
set -ex
cd && pwd && [[ ! -d ${WORKSPACE} ]] && mkdir ${WORKSPACE} && cd ${WORKSPACE} && pwd
- name: checkout code
run: |
set -ex
source ${PROXY_SOURCE}
cd && cd ${WORKSPACE} && pwd
if [ -n "${{ github.event.pull_request.head.repo.full_name }}" ] && [[ ! "${{ github.event.pull_request.head.repo.full_name }}" == "${{ github.repository }}" ]]; then
git clone ${{ github.event.pull_request.head.repo.clone_url }} ${SOURCE}
cd ${SOURCE} && git checkout ${{ github.event.pull_request.head.sha }}
git remote add mainrepo https://github.com/${{ github.repository }}.git
git fetch mainrepo && git merge --no-edit mainrepo/${{ github.base_ref }}
else
git clone ${{ github.event.repository.clone_url }} ${SOURCE} && cd ${SOURCE}
if [ "${{ github.event_name }}" == "pull_request" ]; then
git checkout ${{ github.event.pull_request.head.sha }} && git merge --no-edit ${{ github.base_ref }}
else
git checkout ${{ github.sha }}
fi
fi
git submodule update --init --recursive
- name: checkout clangd-tidy
run: |
set -ex
source ${PROXY_SOURCE}
cd && cd ${WORKSPACE}/${CODE_SOURCE} && pwd
git -c advice.detachedHead=false clone --depth 1 -b v0.1.2 https://github.com/lljbash/clangd-tidy.git ${CLANGD_TIDY_SOURCE}
build-and-tidy:
name: build
runs-on: tps-sco-ci
needs: [checkout-code]
steps:
- name: build
run: |
set -ex
source ${ENV_SOURCE}
cd && cd ${WORKSPACE}/${CODE_SOURCE} && pwd
pip install -e . -v --user
- name: clang-tidy
run: |
set -ex
source ${ENV_SOURCE}
cd && cd ${WORKSPACE}/${CODE_SOURCE} && pwd
git ls-files csrc | xargs ${CLANGD_TIDY_SOURCE}/clangd-tidy -j4