-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (107 loc) · 4.62 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
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
name: static checks on sco
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
env:
DEEPLINK_PATH: /mnt/cache/share/deeplinkci/github/${{ github.repository }}
ENV_SOURCE: /mnt/cache/share/platform/env/dipu_latest_ci
PROXY_SOURCE: /mnt/cache/share/platform/env/proxy
CLANGD_EXEC: /mnt/cache/share/platform/dep/clang-17/bin/clangd
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
static-checks-on-sco-nvidia:
name: static checks on nv
runs-on: tps-sco-ci
steps:
- name: setting up environment
run: |
set -euxo pipefail
set_env() {
echo "$1=$2" >> "${GITHUB_ENV}"
eval "$1=\"\$2\""
}
set_env WORKSPACE "${DEEPLINK_PATH}/${{ github.run_number }}"
set_env CODE_SOURCE "${WORKSPACE}/source"
set_env CLANGD_TIDY_SOURCE "${WORKSPACE}/clangd-tidy"
set_env CLANGD_TIDY_LOG "${WORKSPACE}/clang-tidy.log"
- name: clean obsolete workspaces & prepare workspace
run: |
set -euxo pipefail
mkdir -p ${DEEPLINK_PATH}
ls -la ${DEEPLINK_PATH}
rm -rf ${WORKSPACE}
find ${DEEPLINK_PATH} -mindepth 1 -maxdepth 1 -mmin +480 -type d -exec bash -c 'echo clean "$0" && rm -rf "$0"' {} \;
mkdir -p ${WORKSPACE}
- name: checkout code
run: |
set -euo pipefail
source ${PROXY_SOURCE}
set -x
rm -rf ${CODE_SOURCE}
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 }} ${CODE_SOURCE}
cd ${CODE_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 }} ${CODE_SOURCE} && cd ${CODE_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 -euo pipefail
source ${PROXY_SOURCE}
set -x
git -c advice.detachedHead=false clone --depth 1 -b v0.1.3 https://github.com/lljbash/clangd-tidy.git ${CLANGD_TIDY_SOURCE}
- name: build
run: |
set -euxo pipefail
srun --job-name=${GITHUB_JOB} bash -c "source ${ENV_SOURCE} && set -euxo pipefail && cd ${CODE_SOURCE} && pip install -e . -v -t install"
- name: clang-tidy
run: |
set -euxo pipefail
srun --job-name=${GITHUB_JOB} bash -c "source ${ENV_SOURCE} && set -euxo pipefail && cd ${CODE_SOURCE} && pwd && git ls-files csrc | xargs ${CLANGD_TIDY_SOURCE}/clangd-tidy --clangd-executable=${CLANGD_EXEC} --github --git-root=${CODE_SOURCE} -j4 -o ${CLANGD_TIDY_LOG}" || (cat ${CLANGD_TIDY_LOG} && false)
- name: cleanup
if: always()
run: |
set -euxo pipefail
rm -rf ${CODE_SOURCE}/build/.cache
build-on-ascend:
name: build on ascend
runs-on: tps-ascend-ci-910b
steps:
- name: prepare code
run: |
set -ex
rm ${DEEPLINK_PATH}/${{ github.run_number }}/* -rf
mkdir -p ${DEEPLINK_PATH}/${{ github.run_number }} && cd ${DEEPLINK_PATH}/${{ github.run_number }}
git clone https://github.com/DeepLink-org/DeepLinkExt.git && cd DeepLinkExt
git checkout ${{ github.event.pull_request.head.sha }} && git merge --no-edit ${{ github.base_ref }}
- name: build deeplink_ext
run: |
source /mnt/cache/share/platform/cienv/dipu_latest_ci
cd ${DEEPLINK_PATH}/${{ github.run_number }}/DeepLinkExt
python setup.py build_ext --inplace
test-on-ascend:
name: test on ascend
runs-on: tps-ascend-ci-910b
needs: [build-on-ascend]
steps:
- name: run unit tests on ascend
run: |
source /mnt/cache/share/platform/cienv/dipu_latest_ci
cd ${DEEPLINK_PATH}/${{ github.run_number }}/DeepLinkExt
export DEEPLINK_EXT_PLATFORM_TYPE=torch_dipu
python -m pytest tests/dipu
export DEEPLINK_EXT_PLATFORM_TYPE=torch_npu
python -m pytest tests/npu